made nullSafe wrapper of JsonAdapter optional
This commit is contained in:
parent
f482f4a1cb
commit
193349f4aa
@ -94,4 +94,7 @@ public @interface JsonAdapter {
|
||||
/** Either a {@link TypeAdapter} or {@link TypeAdapterFactory}. */
|
||||
Class<?> value();
|
||||
|
||||
/** false, to be able to handle {@code null} values within the adapter, default value is true. */
|
||||
boolean nullSafe() default true;
|
||||
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public final class JsonAdapterAnnotationTypeAdapterFactory implements TypeAdapte
|
||||
+ "JsonSerializer or JsonDeserializer reference.");
|
||||
}
|
||||
|
||||
if (typeAdapter != null) {
|
||||
if (typeAdapter != null && annotation.nullSafe()) {
|
||||
typeAdapter = typeAdapter.nullSafe();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user