Package org.apache.johnzon.jsonb
Class JsonbAccessMode
- java.lang.Object
-
- org.apache.johnzon.jsonb.JsonbAccessMode
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,AccessMode
,Cleanable<Class<?>>
public class JsonbAccessMode extends Object implements AccessMode, Closeable, Cleanable<Class<?>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
JsonbAccessMode.ClassDecoratedType
private class
JsonbAccessMode.ParsingCacheEntry
private class
JsonbAccessMode.ReaderConverters
private class
JsonbAccessMode.WriterConverters
-
Nested classes/interfaces inherited from interface org.apache.johnzon.mapper.access.AccessMode
AccessMode.DecoratedType, AccessMode.Factory, AccessMode.Reader, AccessMode.Writer
-
-
Field Summary
Fields Modifier and Type Field Description private Supplier<jakarta.json.JsonBuilderFactory>
builderFactory
private boolean
caseSensitive
private Map<AdapterKey,Adapter<?,?>>
defaultConverters
private AccessMode
delegate
private JohnzonAdapterFactory
factory
private boolean
failOnMissingCreatorValues
private boolean
globalIsNillable
private jakarta.json.spi.JsonProvider
jsonProvider
private jakarta.json.bind.config.PropertyNamingStrategy
naming
private String
order
private Supplier<jakarta.json.stream.JsonParserFactory>
parserFactory
private ConcurrentMap<Class<?>,JsonbAccessMode.ParsingCacheEntry>
parsingCache
private BaseAccessMode
partialDelegate
private boolean
supportsPrivateAccess
private Collection<JohnzonAdapterFactory.Instance<?>>
toRelease
private Types
types
private jakarta.json.bind.config.PropertyVisibilityStrategy
visibility
-
Constructor Summary
Constructors Constructor Description JsonbAccessMode(jakarta.json.bind.config.PropertyNamingStrategy propertyNamingStrategy, String orderValue, jakarta.json.bind.config.PropertyVisibilityStrategy visibilityStrategy, boolean caseSensitive, Map<AdapterKey,Adapter<?,?>> defaultConverters, JohnzonAdapterFactory factory, jakarta.json.spi.JsonProvider jsonProvider, Supplier<jakarta.json.JsonBuilderFactory> builderFactory, Supplier<jakarta.json.stream.JsonParserFactory> parserFactory, AccessMode delegate, boolean failOnMissingCreatorValues, boolean globalIsNillable, boolean supportsPrivateAccess)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterParsed(Class<?> clazz)
Called once johnzon will not use AccessMode anymore.void
clean(Class<?> value)
void
close()
private AccessMode.Factory
constructorFactory(Constructor<?> finalConstructor, Consumer<Object[]> factoryValidator, Type[] types, String[] params, Adapter<?,?>[] converters, Adapter<?,?>[] itemConverters, ObjectConverter.Codec<?>[] objectConverters)
Comparator<String>
fieldComparator(Class<?> clazz)
Adapter<?,?>
findAdapter(Class<?> clazz)
Field
findAnyField(Class<?> clazz)
Method
findAnyGetter(Class<?> clazz)
Method
findAnySetter(Class<?> clazz)
AccessMode.Factory
findFactory(Class<?> clazz, Function<AnnotatedElement,String>... parameterNameExtractors)
private Type
findOptionalType(Type writerType)
private Stream<Method>
findPotentialFactoryMethods(Class<?> clazz)
ObjectConverter.Reader<?>
findReader(Class<?> clazz)
Map<String,AccessMode.Reader>
findReaders(Class<?> clazz)
private Optional<Constructor<?>>
findRecordConstructor(Class<?> clazz)
ObjectConverter.Writer<?>
findWriter(Class<?> clazz)
Map<String,AccessMode.Writer>
findWriters(Class<?> clazz)
private static <T extends Annotation>
TgetAnnotation(Parameter param, Class<T> api)
private JsonbAccessMode.ParsingCacheEntry
getClassEntry(Class<?> clazz)
private String
getJsonbProperty(AnnotatedElement a)
private Class<?>
getRawTargetType(Type type)
private boolean
hasRawType(Type type)
private boolean
isDateType(Type type)
private boolean
isNillable(jakarta.json.bind.annotation.JsonbProperty property, jakarta.json.bind.annotation.JsonbNillable propertyNillable, jakarta.json.bind.annotation.JsonbNillable classOrPackageNillable)
private boolean
isNotVisible(jakarta.json.bind.config.PropertyVisibilityStrategy visibility, AccessMode.DecoratedType t, Class<?> root, boolean read)
private boolean
isNumberType(Type type)
private boolean
isOptional(Type type)
private boolean
isOptionalArray(AccessMode.DecoratedType value)
private boolean
isReversedAdapter(Class<?> payloadType, Class<?> aClass, Adapter<?,?> instance)
private boolean
isTransient(AccessMode.DecoratedType t)
private boolean
isTransient(AccessMode.DecoratedType dt, jakarta.json.bind.config.PropertyVisibilityStrategy visibility, Class<?> root, boolean read)
private AccessMode.Factory
methodFactory(Class<?> clazz, Method finalFactory, Consumer<Object[]> factoryValidator, Type[] types, String[] params, Adapter<?,?>[] converters, Adapter<?,?>[] itemConverters, ObjectConverter.Codec<?>[] objectConverters)
private JohnzonAdapterFactory.Instance
newInstance(Class<?> value)
private Comparator<String>
orderComparator(Class<?> clazz)
private boolean
shouldSkip(jakarta.json.bind.config.PropertyVisibilityStrategy visibility, AccessMode.DecoratedType t, Class<?> root, boolean read)
private Adapter<?,?>
toConverter(Types types, Type type, jakarta.json.bind.annotation.JsonbTypeAdapter adapter, jakarta.json.bind.annotation.JsonbDateFormat dateFormat, jakarta.json.bind.annotation.JsonbNumberFormat numberFormat)
private Object
tryToCreateInstance(Class<?> declaringClass)
private void
validateAnnotations(Object parameter, jakarta.json.bind.annotation.JsonbTypeAdapter adapter, jakarta.json.bind.annotation.JsonbDateFormat dateFormat, jakarta.json.bind.annotation.JsonbNumberFormat numberFormat, JohnzonConverter johnzonConverter)
private void
validateAnnotationsOnTransientField(AccessMode.DecoratedType type)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.johnzon.mapper.access.AccessMode
findFactory, findMapAdder
-
-
-
-
Field Detail
-
naming
private final jakarta.json.bind.config.PropertyNamingStrategy naming
-
order
private final String order
-
visibility
private final jakarta.json.bind.config.PropertyVisibilityStrategy visibility
-
delegate
private final AccessMode delegate
-
caseSensitive
private final boolean caseSensitive
-
defaultConverters
private final Map<AdapterKey,Adapter<?,?>> defaultConverters
-
factory
private final JohnzonAdapterFactory factory
-
toRelease
private final Collection<JohnzonAdapterFactory.Instance<?>> toRelease
-
jsonProvider
private final jakarta.json.spi.JsonProvider jsonProvider
-
parserFactory
private final Supplier<jakarta.json.stream.JsonParserFactory> parserFactory
-
builderFactory
private final Supplier<jakarta.json.JsonBuilderFactory> builderFactory
-
parsingCache
private final ConcurrentMap<Class<?>,JsonbAccessMode.ParsingCacheEntry> parsingCache
-
partialDelegate
private final BaseAccessMode partialDelegate
-
failOnMissingCreatorValues
private boolean failOnMissingCreatorValues
-
types
private final Types types
-
globalIsNillable
private final boolean globalIsNillable
-
supportsPrivateAccess
private final boolean supportsPrivateAccess
-
-
Constructor Detail
-
JsonbAccessMode
public JsonbAccessMode(jakarta.json.bind.config.PropertyNamingStrategy propertyNamingStrategy, String orderValue, jakarta.json.bind.config.PropertyVisibilityStrategy visibilityStrategy, boolean caseSensitive, Map<AdapterKey,Adapter<?,?>> defaultConverters, JohnzonAdapterFactory factory, jakarta.json.spi.JsonProvider jsonProvider, Supplier<jakarta.json.JsonBuilderFactory> builderFactory, Supplier<jakarta.json.stream.JsonParserFactory> parserFactory, AccessMode delegate, boolean failOnMissingCreatorValues, boolean globalIsNillable, boolean supportsPrivateAccess)
-
-
Method Detail
-
fieldComparator
public Comparator<String> fieldComparator(Class<?> clazz)
- Specified by:
fieldComparator
in interfaceAccessMode
-
findFactory
public AccessMode.Factory findFactory(Class<?> clazz, Function<AnnotatedElement,String>... parameterNameExtractors)
- Specified by:
findFactory
in interfaceAccessMode
-
findRecordConstructor
private Optional<Constructor<?>> findRecordConstructor(Class<?> clazz)
-
getJsonbProperty
private String getJsonbProperty(AnnotatedElement a)
-
methodFactory
private AccessMode.Factory methodFactory(Class<?> clazz, Method finalFactory, Consumer<Object[]> factoryValidator, Type[] types, String[] params, Adapter<?,?>[] converters, Adapter<?,?>[] itemConverters, ObjectConverter.Codec<?>[] objectConverters)
-
constructorFactory
private AccessMode.Factory constructorFactory(Constructor<?> finalConstructor, Consumer<Object[]> factoryValidator, Type[] types, String[] params, Adapter<?,?>[] converters, Adapter<?,?>[] itemConverters, ObjectConverter.Codec<?>[] objectConverters)
-
validateAnnotations
private void validateAnnotations(Object parameter, jakarta.json.bind.annotation.JsonbTypeAdapter adapter, jakarta.json.bind.annotation.JsonbDateFormat dateFormat, jakarta.json.bind.annotation.JsonbNumberFormat numberFormat, JohnzonConverter johnzonConverter)
-
toConverter
private Adapter<?,?> toConverter(Types types, Type type, jakarta.json.bind.annotation.JsonbTypeAdapter adapter, jakarta.json.bind.annotation.JsonbDateFormat dateFormat, jakarta.json.bind.annotation.JsonbNumberFormat numberFormat)
-
newInstance
private JohnzonAdapterFactory.Instance newInstance(Class<?> value)
-
findReaders
public Map<String,AccessMode.Reader> findReaders(Class<?> clazz)
- Specified by:
findReaders
in interfaceAccessMode
-
validateAnnotationsOnTransientField
private void validateAnnotationsOnTransientField(AccessMode.DecoratedType type)
-
findWriters
public Map<String,AccessMode.Writer> findWriters(Class<?> clazz)
- Specified by:
findWriters
in interfaceAccessMode
-
findReader
public ObjectConverter.Reader<?> findReader(Class<?> clazz)
- Specified by:
findReader
in interfaceAccessMode
-
findWriter
public ObjectConverter.Writer<?> findWriter(Class<?> clazz)
- Specified by:
findWriter
in interfaceAccessMode
-
findAdapter
public Adapter<?,?> findAdapter(Class<?> clazz)
- Specified by:
findAdapter
in interfaceAccessMode
-
findAnyGetter
public Method findAnyGetter(Class<?> clazz)
- Specified by:
findAnyGetter
in interfaceAccessMode
-
findAnySetter
public Method findAnySetter(Class<?> clazz)
- Specified by:
findAnySetter
in interfaceAccessMode
-
findAnyField
public Field findAnyField(Class<?> clazz)
- Specified by:
findAnyField
in interfaceAccessMode
-
afterParsed
public void afterParsed(Class<?> clazz)
Description copied from interface:AccessMode
Called once johnzon will not use AccessMode anymore. Can be used to clean up any local cache.- Specified by:
afterParsed
in interfaceAccessMode
- Parameters:
clazz
- the parsed class.
-
isReversedAdapter
private boolean isReversedAdapter(Class<?> payloadType, Class<?> aClass, Adapter<?,?> instance)
-
isNillable
private boolean isNillable(jakarta.json.bind.annotation.JsonbProperty property, jakarta.json.bind.annotation.JsonbNillable propertyNillable, jakarta.json.bind.annotation.JsonbNillable classOrPackageNillable)
-
getClassEntry
private JsonbAccessMode.ParsingCacheEntry getClassEntry(Class<?> clazz)
-
isOptional
private boolean isOptional(Type type)
-
isOptionalArray
private boolean isOptionalArray(AccessMode.DecoratedType value)
-
isTransient
private boolean isTransient(AccessMode.DecoratedType dt, jakarta.json.bind.config.PropertyVisibilityStrategy visibility, Class<?> root, boolean read)
-
shouldSkip
private boolean shouldSkip(jakarta.json.bind.config.PropertyVisibilityStrategy visibility, AccessMode.DecoratedType t, Class<?> root, boolean read)
-
isTransient
private boolean isTransient(AccessMode.DecoratedType t)
-
isNotVisible
private boolean isNotVisible(jakarta.json.bind.config.PropertyVisibilityStrategy visibility, AccessMode.DecoratedType t, Class<?> root, boolean read)
-
orderComparator
private Comparator<String> orderComparator(Class<?> clazz)
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getAnnotation
private static <T extends Annotation> T getAnnotation(Parameter param, Class<T> api)
-
isDateType
private boolean isDateType(Type type)
-
isNumberType
private boolean isNumberType(Type type)
-
hasRawType
private boolean hasRawType(Type type)
-
-