Package com.alibaba.fastjson2.reader
Class ObjectReaderCreator
java.lang.Object
com.alibaba.fastjson2.reader.ObjectReaderCreator
- Direct Known Subclasses:
ObjectReaderCreatorASM
ObjectReaderCreator is responsible for creating ObjectReader instances for
deserializing JSON data into Java objects. It provides factory methods for
creating ObjectReaders for various types of objects and fields.
This class supports various features including:
- Creation of ObjectReaders for different object types
- Creation of FieldReaders for different field types
- Lambda expression support for setter methods
- Custom field reader creation with various configurations
- JIT compilation support for improved performance
Example usage:
// Get default creator
ObjectReaderCreator creator = JSONFactory.getDefaultObjectReaderCreator();
// Create ObjectReader for a class
ObjectReader<User> reader = creator.createObjectReader(User.class);
// Create FieldReader for a field
Field field = User.class.getDeclaredField("name");
FieldReader<User> fieldReader = creator.createFieldReader("name", String.class, field);
- Since:
- 2.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectReaderCreatorstatic final booleanprotected final AtomicIntegerprotected Throwable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T,R> Function <T, R> createBuildFunction(Method builderMethod) Creates a Function that can build objects using the specified builder method.createByteArrayValueConsumerCreator(Class objectClass, FieldReader[] fieldReaderArray) createCharArrayValueConsumerCreator(Class objectClass, FieldReader[] fieldReaderArray) protected ObjectReadercreateEnumReader(Class objectClass, Method createMethod, ObjectReaderProvider provider) createFactoryFunction(Method factoryMethod, String... paramNames) Creates a Function that can instantiate objects using the specified factory method and parameter names.<T> FieldReadercreateFieldReader(Class<T> objectType, String fieldName, Type fieldType, Class fieldClass, Method method) Creates a FieldReader for the specified field with default configuration.<T> FieldReadercreateFieldReader(Class<T> objectType, String fieldName, String format, Type fieldType, Class fieldClass, Method method) Creates a FieldReader for the specified field with format configuration.<T> FieldReader<T> createFieldReader(Class objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Field field, ObjectReader initReader) <T> FieldReader<T> createFieldReader(Class objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Field field, ObjectReader initReader, String keyName, BiConsumer arrayToMapDuplicateHandler) <T> FieldReader<T> createFieldReader(Class objectClass, Type objectType, String fieldName, long features, String format, Type fieldType, Class fieldClass, Field field) <T,V> FieldReader createFieldReader(Class objectClass, Type objectType, String fieldName, Type fieldType, Class<V> fieldClass, int ordinal, long features, String format, Locale locale, Object defaultValue, JSONSchema schema, Method method, BiConsumer<T, V> function, ObjectReader initReader) protected voidcreateFieldReader(Class objectClass, Type objectType, String namingStrategy, String[] orders, BeanInfo beanInfo, FieldInfo fieldInfo, Method method, Map<String, List<FieldReader>> fieldReaders, ObjectReaderProvider provider) protected voidcreateFieldReader(Class objectClass, Type objectType, String namingStrategy, String[] orders, FieldInfo fieldInfo, Field field, Map<String, List<FieldReader>> fieldReaders, ObjectReaderProvider provider) <T> FieldReader<T> createFieldReader(String fieldName, Field field) <T> FieldReadercreateFieldReader(String fieldName, Method method) Creates a FieldReader for the specified method with minimal configuration.<T,V> FieldReader createFieldReader(String fieldName, Type fieldType, Class<V> fieldClass, long features, BiConsumer<T, V> function) <T,V> FieldReader createFieldReader(String fieldName, Type fieldType, Class<V> fieldClass, Method method, BiConsumer<T, V> function) <T> FieldReader<T> createFieldReader(String fieldName, Type fieldType, Field field) <T> FieldReader<T> createFieldReader(String fieldName, String format, Type fieldType, Field field) protected <T> FieldReadercreateFieldReaderLambda(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Method method, ObjectReader initReader) Creates a FieldReader using lambda expressions for improved performance.<T> FieldReadercreateFieldReaderMethod(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Method method, ObjectReader initReader) Creates a FieldReader for the specified method with comprehensive configuration.<T> FieldReadercreateFieldReaderMethod(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Method method, ObjectReader initReader, String keyName, BiConsumer arrayToMapDuplicateHandler) Creates a FieldReader for the specified method with comprehensive configuration including array-to-map options.<T> FieldReadercreateFieldReaderMethod(Class<T> objectType, String fieldName, String format, Type fieldType, Class fieldClass, Method method) Creates a FieldReader for the specified method with default configuration.<T> FieldReadercreateFieldReaderParam(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Type fieldType, Class fieldClass, String paramName, Class declaringClass, Parameter parameter, JSONSchema schema) Creates a FieldReader for the specified parameter with default configuration.<T> FieldReadercreateFieldReaderParam(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Type fieldType, Class fieldClass, String paramName, Class declaringClass, Parameter parameter, JSONSchema schema, ObjectReader initReader) Creates a FieldReader for the specified parameter with initialization reader.<T> FieldReadercreateFieldReaderParam(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, Type fieldType, Class fieldClass, String paramName, Class declaringClass, Parameter parameter, JSONSchema schema, ObjectReader initReader) Creates a FieldReader for the specified parameter with comprehensive configuration.createFieldReaders(ObjectReaderProvider provider, Class objectClass, Type objectType, Executable owner, Parameter[] parameters, String... paramNames) <T> FieldReader[]createFieldReaders(Class<T> objectClass) <T> FieldReader[]createFieldReaders(Class<T> objectClass, Type objectType) protected <T> FieldReader[]createFieldReaders(Class<T> objectClass, Type objectType, BeanInfo beanInfo, boolean fieldBased, ObjectReaderProvider provider) createFunction(Constructor constructor, Constructor markerConstructor, String... paramNames) Creates a Function that can instantiate objects using the specified constructor, marker constructor, and parameter names.createFunction(Constructor constructor, String... paramNames) Creates a Function that can instantiate objects using the specified constructor and parameter names.protected <T> IntFunction<T> createIntFunction(Constructor constructor) protected <T> IntFunction<T> createIntFunction(Method factoryMethod) protected <T> ObjectReaderNoneDefaultConstructorcreateNoneDefaultConstructorObjectReader(Class objectClass, BeanInfo beanInfo, Function<Map<Long, Object>, T> constructorFunction, List<Constructor> alternateConstructors, String[] parameterNames, FieldReader[] paramFieldReaders, FieldReader[] fieldReaderArray) <T> ObjectReader<T> createObjectReader(Class<T> objectType) <T> ObjectReader<T> createObjectReader(Class<T> objectType, boolean fieldBased) <T> ObjectReader<T> createObjectReader(Class<T> objectClass, long features, Supplier<T> defaultCreator, Function buildFunction, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with comprehensive configuration.<T> ObjectReader<T> createObjectReader(Class<T> objectClass, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with the given field readers.<T> ObjectReader<T> createObjectReader(Class<T> objectClass, Type objectType, boolean fieldBased, ObjectReaderProvider provider) <T> ObjectReader<T> createObjectReader(Class<T> objectClass, String typeKey, long features, JSONSchema schema, Supplier<T> defaultCreator, Function buildFunction, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with type key, features, schema, and comprehensive configuration.<T> ObjectReader<T> createObjectReader(Class<T> objectClass, String typeKey, String rootName, long features, JSONSchema schema, Supplier<T> defaultCreator, Function buildFunction, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with comprehensive configuration including root name.<T> ObjectReader<T> createObjectReader(Class<T> objectClass, Supplier<T> defaultCreator, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with a default creator and field readers.<T> ObjectReader<T> createObjectReader(Type objectType) <T> ObjectReader<T> createObjectReaderFactoryMethod(Method factoryMethod, String... paramNames) <T> ObjectReader<T> createObjectReaderNoneDefaultConstructor(Class objectClass, Function<Map<Long, Object>, T> creator, FieldReader... fieldReaders) <T> ObjectReader<T> createObjectReaderNoneDefaultConstructor(Constructor constructor, String... paramNames) <T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectType, Class[] seeAlso, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support.<T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectClass, String typeKey, Class[] seeAlso, String[] seeAlsoNames, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support and custom type key.<T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectClass, String typeKey, Class[] seeAlso, String[] seeAlsoNames, Class seeAlsoDefault, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support, custom type key, and default class.<T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectType, Supplier<T> defaultCreator, String typeKey, Class[] seeAlso, String[] seeAlsoNames, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support, custom creator, and type key.protected <T> ObjectReader<T> createObjectReaderWithBuilder(Class<T> objectClass, Type objectType, ObjectReaderProvider provider, BeanInfo beanInfo) protected <T> ObjectReader<T> createObjectReaderWithCreator(Class<T> objectClass, Type objectType, ObjectReaderProvider provider, BeanInfo beanInfo) createStringFunction(Constructor constructor) createStringFunction(Method factoryMethod) <T> Supplier<T> createSupplier(Class<T> objectClass) Creates a Supplier function for the specified object class that can create new instances.<T> Supplier<T> createSupplier(Constructor<T> constructor) Creates a Supplier function for the specified constructor that can create new instances.<T> Supplier<T> createSupplier(Constructor constructor, boolean jit) Creates a Supplier function for the specified constructor with JIT compilation option.protected <I,T> Function <I, T> createValueFunction(Constructor<T> constructor, Class<I> valueClass) protected <I,T> Function <I, T> createValueFunction(Method factoryMethod, Class valueClass) protected ObjectlambdaSetter(Class objectClass, Class fieldClass, Method method)
-
Field Details
-
JIT
public static final boolean JIT -
INSTANCE
-
jitErrorCount
-
jitErrorLast
-
methodTypeMapping
-
-
Constructor Details
-
ObjectReaderCreator
public ObjectReaderCreator()
-
-
Method Details
-
createObjectReaderNoneDefaultConstructor
public <T> ObjectReader<T> createObjectReaderNoneDefaultConstructor(Constructor constructor, String... paramNames) -
createObjectReaderNoneDefaultConstructor
public <T> ObjectReader<T> createObjectReaderNoneDefaultConstructor(Class objectClass, Function<Map<Long, Object>, T> creator, FieldReader... fieldReaders) -
createObjectReaderFactoryMethod
public <T> ObjectReader<T> createObjectReaderFactoryMethod(Method factoryMethod, String... paramNames) -
createFieldReaders
public FieldReader[] createFieldReaders(ObjectReaderProvider provider, Class objectClass, Type objectType, Executable owner, Parameter[] parameters, String... paramNames) -
createFactoryFunction
public <T> Function<Map<Long,Object>, createFactoryFunctionT> (Method factoryMethod, String... paramNames) Creates a Function that can instantiate objects using the specified factory method and parameter names.- Type Parameters:
T- the type of objects that the Function can create- Parameters:
factoryMethod- the factory method to use for creating instancesparamNames- the parameter names to use for the factory method- Returns:
- a Function that can create new instances of the specified type using the factory method
-
createFunction
public <T> Function<Map<Long,Object>, createFunctionT> (Constructor constructor, String... paramNames) Creates a Function that can instantiate objects using the specified constructor and parameter names.- Type Parameters:
T- the type of objects that the Function can create- Parameters:
constructor- the constructor to use for creating instancesparamNames- the parameter names to use for the constructor- Returns:
- a Function that can create new instances of the specified type
-
createFunction
public <T> Function<Map<Long,Object>, createFunctionT> (Constructor constructor, Constructor markerConstructor, String... paramNames) Creates a Function that can instantiate objects using the specified constructor, marker constructor, and parameter names.- Type Parameters:
T- the type of objects that the Function can create- Parameters:
constructor- the constructor to use for creating instancesmarkerConstructor- the marker constructor to useparamNames- the parameter names to use for the constructor- Returns:
- a Function that can create new instances of the specified type
-
createObjectReader
Creates an ObjectReader for the specified object type with the given field readers.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectClass- the class of objects to deserializefieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReader
public <T> ObjectReader<T> createObjectReader(Class<T> objectClass, Supplier<T> defaultCreator, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with a default creator and field readers.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectClass- the class of objects to deserializedefaultCreator- the supplier function to create new instances of the objectfieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReaderSeeAlso
public <T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectType, Class[] seeAlso, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectType- the class of objects to deserializeseeAlso- the see-also classesfieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReaderSeeAlso
public <T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectClass, String typeKey, Class[] seeAlso, String[] seeAlsoNames, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support and custom type key.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectClass- the class of objects to deserializetypeKey- the type key to useseeAlso- the see-also classesseeAlsoNames- the see-also class namesfieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReaderSeeAlso
public <T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectClass, String typeKey, Class[] seeAlso, String[] seeAlsoNames, Class seeAlsoDefault, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support, custom type key, and default class.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectClass- the class of objects to deserializetypeKey- the type key to useseeAlso- the see-also classesseeAlsoNames- the see-also class namesseeAlsoDefault- the default see-also classfieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
- Since:
- 2.0.24
-
createObjectReaderSeeAlso
public <T> ObjectReader<T> createObjectReaderSeeAlso(Class<T> objectType, Supplier<T> defaultCreator, String typeKey, Class[] seeAlso, String[] seeAlsoNames, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with see-also support, custom creator, and type key.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectType- the class of objects to deserializedefaultCreator- the supplier function to create new instances of the objecttypeKey- the type key to useseeAlso- the see-also classesseeAlsoNames- the see-also class namesfieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReaderWithBuilder
protected <T> ObjectReader<T> createObjectReaderWithBuilder(Class<T> objectClass, Type objectType, ObjectReaderProvider provider, BeanInfo beanInfo) -
createObjectReaderWithCreator
protected <T> ObjectReader<T> createObjectReaderWithCreator(Class<T> objectClass, Type objectType, ObjectReaderProvider provider, BeanInfo beanInfo) -
createObjectReader
public <T> ObjectReader<T> createObjectReader(Class<T> objectClass, long features, Supplier<T> defaultCreator, Function buildFunction, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with comprehensive configuration.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectClass- the class of objects to deserializefeatures- the features to use for deserializationdefaultCreator- the supplier function to create new instances of the objectbuildFunction- the build function to usefieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReader
public <T> ObjectReader<T> createObjectReader(Class<T> objectClass, String typeKey, long features, JSONSchema schema, Supplier<T> defaultCreator, Function buildFunction, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with type key, features, schema, and comprehensive configuration.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectClass- the class of objects to deserializetypeKey- the type key to usefeatures- the features to use for deserializationschema- the JSON schema to usedefaultCreator- the supplier function to create new instances of the objectbuildFunction- the build function to usefieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReader
public <T> ObjectReader<T> createObjectReader(Class<T> objectClass, String typeKey, String rootName, long features, JSONSchema schema, Supplier<T> defaultCreator, Function buildFunction, FieldReader... fieldReaders) Creates an ObjectReader for the specified object type with comprehensive configuration including root name.- Type Parameters:
T- the type of objects that the ObjectReader can deserialize- Parameters:
objectClass- the class of objects to deserializetypeKey- the type key to userootName- the root name to usefeatures- the features to use for deserializationschema- the JSON schema to usedefaultCreator- the supplier function to create new instances of the objectbuildFunction- the build function to usefieldReaders- the field readers to use for deserialization- Returns:
- an ObjectReader instance for the specified type
-
createObjectReader
-
createObjectReader
-
createObjectReader
-
createObjectReader
public <T> ObjectReader<T> createObjectReader(Class<T> objectClass, Type objectType, boolean fieldBased, ObjectReaderProvider provider) -
createNoneDefaultConstructorObjectReader
protected <T> ObjectReaderNoneDefaultConstructor createNoneDefaultConstructorObjectReader(Class objectClass, BeanInfo beanInfo, Function<Map<Long, Object>, T> constructorFunction, List<Constructor> alternateConstructors, String[] parameterNames, FieldReader[] paramFieldReaders, FieldReader[] fieldReaderArray) -
createFieldReaders
-
createFieldReaders
-
createFieldReader
-
createFieldReader
-
createFieldReaders
protected <T> FieldReader[] createFieldReaders(Class<T> objectClass, Type objectType, BeanInfo beanInfo, boolean fieldBased, ObjectReaderProvider provider) -
createSupplier
Creates a Supplier function for the specified object class that can create new instances.- Type Parameters:
T- the type of objects that the Supplier can create- Parameters:
objectClass- the class of objects to create- Returns:
- a Supplier function that can create new instances of the specified class, or null if creation is not possible
-
createSupplier
Creates a Supplier function for the specified constructor that can create new instances.- Type Parameters:
T- the type of objects that the Supplier can create- Parameters:
constructor- the constructor to use for creating instances- Returns:
- a Supplier function that can create new instances using the specified constructor
-
createSupplier
Creates a Supplier function for the specified constructor with JIT compilation option.- Type Parameters:
T- the type of objects that the Supplier can create- Parameters:
constructor- the constructor to use for creating instancesjit- whether to use JIT compilation for improved performance- Returns:
- a Supplier function that can create new instances using the specified constructor
-
createIntFunction
-
createIntFunction
-
createStringFunction
-
createStringFunction
-
createValueFunction
-
createValueFunction
-
createBuildFunction
Creates a Function that can build objects using the specified builder method.- Type Parameters:
T- the type of objects that the Function can buildR- the return type of the builder method- Parameters:
builderMethod- the builder method to use for building objects- Returns:
- a Function that can build objects using the specified builder method
-
createFieldReader
public <T> FieldReader createFieldReader(Class<T> objectType, String fieldName, Type fieldType, Class fieldClass, Method method) Creates a FieldReader for the specified field with default configuration.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectType- the class containing the fieldfieldName- the name of the fieldfieldType- the type of the fieldfieldClass- the class of the fieldmethod- the method to use for reading the field- Returns:
- a FieldReader instance for the specified field
-
createFieldReader
public <T> FieldReader createFieldReader(Class<T> objectType, String fieldName, String format, Type fieldType, Class fieldClass, Method method) Creates a FieldReader for the specified field with format configuration.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectType- the class containing the fieldfieldName- the name of the fieldformat- the date format to use for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldmethod- the method to use for reading the field- Returns:
- a FieldReader instance for the specified field
-
createFieldReaderMethod
public <T> FieldReader createFieldReaderMethod(Class<T> objectType, String fieldName, String format, Type fieldType, Class fieldClass, Method method) Creates a FieldReader for the specified method with default configuration.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectType- the class containing the fieldfieldName- the name of the fieldformat- the date format to use for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldmethod- the method to use for reading the field- Returns:
- a FieldReader instance for the specified field
-
createFieldReaderParam
public <T> FieldReader createFieldReaderParam(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Type fieldType, Class fieldClass, String paramName, Class declaringClass, Parameter parameter, JSONSchema schema) Creates a FieldReader for the specified parameter with default configuration.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectClass- the class containing the fieldobjectType- the type of the objectfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to use for the fieldformat- the date format to use for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldparamName- the name of the parameterdeclaringClass- the declaring class of the parameterparameter- the parameter to create a reader forschema- the JSON schema to use- Returns:
- a FieldReader instance for the specified parameter
-
createFieldReaderParam
public <T> FieldReader createFieldReaderParam(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Type fieldType, Class fieldClass, String paramName, Class declaringClass, Parameter parameter, JSONSchema schema, ObjectReader initReader) Creates a FieldReader for the specified parameter with initialization reader.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectClass- the class containing the fieldobjectType- the type of the objectfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to use for the fieldformat- the date format to use for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldparamName- the name of the parameterdeclaringClass- the declaring class of the parameterparameter- the parameter to create a reader forschema- the JSON schema to useinitReader- the initialization reader to use- Returns:
- a FieldReader instance for the specified parameter
-
createFieldReaderParam
public <T> FieldReader createFieldReaderParam(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, Type fieldType, Class fieldClass, String paramName, Class declaringClass, Parameter parameter, JSONSchema schema, ObjectReader initReader) Creates a FieldReader for the specified parameter with comprehensive configuration.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectClass- the class containing the fieldobjectType- the type of the objectfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to use for the fieldformat- the date format to use for the fieldlocale- the locale to use for the fielddefaultValue- the default value for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldparamName- the name of the parameterdeclaringClass- the declaring class of the parameterparameter- the parameter to create a reader forschema- the JSON schema to use for the fieldinitReader- the initialization reader to use- Returns:
- a FieldReader instance for the specified parameter
-
createFieldReaderMethod
public <T> FieldReader createFieldReaderMethod(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Method method, ObjectReader initReader) Creates a FieldReader for the specified method with comprehensive configuration.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectClass- the class containing the fieldobjectType- the type of the objectfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to use for the fieldformat- the date format to use for the fieldlocale- the locale to use for the fielddefaultValue- the default value for the fieldschema- the schema to use for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldmethod- the method to use for reading the fieldinitReader- the initialization reader to use- Returns:
- a FieldReader instance for the specified method
-
createFieldReaderMethod
public <T> FieldReader createFieldReaderMethod(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Method method, ObjectReader initReader, String keyName, BiConsumer arrayToMapDuplicateHandler) Creates a FieldReader for the specified method with comprehensive configuration including array-to-map options.- Type Parameters:
T- the type of objects that contain the field- Parameters:
objectClass- the class containing the fieldobjectType- the type of the objectfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to use for the fieldformat- the date format to use for the fieldlocale- the locale to use for the fielddefaultValue- the default value for the fieldschema- the schema to use for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldmethod- the method to use for reading the fieldinitReader- the initialization reader to usekeyName- the key name for array-to-map conversionarrayToMapDuplicateHandler- the duplicate handler for array-to-map conversion- Returns:
- a FieldReader instance for the specified method
-
createFieldReader
-
createFieldReader
-
createFieldReader
Creates a FieldReader for the specified method with minimal configuration.- Type Parameters:
T- the type of objects that the FieldReader can deserialize- Parameters:
fieldName- the name of the fieldmethod- the method to create a reader for- Returns:
- a FieldReader instance for the specified method
- Throws:
JSONException- if the method has an illegal number of parameters
-
createFieldReader
public <T> FieldReader<T> createFieldReader(String fieldName, String format, Type fieldType, Field field) -
createFieldReader
-
createFieldReader
-
createFieldReader
public <T> FieldReader<T> createFieldReader(Class objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Field field, ObjectReader initReader, String keyName, BiConsumer arrayToMapDuplicateHandler) -
createFieldReader
public <T,V> FieldReader createFieldReader(String fieldName, Type fieldType, Class<V> fieldClass, long features, BiConsumer<T, V> function) -
createFieldReader
public <T,V> FieldReader createFieldReader(String fieldName, Type fieldType, Class<V> fieldClass, Method method, BiConsumer<T, V> function) -
createFieldReader
public <T,V> FieldReader createFieldReader(Class objectClass, Type objectType, String fieldName, Type fieldType, Class<V> fieldClass, int ordinal, long features, String format, Locale locale, Object defaultValue, JSONSchema schema, Method method, BiConsumer<T, V> function, ObjectReader initReader) -
createEnumReader
protected ObjectReader createEnumReader(Class objectClass, Method createMethod, ObjectReaderProvider provider) -
createFieldReaderLambda
protected <T> FieldReader createFieldReaderLambda(Class<T> objectClass, Type objectType, String fieldName, int ordinal, long features, String format, Locale locale, Object defaultValue, String schema, Type fieldType, Class fieldClass, Method method, ObjectReader initReader) Creates a FieldReader using lambda expressions for improved performance.- Type Parameters:
T- the type of objects that the FieldReader can deserialize- Parameters:
objectClass- the class containing the fieldobjectType- the type of the objectfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to use for deserializationformat- the date format to use for the fieldlocale- the locale to use for the fielddefaultValue- the default value for the fieldschema- the JSON schema to use for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldmethod- the method to use for reading the fieldinitReader- the initialization reader to use- Returns:
- a FieldReader instance for the specified field
-
lambdaSetter
-
createByteArrayValueConsumerCreator
public Function<Consumer,ByteArrayValueConsumer> createByteArrayValueConsumerCreator(Class objectClass, FieldReader[] fieldReaderArray) -
createCharArrayValueConsumerCreator
public Function<Consumer,CharArrayValueConsumer> createCharArrayValueConsumerCreator(Class objectClass, FieldReader[] fieldReaderArray)
-