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.cli.main.option.display.packagename;
26
27 import static java.util.Arrays.asList;
28 import static java.util.Collections.unmodifiableSet;
29 import static net.sourceforge.plantumldependency.cli.constants.PlantUMLDependencyConstants.DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING;
30 import static net.sourceforge.plantumldependency.cli.constants.PlantUMLDependencyConstants.NATIVE_DEPENDENCY_PACKAGE_NAME;
31 import static net.sourceforge.plantumldependency.common.constants.CharacterConstants.SPACE_CHAR;
32 import static net.sourceforge.plantumldependency.commoncli.option.status.OptionStatus.ACTIVE_OPTIONAL_OPTION_STATUS;
33
34 import java.util.Set;
35 import java.util.TreeSet;
36 import java.util.regex.Pattern;
37
38 import net.sourceforge.plantumldependency.cli.main.option.display.packagename.argument.PlantUMLDependencyDisplayPackageNameOptionArgument;
39 import net.sourceforge.plantumldependency.commoncli.command.CommandLine;
40 import net.sourceforge.plantumldependency.commoncli.exception.CommandLineException;
41 import net.sourceforge.plantumldependency.commoncli.option.AbstractOptionWithArgument;
42
43
44
45
46
47
48
49
50
51 public class PlantUMLDependencyDisplayPackageNameOption extends AbstractOptionWithArgument < Pattern > {
52
53
54 private static final long serialVersionUID = 6636249105521044787L;
55
56
57 public static final String OPTION_MAIN_SYNOPSIS = "-dp";
58
59
60 public static final Set < String > OPTION_SYNOPSIS = unmodifiableSet(new TreeSet < String >(
61 asList(new String[] {"--display-package-name"})));
62
63
64
65
66
67
68 public PlantUMLDependencyDisplayPackageNameOption() {
69 super(
70 OPTION_MAIN_SYNOPSIS,
71 OPTION_SYNOPSIS,
72 new PlantUMLDependencyDisplayPackageNameOptionArgument(),
73 new StringBuilder(
74 "To specify class diagram objects to display following their package name. If not specified, the default is \""
75 + DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING
76 + "\". Note : native calls which are represented by the \""
77 + NATIVE_DEPENDENCY_PACKAGE_NAME
78 + "\" package name can also be matched by this regular expression even if it is a fictive dependency."),
79 SPACE_CHAR, ACTIVE_OPTIONAL_OPTION_STATUS);
80 }
81
82
83
84
85
86
87 @Override
88 public String getDefaultArgumentAsStringIfOptionNotSpecified(final CommandLine commandLine)
89 throws CommandLineException {
90 return DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING;
91 }
92
93
94
95
96
97
98 @Override
99 public String getDefaultArgumentAsStringIfOptionSpecified(final CommandLine commandLine)
100 throws CommandLineException {
101 return DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING;
102 }
103 }