1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package net.sourceforge.plantumldependency.commoncli.option.impl.verbose;
26
27 import static java.util.Arrays.asList;
28 import static java.util.Collections.unmodifiableSet;
29 import static net.sourceforge.plantumldependency.common.utils.check.ParameterCheckerUtils.checkNull;
30 import static net.sourceforge.plantumldependency.commoncli.constants.log.ErrorConstants.COMMAND_LINE_NULL_ERROR;
31 import static net.sourceforge.plantumldependency.commoncli.option.status.OptionStatus.ACTIVE_OPTIONAL_OPTION_STATUS;
32
33 import java.util.Set;
34 import java.util.TreeSet;
35
36 import net.sourceforge.plantumldependency.commoncli.command.CommandLine;
37 import net.sourceforge.plantumldependency.commoncli.exception.CommandLineException;
38 import net.sourceforge.plantumldependency.commoncli.option.AbstractOption;
39 import net.sourceforge.plantumldependency.commoncli.option.status.OptionStatus;
40
41
42
43
44
45
46
47
48
49 public class VerboseOption extends AbstractOption {
50
51
52 private static final long serialVersionUID = -5847253494029333067L;
53
54
55 public static final String OPTION_MAIN_SYNOPSIS = "-v";
56
57
58 public static final Set < String > OPTION_SYNOPSIS = unmodifiableSet(new TreeSet < String >(
59 asList(new String[] {"--verbose"})));
60
61
62
63
64
65
66 public VerboseOption() {
67 this(new StringBuilder("To display log information."), ACTIVE_OPTIONAL_OPTION_STATUS);
68 }
69
70
71
72
73
74
75
76
77
78
79
80
81 public VerboseOption(final StringBuilder fullOptionDescription, final OptionStatus optionStatus) {
82 super("-v", unmodifiableSet(new TreeSet < String >(asList(new String[] {"--verbose"}))), fullOptionDescription,
83 optionStatus);
84 }
85
86
87
88
89
90
91 @Override
92 public VerboseOption deepClone() {
93 return (VerboseOption) super.deepClone();
94 }
95
96
97
98
99
100
101 @Override
102 protected StringBuilder getFullUsageAdditions() {
103 return new StringBuilder();
104 }
105
106
107
108
109
110
111 @Override
112 protected StringBuilder getFullUsageDescriptionAdditions() {
113 return new StringBuilder();
114 }
115
116
117
118
119
120
121 @Override
122 protected StringBuilder getMainUsageAdditions() {
123 return new StringBuilder();
124 }
125
126
127
128
129
130
131
132
133
134
135
136
137 public boolean isVerboseModeActive(final CommandLine commandLine) throws CommandLineException {
138 checkNull(commandLine, COMMAND_LINE_NULL_ERROR);
139
140 return commandLine.isOptionActiveAndSpecified(this);
141 }
142 }