Skip to content

Commit 9850cf6

Browse files
committed
Add Javadoc to the GemFireProperties enumeration.
1 parent 3683021 commit 9850cf6

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

spring-data-geode/src/main/java/org/springframework/data/gemfire/GemFireProperties.java

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.springframework.util.Assert;
3030

3131
/**
32-
* An enumeration of Apache Geode {@literal gemfire.properties}.
32+
* An Enum (enumeration) of Apache Geode {@literal gemfire.properties}.
3333
*
3434
* @author John Blum
3535
* @see org.apache.geode.distributed.ConfigurationProperties
@@ -157,6 +157,15 @@ public enum GemFireProperties {
157157
USER_COMMAND_PACKAGES(ConfigurationProperties.USER_COMMAND_PACKAGES, String.class),
158158
VALIDATE_SERIALIZABLE_OBJECTS(ConfigurationProperties.VALIDATE_SERIALIZABLE_OBJECTS, Boolean.class, false);
159159

160+
/**
161+
* Factory method used to get a {@link GemFireProperties} enumerated value for the given {@link String property name}.
162+
*
163+
* @param propertyName {@link String name} of the {@link GemFireProperties} enumerated value to return.
164+
* @return a {@link GemFireProperties} enumerated value for the given {@link String property name}.
165+
* @throws IllegalArgumentException if a {@link GemFireProperties} enumerated value cannot be found
166+
* for the given {@link String property name}.
167+
* @see #values()
168+
*/
160169
public static @NonNull GemFireProperties from(@Nullable String propertyName) {
161170

162171
return Arrays.stream(values())
@@ -213,18 +222,53 @@ private static boolean equals(@Nullable GemFireProperties property, @Nullable St
213222
this.defaultValue = defaultValue;
214223
}
215224

225+
/**
226+
* Gets this property's {@link Object default value}.
227+
*
228+
* @return this property's {@link Object default value}.
229+
* @see java.lang.Object
230+
*/
216231
public @Nullable Object getDefaultValue() {
217232
return this.defaultValue != null ? this.defaultValue : DEFAULT_PROPERTY_VALUE;
218233
}
219234

235+
/**
236+
* Gets this property's {@link Object default value} as a {@link String}.
237+
*
238+
* @return this property's {@link Object default value} as a {@link String}. If this property's
239+
* {@link Object default value} is {@literal null}, then this method return the {@literal "null"} {@link String}.
240+
* @see #getDefaultValue()
241+
* @see java.lang.String
242+
*/
220243
public @NonNull String getDefaultValueAsString() {
221244
return String.valueOf(getDefaultValue());
222245
}
223246

247+
/**
248+
* Gets this property's {@link Object default value} converted to the property's declared {@link Class type}.
249+
*
250+
* @param <T> declared {@link Class type} of this property.
251+
* @return this property's {@link Object default value} converted to the property's declared {@link Class type}.
252+
* @throws IllegalArgumentException if this property's {@link Object default value} cannot be converted to
253+
* the property's declared {@link Class type}.
254+
* @see #getDefaultValueAsType(Class)
255+
* @see #getType()
256+
*/
224257
public @NonNull <T> T getDefaultValueAsType() {
225258
return getDefaultValueAsType(getType());
226259
}
227260

261+
/**
262+
* Gets this property's {@link Object default value} converted to the given {@link Class type}.
263+
*
264+
* @param <T> desired {@link Class type} for this property's {@link Object default value}.
265+
* @param type {@link Class type} to convert the property's {@link Object default value} to.
266+
* @return this property's {@link Object default value} converted to an instance of the given {@link Class type}.
267+
* @throws IllegalArgumentException if this property's {@link Object default value} cannot be converted to
268+
* an instance of the given {@link Class type}.
269+
* @see #getDefaultValue()
270+
* @see #getType()
271+
*/
228272
@SuppressWarnings("unchecked")
229273
public <T> T getDefaultValueAsType(Class<?> type) {
230274

@@ -233,21 +277,36 @@ public <T> T getDefaultValueAsType(Class<?> type) {
233277
Class<?> defaultValueType = nullSafeType(defaultValue, getType());
234278

235279
if (this.conversionService.canConvert(defaultValueType, type)) {
236-
return (T) this.conversionService.convert(getDefaultValue(), type);
280+
return (T) this.conversionService.convert(defaultValue, type);
237281
}
238282

239283
throw newIllegalArgumentException("Cannot convert value [%s] from type [%s] to type [%s]",
240284
defaultValue, defaultValueType, type);
241285
}
242286

287+
/**
288+
* Gets the {@link String name} of this property.
289+
*
290+
* @return the {@link String name} of this property.
291+
* @see java.lang.String
292+
*/
243293
public @NonNull String getName() {
244294
return this.propertyName;
245295
}
246296

297+
/**
298+
* Gets the declared {@link Class type} of this property.
299+
*
300+
* @return the declared {@link Class type} of this property.
301+
* @see java.lang.Class
302+
*/
247303
public @NonNull Class<?> getType() {
248304
return this.propertyType != null ? this.propertyType : DEFAULT_PROPERTY_TYPE;
249305
}
250306

307+
/**
308+
* @inheritDoc
309+
*/
251310
@Override
252311
public String toString() {
253312
return getName();

0 commit comments

Comments
 (0)