31
31
*/
32
32
public abstract class BaseConfiguration implements Configuration {
33
33
34
- /**
35
- * {@inheritDoc}
36
- */
37
34
@ Override
38
35
public String getProperty (final String name , final String defaultValue ) {
39
36
final Optional <String > optional = getProperty (name );
@@ -43,9 +40,6 @@ public String getProperty(final String name, final String defaultValue) {
43
40
return defaultValue ;
44
41
}
45
42
46
- /**
47
- * {@inheritDoc}
48
- */
49
43
@ Override
50
44
public String getRequiredProperty (final String name ) throws NoSuchElementException {
51
45
final Optional <String > optional = getProperty (name );
@@ -56,181 +50,121 @@ public String getRequiredProperty(final String name) throws NoSuchElementExcepti
56
50
String .format ("Required configuration property does not exist; name=%s" , name ));
57
51
}
58
52
59
- /**
60
- * {@inheritDoc}
61
- */
62
53
@ Override
63
54
public Optional <Boolean > getPropertyAsBoolean (final String name ) {
64
55
final Optional <String > property = getProperty (name );
65
56
return property .isPresent () ? Optional .of (Boolean .parseBoolean (property .get ())) : Optional .<Boolean >empty ();
66
57
}
67
58
68
- /**
69
- * {@inheritDoc}
70
- */
71
59
@ Override
72
60
public boolean getPropertyAsBoolean (final String name , final boolean defaultValue ) {
73
61
final Optional <Boolean > property = getPropertyAsBoolean (name );
74
62
return property .orElse (defaultValue );
75
63
}
76
64
77
- /**
78
- * {@inheritDoc}
79
- */
80
65
@ Override
81
66
public boolean getRequiredPropertyAsBoolean (final String name ) throws NoSuchElementException {
82
67
final String property = getRequiredProperty (name );
83
68
return Boolean .parseBoolean (property );
84
69
}
85
70
86
- /**
87
- * {@inheritDoc}
88
- */
89
71
@ Override
90
72
public Optional <Integer > getPropertyAsInteger (final String name ) throws NumberFormatException {
91
73
final Optional <String > property = getProperty (name );
92
74
return property .isPresent () ? Optional .of (Integer .parseInt (property .get ())) : Optional .<Integer >empty ();
93
75
}
94
76
95
- /**
96
- * {@inheritDoc}
97
- */
98
77
@ Override
99
78
public int getPropertyAsInteger (final String name , final int defaultValue ) throws NumberFormatException {
100
79
final Optional <Integer > property = getPropertyAsInteger (name );
101
80
return property .orElse (defaultValue );
102
81
}
103
82
104
- /**
105
- * {@inheritDoc}
106
- */
107
83
@ Override
108
84
public int getRequiredPropertyAsInteger (final String name ) throws NoSuchElementException , NumberFormatException {
109
85
final String property = getRequiredProperty (name );
110
86
return Integer .parseInt (property );
111
87
}
112
88
113
- /**
114
- * {@inheritDoc}
115
- */
116
89
@ Override
117
90
public Optional <Long > getPropertyAsLong (final String name ) throws NumberFormatException {
118
91
final Optional <String > property = getProperty (name );
119
92
return property .isPresent () ? Optional .of (Long .parseLong (property .get ())) : Optional .<Long >empty ();
120
93
}
121
94
122
- /**
123
- * {@inheritDoc}
124
- */
125
95
@ Override
126
96
public long getPropertyAsLong (final String name , final long defaultValue ) throws NumberFormatException {
127
97
final Optional <Long > property = getPropertyAsLong (name );
128
98
return property .orElse (defaultValue );
129
99
}
130
100
131
- /**
132
- * {@inheritDoc}
133
- */
134
101
@ Override
135
102
public long getRequiredPropertyAsLong (final String name ) throws NoSuchElementException , NumberFormatException {
136
103
final String property = getRequiredProperty (name );
137
104
return Long .parseLong (property );
138
105
}
139
106
140
- /**
141
- * {@inheritDoc}
142
- */
143
107
@ Override
144
108
public Optional <Double > getPropertyAsDouble (final String name ) throws NumberFormatException {
145
109
final Optional <String > property = getProperty (name );
146
110
return property .isPresent () ? Optional .of (Double .parseDouble (property .get ())) : Optional .<Double >empty ();
147
111
}
148
112
149
- /**
150
- * {@inheritDoc}
151
- */
152
113
@ Override
153
114
public double getPropertyAsDouble (final String name , final double defaultValue ) throws NumberFormatException {
154
115
final Optional <Double > property = getPropertyAsDouble (name );
155
116
return property .orElse (defaultValue );
156
117
}
157
118
158
- /**
159
- * {@inheritDoc}
160
- */
161
119
@ Override
162
120
public double getRequiredPropertyAsDouble (final String name ) throws NoSuchElementException , NumberFormatException {
163
121
final String property = getRequiredProperty (name );
164
122
return Double .parseDouble (property );
165
123
}
166
124
167
- /**
168
- * {@inheritDoc}
169
- */
170
125
@ Override
171
126
public Optional <Float > getPropertyAsFloat (final String name ) throws NumberFormatException {
172
127
final Optional <String > property = getProperty (name );
173
128
return property .isPresent () ? Optional .of (Float .parseFloat (property .get ())) : Optional .<Float >empty ();
174
129
}
175
130
176
- /**
177
- * {@inheritDoc}
178
- */
179
131
@ Override
180
132
public float getPropertyAsFloat (final String name , final float defaultValue ) throws NumberFormatException {
181
133
final Optional <Float > property = getPropertyAsFloat (name );
182
134
return property .orElse (defaultValue );
183
135
}
184
136
185
- /**
186
- * {@inheritDoc}
187
- */
188
137
@ Override
189
138
public float getRequiredPropertyAsFloat (final String name ) throws NoSuchElementException , NumberFormatException {
190
139
final String property = getRequiredProperty (name );
191
140
return Float .parseFloat (property );
192
141
}
193
142
194
- /**
195
- * {@inheritDoc}
196
- */
197
143
@ Override
198
144
public Optional <Short > getPropertyAsShort (final String name ) throws NumberFormatException {
199
145
final Optional <String > property = getProperty (name );
200
146
return property .isPresent () ? Optional .of (Short .valueOf (property .get ())) : Optional .<Short >empty ();
201
147
}
202
148
203
- /**
204
- * {@inheritDoc}
205
- */
206
149
@ Override
207
150
public short getPropertyAsShort (final String name , final short defaultValue ) throws NumberFormatException {
208
151
final Optional <Short > property = getPropertyAsShort (name );
209
152
return property .isPresent () ? property .get ().shortValue () : defaultValue ;
210
153
}
211
154
212
- /**
213
- * {@inheritDoc}
214
- */
215
155
@ Override
216
156
public short getRequiredPropertyAsShort (final String name ) throws NoSuchElementException , NumberFormatException {
217
157
final String property = getRequiredProperty (name );
218
158
return Short .parseShort (property );
219
159
}
220
160
221
- /**
222
- * {@inheritDoc}
223
- */
224
161
@ Override
225
162
public <T > T getPropertyAs (final String name , final Class <? extends T > clazz , final T defaultValue )
226
163
throws IllegalArgumentException {
227
164
final Optional <T > property = getPropertyAs (name , clazz );
228
165
return property .isPresent () ? property .get () : defaultValue ;
229
166
}
230
167
231
- /**
232
- * {@inheritDoc}
233
- */
234
168
@ Override
235
169
public <T > T getRequiredPropertyAs (final String name , final Class <? extends T > clazz )
236
170
throws NoSuchElementException , IllegalArgumentException {
@@ -242,18 +176,12 @@ public <T> T getRequiredPropertyAs(final String name, final Class<? extends T> c
242
176
return property .get ();
243
177
}
244
178
245
- /**
246
- * {@inheritDoc}
247
- */
248
179
@ Override
249
180
public <T > T getAs (final Class <? extends T > clazz , final T defaultValue ) throws IllegalArgumentException {
250
181
final Optional <T > property = getAs (clazz );
251
182
return property .isPresent () ? property .get () : defaultValue ;
252
183
}
253
184
254
- /**
255
- * {@inheritDoc}
256
- */
257
185
@ Override
258
186
public <T > T getRequiredAs (final Class <? extends T > clazz ) throws NoSuchElementException , IllegalArgumentException {
259
187
final Optional <T > property = getAs (clazz );
@@ -263,19 +191,13 @@ public <T> T getRequiredAs(final Class<? extends T> clazz) throws NoSuchElementE
263
191
return property .get ();
264
192
}
265
193
266
- /**
267
- * {@inheritDoc}
268
- */
269
194
@ Override
270
195
public <T > T getPropertyAs (final String name , final Type type , final T defaultValue )
271
196
throws IllegalArgumentException {
272
197
final Optional <T > property = getPropertyAs (name , type );
273
198
return property .isPresent () ? property .get () : defaultValue ;
274
199
}
275
200
276
- /**
277
- * {@inheritDoc}
278
- */
279
201
@ Override
280
202
public <T > T getRequiredPropertyAs (final String name , final Type type )
281
203
throws NoSuchElementException , IllegalArgumentException {
@@ -287,18 +209,12 @@ public <T> T getRequiredPropertyAs(final String name, final Type type)
287
209
return property .get ();
288
210
}
289
211
290
- /**
291
- * {@inheritDoc}
292
- */
293
212
@ Override
294
213
public <T > T getAs (final Type type , final T defaultValue ) throws IllegalArgumentException {
295
214
final Optional <T > property = getAs (type );
296
215
return property .isPresent () ? property .get () : defaultValue ;
297
216
}
298
217
299
- /**
300
- * {@inheritDoc}
301
- */
302
218
@ Override
303
219
public <T > T getRequiredAs (final Type type ) throws NoSuchElementException , IllegalArgumentException {
304
220
final Optional <T > property = getAs (type );
@@ -318,9 +234,6 @@ public Object toLogValue() {
318
234
return LogReferenceOnly .of (this );
319
235
}
320
236
321
- /**
322
- * {@inheritDoc}
323
- */
324
237
@ Override
325
238
public String toString () {
326
239
return toLogValue ().toString ();
0 commit comments