Package org.dominokit.jacksonapt
Class DefaultJsonDeserializationContext.Builder
java.lang.Object
org.dominokit.jacksonapt.DefaultJsonDeserializationContext.Builder
- Direct Known Subclasses:
DefaultJsonDeserializationContext.DefaultBuilder
- Enclosing class:
- DefaultJsonDeserializationContext
public static class DefaultJsonDeserializationContext.Builder
extends java.lang.Object
Builder for
JsonDeserializationContext. To override default settings globally, you can extend this class, modify the
default settings inside the constructor and tell the compiler to use your builder instead in your gwt.xml file :
<replace-with class="your.package.YourBuilder">
<when-type-assignable class="org.dominokit.jacksonapt.JsonDeserializationContext.Builder" />
</replace-with>
-
Field Summary
Fields Modifier and Type Field Description protected booleanacceptSingleValueAsArrayprotected booleanfailOnUnknownPropertiesprotected booleanreadUnknownEnumValuesAsNullprotected booleanunwrapRootValueprotected booleanuseBrowserTimezoneprotected booleanuseSafeEvalprotected booleanwrapExceptions -
Constructor Summary
Constructors Constructor Description Builder()Deprecated. -
Method Summary
Modifier and Type Method Description DefaultJsonDeserializationContext.BuilderacceptSingleValueAsArray(boolean acceptSingleValueAsArray)Feature that determines whether it is acceptable to coerce non-array (in JSON) values to work with Java collection (arrays, java.util.Collection) types.JsonDeserializationContextbuild()DefaultJsonDeserializationContext.BuilderfailOnUnknownProperties(boolean failOnUnknownProperties)Determines whether encountering of unknown properties (ones that do not map to a property, and there is no "any setter" or handler that can handle it) should result in a failure (by throwing aJsonDeserializationException) or not.DefaultJsonDeserializationContext.BuilderreadUnknownEnumValuesAsNull(boolean readUnknownEnumValuesAsNull)Feature that determines whether gwt-jackson should return null for unknown enum values.DefaultJsonDeserializationContext.BuilderunwrapRootValue(boolean unwrapRootValue)Feature to allow "unwrapping" root-level JSON value, to match setting ofDefaultJsonSerializationContext.Builder.wrapRootValue(boolean)used for serialization.DefaultJsonDeserializationContext.BuilderuseBrowserTimezone(boolean useBrowserTimezone)Feature that specifies whether dates that doesn't contain timezone information are interpreted using the browser timezone or being relative to UTC (the default).DefaultJsonDeserializationContext.BuilderuseSafeEval(boolean useSafeEval)to deserialize JsType
DefaultJsonDeserializationContext.BuilderwrapExceptions(boolean wrapExceptions)Feature that determines whether gwt-jackson code should catch and wrapRuntimeExceptions (but neverErrors!) to add additional information about location (within input) of problem or not.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
failOnUnknownProperties
protected boolean failOnUnknownProperties -
unwrapRootValue
protected boolean unwrapRootValue -
acceptSingleValueAsArray
protected boolean acceptSingleValueAsArray -
wrapExceptions
protected boolean wrapExceptions -
useSafeEval
protected boolean useSafeEval -
readUnknownEnumValuesAsNull
protected boolean readUnknownEnumValuesAsNull -
useBrowserTimezone
protected boolean useBrowserTimezone
-
-
Constructor Details
-
Builder
@Deprecated public Builder()Deprecated.UseDefaultJsonDeserializationContext.builder()instead. This constructor will be made protected in v1.0.
-
-
Method Details
-
failOnUnknownProperties
public DefaultJsonDeserializationContext.Builder failOnUnknownProperties(boolean failOnUnknownProperties)Determines whether encountering of unknown properties (ones that do not map to a property, and there is no "any setter" or handler that can handle it) should result in a failure (by throwing aJsonDeserializationException) or not. This setting only takes effect after all other handling methods for unknown properties have been tried, and property remains unhandled.Feature is enabled by default (meaning that a
JsonDeserializationExceptionwill be thrown if an unknown property is encountered).- Parameters:
failOnUnknownProperties- true if should fail on unknown properties- Returns:
- the builder
-
unwrapRootValue
Feature to allow "unwrapping" root-level JSON value, to match setting ofDefaultJsonSerializationContext.Builder.wrapRootValue(boolean)used for serialization. Will verify that the root JSON value is a JSON Object, and that it has a single property with expected root name. If not, aJsonDeserializationExceptionis thrown; otherwise value of the wrapped property will be deserialized as if it was the root value.Feature is disabled by default.
- Parameters:
unwrapRootValue- true if should unwrapRootValue- Returns:
- the builder
-
acceptSingleValueAsArray
public DefaultJsonDeserializationContext.Builder acceptSingleValueAsArray(boolean acceptSingleValueAsArray)Feature that determines whether it is acceptable to coerce non-array (in JSON) values to work with Java collection (arrays, java.util.Collection) types. If enabled, collection deserializers will try to handle non-array values as if they had "implicit" surrounding JSON array. This feature is meant to be used for compatibility/interoperability reasons, to work with packages (such as XML-to-JSON converters) that leave out JSON array in cases where there is just a single element in array.Feature is disabled by default.
- Parameters:
acceptSingleValueAsArray- true if should acceptSingleValueAsArray- Returns:
- the builder
-
wrapExceptions
Feature that determines whether gwt-jackson code should catch and wrapRuntimeExceptions (but neverErrors!) to add additional information about location (within input) of problem or not. If enabled, exceptions will be caught and re-thrown; this can be convenient both in that all exceptions will be checked and declared, and so there is more contextual information. However, sometimes calling application may just want "raw" unchecked exceptions passed as is.
Feature is enabled by default.- Parameters:
wrapExceptions- true if should wrapExceptions- Returns:
- the builder
-
useSafeEval
to deserialize JsType
- Parameters:
useSafeEval- true if should useSafeEval- Returns:
- the builder
-
readUnknownEnumValuesAsNull
public DefaultJsonDeserializationContext.Builder readUnknownEnumValuesAsNull(boolean readUnknownEnumValuesAsNull)Feature that determines whether gwt-jackson should return null for unknown enum values. Default is false which will throwIllegalArgumentExceptionwhen unknown enum value is found.- Parameters:
readUnknownEnumValuesAsNull- true if should readUnknownEnumValuesAsNull- Returns:
- the builder
-
useBrowserTimezone
Feature that specifies whether dates that doesn't contain timezone information are interpreted using the browser timezone or being relative to UTC (the default).- Parameters:
useBrowserTimezone- true if should use browser timezone- Returns:
- the builder
-
build
-
DefaultJsonDeserializationContext.builder()instead.