diff --git a/config/src/main/java/com/typesafe/config/Nullable.java b/config/src/main/java/com/typesafe/config/Optional.java similarity index 90% rename from config/src/main/java/com/typesafe/config/Nullable.java rename to config/src/main/java/com/typesafe/config/Optional.java index 92917823..4645ed5f 100644 --- a/config/src/main/java/com/typesafe/config/Nullable.java +++ b/config/src/main/java/com/typesafe/config/Optional.java @@ -9,6 +9,6 @@ import java.lang.annotation.RetentionPolicy; */ @Documented @Retention(RetentionPolicy.RUNTIME) -public @interface Nullable { +public @interface Optional { } diff --git a/config/src/main/java/com/typesafe/config/impl/ConfigBeanImpl.java b/config/src/main/java/com/typesafe/config/impl/ConfigBeanImpl.java index 1e01bac2..9e12219b 100644 --- a/config/src/main/java/com/typesafe/config/impl/ConfigBeanImpl.java +++ b/config/src/main/java/com/typesafe/config/impl/ConfigBeanImpl.java @@ -24,7 +24,7 @@ import com.typesafe.config.ConfigException; import com.typesafe.config.ConfigMemorySize; import com.typesafe.config.ConfigValue; import com.typesafe.config.ConfigValueType; -import com.typesafe.config.Nullable; +import com.typesafe.config.Optional; /** * Internal implementation detail, not ABI stable, do not touch. @@ -136,7 +136,7 @@ public class ConfigBeanImpl { private static boolean isOptionalProperty(Class clazz, PropertyDescriptor beanProp) { 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 diff --git a/config/src/test/java/beanconfig/ObjectsConfig.java b/config/src/test/java/beanconfig/ObjectsConfig.java index 5b48895b..defc6b2f 100644 --- a/config/src/test/java/beanconfig/ObjectsConfig.java +++ b/config/src/test/java/beanconfig/ObjectsConfig.java @@ -1,11 +1,11 @@ package beanconfig; -import com.typesafe.config.Nullable; +import com.typesafe.config.Optional; public class ObjectsConfig { public static class ValueObject { - @Nullable + @Optional private String nullableValue; private String nonNullableValue;