Merge pull request #881 from testcenter/master

made nullSafe wrapper of JsonAdapter optional
This commit is contained in:
inder123 2016-07-03 01:53:19 -07:00 committed by GitHub
commit 8b464231f7
2 changed files with 4 additions and 1 deletions

View File

@ -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;
}

View File

@ -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();
}