From e1cf5dfc9cd8705ca885ebf5170e791292d660cd Mon Sep 17 00:00:00 2001 From: Karthick Sankarachary Date: Fri, 27 May 2016 14:45:02 -0700 Subject: [PATCH] Rename nullable annotation to optional. --- .../java/com/typesafe/config/{Nullable.java => Optional.java} | 2 +- .../main/java/com/typesafe/config/impl/ConfigBeanImpl.java | 4 ++-- config/src/test/java/beanconfig/ObjectsConfig.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename config/src/main/java/com/typesafe/config/{Nullable.java => Optional.java} (90%) 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;