com.github.netkorp.telegram.framework.commands.abstracts.AbstractCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 45
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setMessageSource(MessageSource) 0 3 1
A setCommandManager(CommandManager) 0 3 1
A setBot(PollingTelegramBot) 0 3 1
1
package com.github.netkorp.telegram.framework.commands.abstracts;
0 ignored issues
show
Code Smell introduced by
It is a best practice to supply a copyright/licence header in your code. Your organisation probably has a template for that.
Loading history...
2
3
import com.github.netkorp.telegram.framework.bots.PollingTelegramBot;
4
import com.github.netkorp.telegram.framework.commands.interfaces.Command;
5
import com.github.netkorp.telegram.framework.managers.CommandManager;
6
import org.springframework.beans.factory.annotation.Autowired;
7
import org.springframework.beans.factory.annotation.Qualifier;
8
import org.springframework.context.MessageSource;
9
import org.springframework.context.annotation.Lazy;
10
11
/**
12
 * Stores the basic components that the command needs.
13
 */
14
abstract class AbstractCommand implements Command {
0 ignored issues
show
Coding Style introduced by
Move this left curly brace to the beginning of next line of code.
Loading history...
15
16
    /**
17
     * The bot that the command can use to share information with Telegram.
18
     */
19
    protected PollingTelegramBot bot;
0 ignored issues
show
Coding Style introduced by
Make this line start at column 3.
Loading history...
20
21
    /**
22
     * The component for managing all of the commands available in the bot.
23
     */
24
    protected CommandManager commandManager;
25
26
    /**
27
     * The component for resolving messages
28
     */
29
    protected MessageSource messageSource;
30
31
    /**
32
     * Sets the Telegram bot to be used.
33
     *
34
     * @param bot the Telegram bot.
35
     */
36
    @Autowired
37
    public void setBot(PollingTelegramBot bot) {
0 ignored issues
show
Coding Style introduced by
Move this left curly brace to the beginning of next line of code.
Loading history...
38
        this.bot = bot;
0 ignored issues
show
Coding Style introduced by
Make this line start at column 5.
Loading history...
39
    }
40
41
    /**
42
     * Sets the {@link CommandManager} to be used.
43
     *
44
     * @param commandManager the {@link CommandManager} instance.
45
     */
46
    @Autowired
47
    public void setCommandManager(@Lazy CommandManager commandManager) {
0 ignored issues
show
Coding Style introduced by
Move this left curly brace to the beginning of next line of code.
Loading history...
48
        this.commandManager = commandManager;
0 ignored issues
show
Coding Style introduced by
Make this line start at column 5.
Loading history...
49
    }
50
51
    /**
52
     * Sets the {@link MessageSource} to be used.
53
     *
54
     * @param messageSource the {@link MessageSource} instance.
55
     */
56
    @Autowired
57
    public void setMessageSource(@Qualifier("TelegramFrameworkMessageSource") MessageSource messageSource) {
0 ignored issues
show
Coding Style introduced by
Move this left curly brace to the beginning of next line of code.
Loading history...
58
        this.messageSource = messageSource;
0 ignored issues
show
Coding Style introduced by
Make this line start at column 5.
Loading history...
59
    }
60
}
61