Rename nullable annotation to optional.

This commit is contained in:
Karthick Sankarachary 2016-05-27 14:45:02 -07:00
parent cc06b02e0c
commit e1cf5dfc9c
3 changed files with 5 additions and 5 deletions

View File

@ -9,6 +9,6 @@ import java.lang.annotation.RetentionPolicy;
*/ */
@Documented @Documented
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface Nullable { public @interface Optional {
} }

View File

@ -24,7 +24,7 @@ import com.typesafe.config.ConfigException;
import com.typesafe.config.ConfigMemorySize; import com.typesafe.config.ConfigMemorySize;
import com.typesafe.config.ConfigValue; import com.typesafe.config.ConfigValue;
import com.typesafe.config.ConfigValueType; import com.typesafe.config.ConfigValueType;
import com.typesafe.config.Nullable; import com.typesafe.config.Optional;
/** /**
* Internal implementation detail, not ABI stable, do not touch. * Internal implementation detail, not ABI stable, do not touch.
@ -136,7 +136,7 @@ public class ConfigBeanImpl {
private static boolean isOptionalProperty(Class clazz, PropertyDescriptor beanProp) { private static boolean isOptionalProperty(Class clazz, PropertyDescriptor beanProp) {
Field field = FieldUtils.getField(clazz, beanProp.getName(), true); Field field = FieldUtils.getField(clazz, beanProp.getName(), true);
return (field.getAnnotationsByType(Nullable.class).length > 0); return (field.getAnnotationsByType(Optional.class).length > 0);
} }
// we could magically make this work in many cases by doing // we could magically make this work in many cases by doing

View File

@ -1,11 +1,11 @@
package beanconfig; package beanconfig;
import com.typesafe.config.Nullable; import com.typesafe.config.Optional;
public class ObjectsConfig { public class ObjectsConfig {
public static class ValueObject { public static class ValueObject {
@Nullable @Optional
private String nullableValue; private String nullableValue;
private String nonNullableValue; private String nonNullableValue;