1
2
3
4
5
6 package gov.nist.secauto.metaschema.cli.processor.command;
7
8 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
9
10 public class DefaultExtraArgument implements ExtraArgument {
11 private final String name;
12 private final boolean required;
13 private final int number;
14
15 @SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields")
16 public DefaultExtraArgument(String name, boolean required) {
17 this(name, required, 1);
18 }
19
20 @SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields")
21 public DefaultExtraArgument(String name, boolean required, int number) {
22 if (number < 1) {
23 throw new IllegalArgumentException("number must be a positive value");
24 }
25 this.name = name;
26 this.required = required;
27 this.number = number;
28 }
29
30 @Override
31 public String getName() {
32 return name;
33 }
34
35 @Override
36 public boolean isRequired() {
37 return required;
38 }
39
40 @Override
41 public int getNumber() {
42 return number;
43 }
44
45 }