Package com.alibaba.fastjson2.writer
Class ObjectWriterCreator
java.lang.Object
com.alibaba.fastjson2.writer.ObjectWriterCreator
- Direct Known Subclasses:
ObjectWriterCreatorASM
ObjectWriterCreator is responsible for creating ObjectWriter instances for
serializing Java objects into JSON format. It provides factory methods for
creating ObjectWriters for various types of objects and fields.
This class supports various features including:
- Creation of ObjectWriters for different object types
- Creation of FieldWriters for different field types
- Lambda expression support for getter methods
- Custom field writer creation with various configurations
- JIT compilation support for improved performance
Example usage:
// Get default creator
ObjectWriterCreator creator = JSONFactory.getDefaultObjectWriterCreator();
// Create ObjectWriter for a class
ObjectWriter<User> writer = creator.createObjectWriter(User.class);
// Create FieldWriter for a field
Field field = User.class.getDeclaredField("name");
FieldWriter<User> fieldWriter = creator.createFieldWriter("name", null, field);
- Since:
- 2.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectWriterCreatorprotected final AtomicIntegerprotected Throwable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidconfigSerializeFilters(BeanInfo beanInfo, ObjectWriterAdapter writerAdapter) Configures serialize filters for the specified ObjectWriterAdapter.<T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectType, String fieldName, int ordinal, long features, String format, String label, Method method, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified method with comprehensive configuration.<T,V> FieldWriter <T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, String label, Type fieldType, Class<V> fieldClass, Field field, Method method, Function<T, V> function) Creates a FieldWriter for the specified function with provider, object class, field, method, and comprehensive configuration.<T,V> FieldWriter <T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, String label, Type fieldType, Class<V> fieldClass, Method method, Function<T, V> function) Creates a FieldWriter for the specified function with provider, object class, and comprehensive configuration.<T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectType, String fieldName, int ordinal, long features, String format, Locale locale, String label, Method method, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified method with locale and comprehensive configuration.<T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectType, String fieldName, int ordinal, long features, String format, Locale locale, String label, Method method, ObjectWriter initObjectWriter, Class<?> contentAs) Creates a FieldWriter for the specified method with contentAs and comprehensive configuration.<T,V> FieldWriter <T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, Locale locale, String label, Type fieldType, Class<V> fieldClass, Field field, Method method, Function<T, V> function) Creates a FieldWriter for the specified function with provider, object class, locale, and comprehensive configuration.<T,V> FieldWriter <T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, Locale locale, String label, Type fieldType, Class<V> fieldClass, Field field, Method method, Function<T, V> function, Class<?> contentAs) Creates a FieldWriter for the specified function with provider, object class, contentAs, and comprehensive configuration.final <T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, String fieldName, int ordinal, long features, String format, String label, Field field, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified field with provider and comprehensive configuration.<T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, String fieldName, int ordinal, long features, String format, Locale locale, String label, Field field, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified field with locale and comprehensive configuration.<T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, String fieldName, int ordinal, long features, String format, Locale locale, String label, Field field, ObjectWriter initObjectWriter, Class<?> contentAs) Creates a FieldWriter for the specified field with contentAs and comprehensive configuration.<T> FieldWriter<T> createFieldWriter(Class<T> objectType, String fieldName, int ordinal, long features, String format, Method method) <T> FieldWriter<T> createFieldWriter(Class<T> objectType, String fieldName, String dateFormat, Method method) Creates a FieldWriter for the specified method with default configuration.protected FieldWritercreateFieldWriter(Class objectClass, long writerFeatures, ObjectWriterProvider provider, BeanInfo beanInfo, FieldInfo fieldInfo, Field field) Creates a FieldWriter for the specified field.<T> FieldWriter<T> createFieldWriter(String fieldName, int ordinal, long features, String format, Field field) Creates a FieldWriter for the specified field with ordinal and features.<T> FieldWriter<T> createFieldWriter(String fieldName, int ordinal, long features, String format, String label, Field field, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified field with comprehensive configuration.<T,V> FieldWriter createFieldWriter(String fieldName, long features, String format, Class fieldClass, Function<T, V> function) Creates a FieldWriter for the specified function with features and format.<T> FieldWritercreateFieldWriter(String fieldName, ToByteFunction<T> function) Creates a FieldWriter for the specified function that returns a byte value.<T> FieldWritercreateFieldWriter(String fieldName, ToCharFunction<T> function) Creates a FieldWriter for the specified function that returns a char value.<T> FieldWritercreateFieldWriter(String fieldName, ToFloatFunction<T> function) Creates a FieldWriter for the specified function that returns a float value.<T> FieldWritercreateFieldWriter(String fieldName, ToShortFunction<T> function) Creates a FieldWriter for the specified function that returns a short value.<T,V> FieldWriter createFieldWriter(String fieldName, Class fieldClass, Field field, Method method, Function<T, V> function) Creates a FieldWriter for the specified field, method, and function.<T,V> FieldWriter createFieldWriter(String fieldName, Class fieldClass, Function<T, V> function) Creates a FieldWriter for the specified function with default configuration.<T> FieldWritercreateFieldWriter(String fieldName, Field field, Method method, ToIntFunction<T> function) Creates a FieldWriter for the specified field, method, and function that returns an int value.<T,V> FieldWriter createFieldWriter(String fieldName, Type fieldType, Class fieldClass, Function<T, V> function) Creates a FieldWriter for the specified function with field type and class.<T> FieldWriter<T> createFieldWriter(String fieldName, String format, Field field) Creates a FieldWriter for the specified field with default configuration.<T> FieldWritercreateFieldWriter(String fieldName, Predicate<T> function) Creates a FieldWriter for the specified predicate function that returns a boolean value.<T> FieldWritercreateFieldWriter(String fieldName, ToDoubleFunction<T> function) Creates a FieldWriter for the specified function that returns a double value.<T> FieldWritercreateFieldWriter(String fieldName, ToIntFunction<T> function) Creates a FieldWriter for the specified function that returns an int value.<T> FieldWritercreateFieldWriter(String fieldName, ToLongFunction<T> function) Creates a FieldWriter for the specified function that returns a long value.createObjectWriter(FieldWriter... fieldWriters) Creates an ObjectWriter for the specified array of FieldWriters.createObjectWriter(Class objectType) Creates an ObjectWriter for the specified object type.createObjectWriter(Class objectClass, long features, FieldWriter... fieldWriters) Creates an ObjectWriter for the specified object class, features, and field writers.createObjectWriter(Class objectClass, long features, ObjectWriterProvider provider) Creates an ObjectWriter for the specified object class, features, and provider.createObjectWriter(Class objectClass, long features, List<ObjectWriterModule> modules) Creates an ObjectWriter for the specified object class, features, and modules.createObjectWriter(Class objectType, FieldWriter... fieldWriters) Creates an ObjectWriter for the specified object type and field writers.<T> ObjectWriter<T> createObjectWriter(String[] names, Type[] types, FieldSupplier<T> supplier) Creates an ObjectWriter for the specified object type with names, types, and supplier.createObjectWriter(List<FieldWriter> fieldWriters) Creates an ObjectWriter for the specified list of FieldWriters.protected static StringgetFieldName(Class objectClass, ObjectWriterProvider provider, BeanInfo beanInfo, boolean record, FieldInfo fieldInfo, Method method) Gets the field name for the specified method based on various naming strategies and configurations.protected ObjectWritergetInitWriter(ObjectWriterProvider provider, Class fieldClass) protected voidhandleIgnores(BeanInfo beanInfo, List<FieldWriter> fieldWriters) Handles field ignores based on the BeanInfo configuration.protected voidsetDefaultValue(List<FieldWriter> fieldWriters, Class objectClass) Sets default values for the specified field writers using the default constructor of the object class.
-
Field Details
-
INSTANCE
-
jitErrorCount
-
jitErrorLast
-
-
Constructor Details
-
ObjectWriterCreator
public ObjectWriterCreator()Constructs a new ObjectWriterCreator instance.
-
-
Method Details
-
createObjectWriter
Creates an ObjectWriter for the specified list of FieldWriters.- Parameters:
fieldWriters- the list of FieldWriters to use- Returns:
- an ObjectWriter instance
-
createObjectWriter
Creates an ObjectWriter for the specified array of FieldWriters.- Parameters:
fieldWriters- the array of FieldWriters to use- Returns:
- an ObjectWriter instance
-
createObjectWriter
public <T> ObjectWriter<T> createObjectWriter(String[] names, Type[] types, FieldSupplier<T> supplier) Creates an ObjectWriter for the specified object type with names, types, and supplier.- Type Parameters:
T- the type of objects that the ObjectWriter can serialize- Parameters:
names- the field namestypes- the field typessupplier- the FieldSupplier to use- Returns:
- an ObjectWriter instance
-
createObjectWriter
Creates an ObjectWriter for the specified object type.- Parameters:
objectType- the class of objects to serialize- Returns:
- an ObjectWriter instance
-
createObjectWriter
Creates an ObjectWriter for the specified object type and field writers.- Parameters:
objectType- the class of objects to serializefieldWriters- the field writers to use- Returns:
- an ObjectWriter instance
-
createObjectWriter
public ObjectWriter createObjectWriter(Class objectClass, long features, FieldWriter... fieldWriters) Creates an ObjectWriter for the specified object class, features, and field writers.- Parameters:
objectClass- the class of objects to serializefeatures- the features to usefieldWriters- the field writers to use- Returns:
- an ObjectWriter instance
-
createFieldWriter
protected FieldWriter createFieldWriter(Class objectClass, long writerFeatures, ObjectWriterProvider provider, BeanInfo beanInfo, FieldInfo fieldInfo, Field field) Creates a FieldWriter for the specified field.- Parameters:
objectClass- the class containing the fieldwriterFeatures- the writer features to useprovider- the ObjectWriterProvider to usebeanInfo- the BeanInfo to usefieldInfo- the FieldInfo to usefield- the Field to create a writer for- Returns:
- a FieldWriter instance, or null if the field should be ignored
-
createObjectWriter
public ObjectWriter createObjectWriter(Class objectClass, long features, List<ObjectWriterModule> modules) Creates an ObjectWriter for the specified object class, features, and modules.- Parameters:
objectClass- the class of objects to serializefeatures- the features to usemodules- the ObjectWriterModules to use- Returns:
- an ObjectWriter instance
-
setDefaultValue
Sets default values for the specified field writers using the default constructor of the object class.- Parameters:
fieldWriters- the list of FieldWriters to set default values forobjectClass- the class of objects to create default instances from
-
createObjectWriter
public ObjectWriter createObjectWriter(Class objectClass, long features, ObjectWriterProvider provider) Creates an ObjectWriter for the specified object class, features, and provider. This is the main method for creating ObjectWriters that handles all the complexity of analyzing the class structure and creating appropriate FieldWriters.- Parameters:
objectClass- the class of objects to serializefeatures- the features to useprovider- the ObjectWriterProvider to use- Returns:
- an ObjectWriter instance
-
getFieldName
protected static String getFieldName(Class objectClass, ObjectWriterProvider provider, BeanInfo beanInfo, boolean record, FieldInfo fieldInfo, Method method) Gets the field name for the specified method based on various naming strategies and configurations.- Parameters:
objectClass- the class containing the methodprovider- the ObjectWriterProvider to usebeanInfo- the BeanInfo containing configurationrecord- whether the class is a recordfieldInfo- the FieldInfo containing field configurationmethod- the method to get the field name for- Returns:
- the field name
-
configSerializeFilters
Configures serialize filters for the specified ObjectWriterAdapter.- Parameters:
beanInfo- the BeanInfo containing filter configurationwriterAdapter- the ObjectWriterAdapter to configure filters for
-
handleIgnores
Handles field ignores based on the BeanInfo configuration.- Parameters:
beanInfo- the BeanInfo containing ignore configurationfieldWriters- the list of FieldWriters to process
-
createFieldWriter
Creates a FieldWriter for the specified field with default configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldformat- the date format to usefield- the Field to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(String fieldName, int ordinal, long features, String format, Field field) Creates a FieldWriter for the specified field with ordinal and features.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to usefield- the Field to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(String fieldName, int ordinal, long features, String format, String label, Field field, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified field with comprehensive configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselabel- the label for the fieldfield- the Field to create a writer forinitObjectWriter- the initial ObjectWriter to use- Returns:
- a FieldWriter instance
-
createFieldWriter
public final <T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, String fieldName, int ordinal, long features, String format, String label, Field field, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified field with provider and comprehensive configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
provider- the ObjectWriterProvider to usefieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselabel- the label for the fieldfield- the Field to create a writer forinitObjectWriter- the initial ObjectWriter to use- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, String fieldName, int ordinal, long features, String format, Locale locale, String label, Field field, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified field with locale and comprehensive configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
provider- the ObjectWriterProvider to usefieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselocale- the locale to uselabel- the label for the fieldfield- the Field to create a writer forinitObjectWriter- the initial ObjectWriter to use- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, String fieldName, int ordinal, long features, String format, Locale locale, String label, Field field, ObjectWriter initObjectWriter, Class<?> contentAs) Creates a FieldWriter for the specified field with contentAs and comprehensive configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
provider- the ObjectWriterProvider to usefieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselocale- the locale to uselabel- the label for the fieldfield- the Field to create a writer forinitObjectWriter- the initial ObjectWriter to usecontentAs- the contentAs class- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(Class<T> objectType, String fieldName, String dateFormat, Method method) Creates a FieldWriter for the specified method with default configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
objectType- the class containing the methodfieldName- the name of the fielddateFormat- the date format to usemethod- the Method to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(Class<T> objectType, String fieldName, int ordinal, long features, String format, Method method) -
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectType, String fieldName, int ordinal, long features, String format, String label, Method method, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified method with comprehensive configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
provider- the ObjectWriterProvider to useobjectType- the class containing the methodfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselabel- the label for the fieldmethod- the Method to create a writer forinitObjectWriter- the initial ObjectWriter to use- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectType, String fieldName, int ordinal, long features, String format, Locale locale, String label, Method method, ObjectWriter initObjectWriter) Creates a FieldWriter for the specified method with locale and comprehensive configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
provider- the ObjectWriterProvider to useobjectType- the class containing the methodfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselocale- the locale to uselabel- the label for the fieldmethod- the Method to create a writer forinitObjectWriter- the initial ObjectWriter to use- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectType, String fieldName, int ordinal, long features, String format, Locale locale, String label, Method method, ObjectWriter initObjectWriter, Class<?> contentAs) Creates a FieldWriter for the specified method with contentAs and comprehensive configuration.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
provider- the ObjectWriterProvider to useobjectType- the class containing the methodfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselocale- the locale to uselabel- the label for the fieldmethod- the Method to create a writer forinitObjectWriter- the initial ObjectWriter to usecontentAs- the contentAs class- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified function that returns a long value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the ToLongFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified function that returns an int value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the ToIntFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T> FieldWriter createFieldWriter(String fieldName, Field field, Method method, ToIntFunction<T> function) Creates a FieldWriter for the specified field, method, and function that returns an int value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfield- the Field to create a writer formethod- the Method to create a writer forfunction- the ToIntFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified function that returns a short value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the ToShortFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified function that returns a byte value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the ToByteFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified function that returns a float value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the ToFloatFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified function that returns a double value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the ToDoubleFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified function that returns a char value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the ToCharFunction to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
Creates a FieldWriter for the specified predicate function that returns a boolean value.- Type Parameters:
T- the type of objects that the FieldWriter can serialize- Parameters:
fieldName- the name of the fieldfunction- the Predicate to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter createFieldWriter(String fieldName, Class fieldClass, Function<T, V> function) Creates a FieldWriter for the specified function with default configuration.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
fieldName- the name of the fieldfieldClass- the class of the fieldfunction- the Function to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter createFieldWriter(String fieldName, Class fieldClass, Field field, Method method, Function<T, V> function) Creates a FieldWriter for the specified field, method, and function.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
fieldName- the name of the fieldfieldClass- the class of the fieldfield- the Field to create a writer formethod- the Method to create a writer forfunction- the Function to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter createFieldWriter(String fieldName, Type fieldType, Class fieldClass, Function<T, V> function) Creates a FieldWriter for the specified function with field type and class.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
fieldName- the name of the fieldfieldType- the type of the fieldfieldClass- the class of the fieldfunction- the Function to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter createFieldWriter(String fieldName, long features, String format, Class fieldClass, Function<T, V> function) Creates a FieldWriter for the specified function with features and format.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
fieldName- the name of the fieldfeatures- the features to useformat- the date format to usefieldClass- the class of the fieldfunction- the Function to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, String label, Type fieldType, Class<V> fieldClass, Method method, Function<T, V> function) Creates a FieldWriter for the specified function with provider, object class, and comprehensive configuration.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
provider- the ObjectWriterProvider to useobjectClass- the class containing the fieldfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselabel- the label for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldmethod- the Method to create a writer forfunction- the Function to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, String label, Type fieldType, Class<V> fieldClass, Field field, Method method, Function<T, V> function) Creates a FieldWriter for the specified function with provider, object class, field, method, and comprehensive configuration.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
provider- the ObjectWriterProvider to useobjectClass- the class containing the fieldfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselabel- the label for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldfield- the Field to create a writer formethod- the Method to create a writer forfunction- the Function to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, Locale locale, String label, Type fieldType, Class<V> fieldClass, Field field, Method method, Function<T, V> function) Creates a FieldWriter for the specified function with provider, object class, locale, and comprehensive configuration.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
provider- the ObjectWriterProvider to useobjectClass- the class containing the fieldfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselocale- the locale to uselabel- the label for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldfield- the Field to create a writer formethod- the Method to create a writer forfunction- the Function to create a writer for- Returns:
- a FieldWriter instance
-
createFieldWriter
public <T,V> FieldWriter<T> createFieldWriter(ObjectWriterProvider provider, Class<T> objectClass, String fieldName, int ordinal, long features, String format, Locale locale, String label, Type fieldType, Class<V> fieldClass, Field field, Method method, Function<T, V> function, Class<?> contentAs) Creates a FieldWriter for the specified function with provider, object class, contentAs, and comprehensive configuration.- Type Parameters:
T- the type of objects that owns the fieldV- the type of field values- Parameters:
provider- the ObjectWriterProvider to useobjectClass- the class containing the fieldfieldName- the name of the fieldordinal- the ordinal position of the fieldfeatures- the features to useformat- the date format to uselocale- the locale to uselabel- the label for the fieldfieldType- the type of the fieldfieldClass- the class of the fieldfield- the Field to create a writer formethod- the Method to create a writer forfunction- the Function to create a writer forcontentAs- the contentAs class- Returns:
- a FieldWriter instance
-
getInitWriter
-