Package io.avaje.jsonb
Interface Jsonb.Builder
-
- Enclosing interface:
- Jsonb
public static interface Jsonb.Builder
Build the Jsonb instance adding JsonAdapter, Factory or AdapterBuilder.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Jsonb.Builder
adapter(JsonStreamAdapter streamAdapter)
Explicitly set the adapter to use.Jsonb.Builder
add(JsonAdapter.Factory factory)
Add a JsonAdapter.Factory which provides JsonAdapters to use.Jsonb.Builder
add(JsonbComponent component)
Add a Component which can provide multiple JsonAdapters and or configuration.<T> Jsonb.Builder
add(Type type, JsonAdapter<T> jsonAdapter)
Add a JsonAdapter to use for the given type.Jsonb.Builder
add(Type type, Jsonb.AdapterBuilder builder)
Add a AdapterBuilder which provides a JsonAdapter to use for the given type.Jsonb
build()
Build and return the Jsonb instance with all the given adapters and factories registered.Jsonb.Builder
failOnUnknown(boolean failOnUnknown)
Set failOnUnknown to true such that an exception is thrown when unknown properties are read in the json content.Jsonb.Builder
mathTypesAsString(boolean mathTypesAsString)
Set to true for BigDecimal and BigInteger to serialise as String values rather than number values.Jsonb.Builder
serializeEmpty(boolean serializeEmpty)
Set to serialise empty collections or not.Jsonb.Builder
serializeNulls(boolean serializeNulls)
Set to serialise null values or not.
-
-
-
Method Detail
-
serializeNulls
Jsonb.Builder serializeNulls(boolean serializeNulls)
Set to serialise null values or not.Default is to not serialise nulls.
-
serializeEmpty
Jsonb.Builder serializeEmpty(boolean serializeEmpty)
Set to serialise empty collections or not.Default is to not serialise empty collections.
-
failOnUnknown
Jsonb.Builder failOnUnknown(boolean failOnUnknown)
Set failOnUnknown to true such that an exception is thrown when unknown properties are read in the json content.
-
mathTypesAsString
Jsonb.Builder mathTypesAsString(boolean mathTypesAsString)
Set to true for BigDecimal and BigInteger to serialise as String values rather than number values.
-
adapter
Jsonb.Builder adapter(JsonStreamAdapter streamAdapter)
Explicitly set the adapter to use.When not set the JsonStreamAdapter is service loaded using
AdapterFactory
with a fallback default of using the builtin implementation.- Parameters:
streamAdapter
- The underlying adapter to use when generating and parsing
-
add
<T> Jsonb.Builder add(Type type, JsonAdapter<T> jsonAdapter)
Add a JsonAdapter to use for the given type.
-
add
Jsonb.Builder add(Type type, Jsonb.AdapterBuilder builder)
Add a AdapterBuilder which provides a JsonAdapter to use for the given type.
-
add
Jsonb.Builder add(JsonbComponent component)
Add a Component which can provide multiple JsonAdapters and or configuration.
-
add
Jsonb.Builder add(JsonAdapter.Factory factory)
Add a JsonAdapter.Factory which provides JsonAdapters to use.
-
build
Jsonb build()
Build and return the Jsonb instance with all the given adapters and factories registered.
-
-