|
5 | 5 | import com.unboundid.util.args.ArgumentException; |
6 | 6 | import com.unboundid.util.args.IntegerArgument; |
7 | 7 |
|
8 | | - |
9 | 8 | import java.util.MissingResourceException; |
10 | 9 | import java.util.ResourceBundle; |
11 | 10 |
|
|
15 | 14 | * an {@link Integer}. |
16 | 15 | */ |
17 | 16 | public class IntegerPropertiesBackedArgument |
18 | | - extends PropertiesBackedArgument<IntegerArgument,Integer> |
19 | | -{ |
20 | | - |
| 17 | + extends PropertiesBackedArgument<IntegerArgument,Integer> { |
21 | 18 |
|
22 | 19 |
|
23 | 20 | /** |
24 | 21 | * @param resourceBundle |
25 | | - * the resource bundle from which the command line argument |
26 | | - * are taken |
27 | | - * |
| 22 | + * the resource bundle from which the command line argument |
| 23 | + * are taken |
28 | 24 | * @param basePropertyName |
29 | | - * the base property name |
30 | | - * |
| 25 | + * the base property name |
| 26 | + * |
31 | 27 | * @return a new {@code StringPropertiesBackedArgument} object. |
32 | 28 | */ |
33 | 29 | public static IntegerPropertiesBackedArgument newIntegerPropertiesBackedArgument( |
34 | | - final ResourceBundle resourceBundle,final String basePropertyName) |
35 | | - { |
| 30 | + final ResourceBundle resourceBundle, final String basePropertyName) { |
36 | 31 | return new IntegerPropertiesBackedArgument(resourceBundle,basePropertyName); |
37 | 32 | } |
38 | 33 |
|
39 | 34 |
|
40 | 35 |
|
41 | 36 | @Override |
42 | | - public IntegerArgument getArgument() throws ArgumentException |
43 | | - { |
| 37 | + public IntegerArgument getArgument() throws ArgumentException { |
44 | 38 | /* |
45 | 39 | * Construct an IntegerArgument using the provided information - and |
46 | 40 | * use the upper bound and lower bound if provided. |
47 | 41 | */ |
48 | 42 | IntegerArgument arg; |
49 | | - try |
50 | | - { |
| 43 | + try { |
51 | 44 | final int lowerBound = getLowerBound().intValue(); |
52 | 45 | final int upperBound = getUpperBound().intValue(); |
53 | 46 | arg = |
54 | | - new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(), |
55 | | - getMaxOccurrences(),getValuePlaceholder(),getDescription(),lowerBound, |
56 | | - upperBound,getDefaultValue()); |
57 | | - } |
58 | | - catch(final MissingResourceException ex) |
59 | | - { |
| 47 | + new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(), |
| 48 | + getMaxOccurrences(),getValuePlaceholder(),getDescription(),lowerBound, |
| 49 | + upperBound,getDefaultValue()); |
| 50 | + } catch(final MissingResourceException ex) { |
60 | 51 | arg = |
61 | | - new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(), |
62 | | - getMaxOccurrences(),getValuePlaceholder(),getDescription(), |
63 | | - getDefaultValue()); |
| 52 | + new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(), |
| 53 | + getMaxOccurrences(),getValuePlaceholder(),getDescription(), |
| 54 | + getDefaultValue()); |
64 | 55 | } |
65 | 56 |
|
66 | 57 | return arg; |
67 | 58 | } |
68 | 59 |
|
69 | 60 |
|
70 | 61 |
|
71 | | - /** @return the {@code value} as an {@link Integer}. */ |
| 62 | + /** |
| 63 | + * @return the {@code value} as an {@link Integer}. |
| 64 | + */ |
72 | 65 | @Override |
73 | | - protected Integer convertString(final String value) |
74 | | - { |
| 66 | + protected Integer convertString(final String value) { |
75 | 67 | Validator.ensureNotNull(value); |
76 | 68 | return Integer.valueOf(value); |
77 | 69 | } |
78 | 70 |
|
79 | 71 |
|
80 | 72 |
|
81 | | - private Integer getLowerBound() throws MissingResourceException |
82 | | - { |
| 73 | + private Integer getLowerBound() throws MissingResourceException { |
83 | 74 | return Integer.valueOf(getResourceBundle().getString(getBasePropertyName() + "LowerBound")); |
84 | 75 | } |
85 | 76 |
|
86 | 77 |
|
87 | 78 |
|
88 | | - private Integer getUpperBound() throws MissingResourceException |
89 | | - { |
| 79 | + private Integer getUpperBound() throws MissingResourceException { |
90 | 80 | return Integer.valueOf(getResourceBundle().getString(getBasePropertyName() + "UpperBound")); |
91 | 81 | } |
92 | 82 |
|
93 | 83 |
|
94 | 84 |
|
95 | 85 | private IntegerPropertiesBackedArgument( |
96 | | - final ResourceBundle resourceBundle,final String basePropertyName) |
97 | | - { |
| 86 | + final ResourceBundle resourceBundle, final String basePropertyName) { |
98 | 87 | super(resourceBundle,basePropertyName); |
99 | 88 | } |
100 | 89 |
|
101 | 90 |
|
102 | | - |
103 | 91 | } |
0 commit comments