mirror of
https://github.com/lightbend/config.git
synced 2025-01-15 23:01:05 +08:00
Rename nullable annotation to optional.
This commit is contained in:
parent
cc06b02e0c
commit
e1cf5dfc9c
@ -9,6 +9,6 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
*/
|
*/
|
||||||
@Documented
|
@Documented
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Nullable {
|
public @interface Optional {
|
||||||
|
|
||||||
}
|
}
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user