Package org.apache.johnzon.mapper
Class MapperBuilder
- java.lang.Object
-
- org.apache.johnzon.mapper.MapperBuilder
-
public class MapperBuilder extends Object
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description MapperBuilder()
-
Method Summary
-
-
-
Field Detail
-
readerFactory
private jakarta.json.JsonReaderFactory readerFactory
-
generatorFactory
private jakarta.json.stream.JsonGeneratorFactory generatorFactory
-
provider
private jakarta.json.spi.JsonProvider provider
-
builderFactory
private jakarta.json.JsonBuilderFactory builderFactory
-
supportHiddenAccess
private boolean supportHiddenAccess
-
maxSize
private int maxSize
-
bufferSize
private int bufferSize
-
bufferStrategy
private String bufferStrategy
-
autoAdjustStringBuffers
private boolean autoAdjustStringBuffers
-
attributeOrder
private Comparator<String> attributeOrder
-
supportConstructors
private boolean supportConstructors
-
useGetterForCollections
private boolean useGetterForCollections
-
accessModeName
private String accessModeName
-
pretty
private boolean pretty
-
closeables
private final Collection<Closeable> closeables
-
version
private int version
-
snippetMaxLength
private int snippetMaxLength
-
close
private boolean close
-
skipNull
private boolean skipNull
-
skipEmptyArray
private boolean skipEmptyArray
-
supportsComments
private boolean supportsComments
-
treatByteArrayAsBase64
private boolean treatByteArrayAsBase64
-
treatByteArrayAsBase64URL
private boolean treatByteArrayAsBase64URL
-
readAttributeBeforeWrite
private boolean readAttributeBeforeWrite
-
accessMode
private AccessMode accessMode
-
encoding
private Charset encoding
-
adapters
private LazyConverterMap adapters
-
objectConverterReaders
private Map<Class<?>,ObjectConverter.Reader<?>> objectConverterReaders
-
objectConverterWriters
private Map<Class<?>,ObjectConverter.Writer<?>> objectConverterWriters
-
fieldFilteringStrategy
private BaseAccessMode.FieldFilteringStrategy fieldFilteringStrategy
-
primitiveConverters
private boolean primitiveConverters
-
failOnUnknownProperties
private boolean failOnUnknownProperties
-
serializeValueFilter
private SerializeValueFilter serializeValueFilter
-
useBigDecimalForFloats
private boolean useBigDecimalForFloats
-
deduplicateObjects
private Boolean deduplicateObjects
-
useJsRange
private boolean useJsRange
-
useBigDecimalForObjectNumbers
private boolean useBigDecimalForObjectNumbers
-
maxBigDecimalScale
private int maxBigDecimalScale
-
supportEnumContainerDeserialization
private boolean supportEnumContainerDeserialization
-
enumConverterFactory
private Function<Class<?>,MapperConfig.CustomEnumConverter<?>> enumConverterFactory
-
skipAccessModeWrapper
private boolean skipAccessModeWrapper
-
mappingsFactory
private Function<MapperConfig,Mappings> mappingsFactory
-
discriminator
private String discriminator
-
-
Method Detail
-
build
public Mapper build()
-
setEnumConverterFactory
public void setEnumConverterFactory(Function<Class<?>,MapperConfig.CustomEnumConverter<?>> enumConverterFactory)
-
getAdapters
public ConcurrentHashMap<AdapterKey,Adapter<?,?>> getAdapters()
-
setSnippetMaxLength
public MapperBuilder setSnippetMaxLength(int snippetMaxLength)
-
setUseShortISO8601Format
public MapperBuilder setUseShortISO8601Format(boolean useShortISO8601Format)
-
setAdaptersDateTimeFormatter
public MapperBuilder setAdaptersDateTimeFormatter(DateTimeFormatter dateTimeFormatter)
-
setUseBigIntegerStringAdapter
public MapperBuilder setUseBigIntegerStringAdapter(boolean convertBigIntegerToString)
-
setUseBigDecimalStringAdapter
public MapperBuilder setUseBigDecimalStringAdapter(boolean convertBigDecimalToString)
-
setAdaptersDateTimeFormatterString
public MapperBuilder setAdaptersDateTimeFormatterString(String dateTimeFormatter)
-
setInterfaceImplementationMapping
public MapperBuilder setInterfaceImplementationMapping(Map<Class<?>,Class<?>> interfaceImplementationMapping)
-
setFailOnUnknownProperties
public MapperBuilder setFailOnUnknownProperties(boolean failOnUnknownProperties)
-
addCloseable
public MapperBuilder addCloseable(Closeable closeable)
-
setIgnoreFieldsForType
public MapperBuilder setIgnoreFieldsForType(Class<?> type, String... fields)
-
setSupportGetterForCollections
public MapperBuilder setSupportGetterForCollections(boolean useGetterForCollections)
-
setSupportsComments
public MapperBuilder setSupportsComments(boolean supportsComments)
-
setPretty
public MapperBuilder setPretty(boolean pretty)
-
setBufferSize
public MapperBuilder setBufferSize(int bufferSize)
-
setBufferStrategy
public MapperBuilder setBufferStrategy(String bufferStrategy)
-
setMaxSize
public MapperBuilder setMaxSize(int size)
-
setAccessMode
public MapperBuilder setAccessMode(AccessMode mode)
-
setAccessModeName
public MapperBuilder setAccessModeName(String mode)
-
setAccessModeFieldFilteringStrategy
public MapperBuilder setAccessModeFieldFilteringStrategy(BaseAccessMode.FieldFilteringStrategy strategy)
-
setAccessModeFieldFilteringStrategyName
public MapperBuilder setAccessModeFieldFilteringStrategyName(String mode)
-
setSupportHiddenAccess
public MapperBuilder setSupportHiddenAccess(boolean supportHiddenAccess)
-
setAttributeOrder
public MapperBuilder setAttributeOrder(Comparator<String> attributeOrder)
-
setReaderFactory
public MapperBuilder setReaderFactory(jakarta.json.JsonReaderFactory readerFactory)
-
setGeneratorFactory
public MapperBuilder setGeneratorFactory(jakarta.json.stream.JsonGeneratorFactory generatorFactory)
-
setProvider
public MapperBuilder setProvider(jakarta.json.spi.JsonProvider provider)
-
setBuilderFactory
public MapperBuilder setBuilderFactory(jakarta.json.JsonBuilderFactory builderFactory)
-
setDoCloseOnStreams
public MapperBuilder setDoCloseOnStreams(boolean doCloseOnStreams)
-
addPropertyEditor
@Deprecated public MapperBuilder addPropertyEditor(Class<?> clazz, Converter<?> converter)
Deprecated.
-
addConverter
@Deprecated public MapperBuilder addConverter(Type clazz, Converter<?> converter)
Deprecated.
-
addAdapter
public MapperBuilder addAdapter(Type from, Type to, Adapter<?,?> adapter)
-
addAdapter
public MapperBuilder addAdapter(Adapter<?,?> converter)
-
setVersion
public MapperBuilder setVersion(int version)
-
setSkipNull
public MapperBuilder setSkipNull(boolean skipNull)
-
setSkipEmptyArray
public MapperBuilder setSkipEmptyArray(boolean skipEmptyArray)
-
setTreatByteArrayAsBase64
public MapperBuilder setTreatByteArrayAsBase64(boolean treatByteArrayAsBase64)
-
setTreatByteArrayAsBase64URL
public MapperBuilder setTreatByteArrayAsBase64URL(boolean treatByteArrayAsBase64URL)
-
setSupportConstructors
public MapperBuilder setSupportConstructors(boolean supportConstructors)
-
setEncoding
public MapperBuilder setEncoding(String encoding)
-
setReadAttributeBeforeWrite
public MapperBuilder setReadAttributeBeforeWrite(boolean readAttributeBeforeWrite)
-
addObjectConverter
public <T> MapperBuilder addObjectConverter(Class<T> targetType, MapperConverter objectConverter)
-
setPrimitiveConverters
public MapperBuilder setPrimitiveConverters(boolean val)
-
setSerializeValueFilter
public MapperBuilder setSerializeValueFilter(SerializeValueFilter serializeValueFilter)
-
setUseBigDecimalForFloats
public MapperBuilder setUseBigDecimalForFloats(boolean useBigDecimalForFloats)
-
setAutoAdjustStringBuffers
public MapperBuilder setAutoAdjustStringBuffers(boolean autoAdjustStringBuffers)
-
setDeduplicateObjects
public MapperBuilder setDeduplicateObjects(Boolean deduplicateObjects)
If any non-primitive Java Object gets serialised more than just one time, then we write a JsonPointer to the first occurrence instead. This will effectively also avoid endless loops in data with cycles! An example: Assume you have a Person with a name 'Sarah' and her daughter, a Person with the name 'Clemens' both stored in a JSON array. Given the Java Code:Person sarah = new Person("Sarah"); Person clemens = new Person("Clemens"); clemens.setMother(sarah); Person[] family = new Person[]{sarah, clemens};
Transformed to JSON this will now look like the following:[{"name":"Sarah"},{"name":"Clemens","mother":"/0"}]
That means instead of serialising 'mother' as full object we will now only store a JsonPointer to the Person 'Sarah'. When deserialised back Johnzon will automatically de-reference the JsonPointer back to the correct instance. Possible values:true
: deduplicate objectsfalse
: do not deduplicate objectsnull
: dedupliate based on theJohnzonDeduplicateObjects
annotation. This is the default
-
setUseJsRange
public MapperBuilder setUseJsRange(boolean value)
-
setUseBigDecimalForObjectNumbers
public MapperBuilder setUseBigDecimalForObjectNumbers(boolean value)
-
setMaxBigDecimalScale
public MapperBuilder setMaxBigDecimalScale(int maxBigDecimalScale)
-
setSupportEnumContainerDeserialization
public MapperBuilder setSupportEnumContainerDeserialization(boolean supportEnumContainerDeserialization)
-
setPolymorphicSerializationPredicate
public MapperBuilder setPolymorphicSerializationPredicate(Predicate<Class<?>> serializationPredicate)
-
setPolymorphicDeserializationPredicate
public MapperBuilder setPolymorphicDeserializationPredicate(Predicate<Class<?>> deserializationPredicate)
-
setPolymorphicDiscriminatorMapper
public MapperBuilder setPolymorphicDiscriminatorMapper(Function<Class<?>,String> discriminatorMapper)
-
setPolymorphicTypeLoader
public MapperBuilder setPolymorphicTypeLoader(Function<String,Class<?>> typeLoader)
-
setPolymorphicDiscriminator
public MapperBuilder setPolymorphicDiscriminator(String value)
-
setSkipAccessModeWrapper
public MapperBuilder setSkipAccessModeWrapper(boolean skipAccessModeWrapper)
-
setMappingsFactory
public MapperBuilder setMappingsFactory(Function<MapperConfig,Mappings> mappingsFactory)
-
-