Package com.alibaba.fastjson2.reader
Class ObjectReaderAdapter<T>
java.lang.Object
com.alibaba.fastjson2.reader.ObjectReaderBean<T>
com.alibaba.fastjson2.reader.ObjectReaderAdapter<T>
- All Implemented Interfaces:
ObjectReader<T>
- Direct Known Subclasses:
ObjectReader1,ObjectReader10,ObjectReader11,ObjectReader12,ObjectReader2,ObjectReader3,ObjectReader4,ObjectReader5,ObjectReader6,ObjectReader7,ObjectReader8,ObjectReader9,ObjectReaderInterface,ObjectReaderNoneDefaultConstructor,ObjectReaderRootName
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FieldReader[]protected final Stringprotected final longFields inherited from class com.alibaba.fastjson2.reader.ObjectReaderBean
autoTypeBeforeHandler, buildFunction, creator, extraFieldReader, features, hasDefaultValue, objectClass, schema, serializable, typeName, typeNameHashFields inherited from interface com.alibaba.fastjson2.reader.ObjectReader
HASH_TYPE, VALUE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionObjectReaderAdapter(Class objectClass, String typeKey, String typeName, long features, JSONSchema schema, Supplier<T> creator, Function buildFunction, FieldReader... fieldReaders) ObjectReaderAdapter(Class objectClass, String typeKey, String typeName, long features, JSONSchema schema, Supplier<T> creator, Function buildFunction, Class[] seeAlso, String[] seeAlsoNames, FieldReader... fieldReaders) ObjectReaderAdapter(Class objectClass, String typeKey, String typeName, long features, JSONSchema schema, Supplier<T> creator, Function buildFunction, Class[] seeAlso, String[] seeAlsoNames, Class seeAlsoDefault, FieldReader... fieldReaders) ObjectReaderAdapter(Class objectClass, String typeKey, String typeName, long features, Supplier<T> creator, Function buildFunction, FieldReader... fieldReaders) ObjectReaderAdapter(Class objectClass, Supplier<T> creator, FieldReader... fieldReaders) -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(Consumer<FieldReader> fieldReaderConsumer) protected TautoType(JSONReader jsonReader) autoType(JSONReader.Context context, long typeHash) Resolves an ObjectReader for the specified type hash using the JSON reader context.autoType(JSONReader jsonReader, Class expectClass, long features) autoType(ObjectReaderProvider provider, long typeHash) Resolves an ObjectReader for the specified type hash using the ObjectReaderProvider.createInstance(long features) createInstance(Collection collection, long features) createInstance(Map map, long features) protected ObjectcreateInstance0(long features) final FunctionGets the build function used to construct the final object instance.final longGets the features enabled by this ObjectReader.intgetFieldOrdinal(long hashCode) getFieldReader(long hashCode) Gets the FieldReader for the specified field hash code.getFieldReaderLCase(long hashCode) Gets the FieldReader for the specified field hash code, using lowercase matching.protected final FieldReadergetFieldReaderUL(long hashCode, JSONReader jsonReader, long features) final StringGets the type key used for auto-type support.final longGets the hash code of the type key used for auto-type support.protected final booleanignoreError(FieldReader fieldReader) protected voidinitDefaultValue(T object) protected voidinitStringFieldAsEmpty(Object object) readArrayMappingJSONBObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) Reads an object from JSONB format with array mapping.protected voidreadArrayMappingJSONBObject0(JSONReader jsonReader, Object object, int entryCnt) readArrayMappingObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) Reads an object from JSON format with array mapping.protected final voidreadFieldValue(long hashCode, JSONReader jsonReader, long features, Object object) readFieldValue(long hashCode, JSONReader jsonReader, long features, Map<Long, Object> map) readJSONBObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) Reads an object from JSONB format.Methods inherited from class com.alibaba.fastjson2.reader.ObjectReaderBean
acceptExtra, checkAutoType, checkAutoType, checkAutoType0, getAutoTypeBeforeHandler, getObjectClass, processExtra, processExtra, processObjectInputSingleItemArray, readFieldValueWithLCase, readObject, readObject, setAutoTypeBeforeHandlerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alibaba.fastjson2.reader.ObjectReader
accept, acceptExtra, createInstance, createInstance, createInstance, createInstance, createInstanceNoneDefaultConstructor, getFieldReader, readObject, readObject, readObject, setFieldValue, setFieldValue, setFieldValue
-
Field Details
-
typeKey
-
typeKeyHashCode
protected final long typeKeyHashCode -
fieldReaders
-
-
Constructor Details
-
ObjectReaderAdapter
-
ObjectReaderAdapter
public ObjectReaderAdapter(Class objectClass, String typeKey, String typeName, long features, JSONSchema schema, Supplier<T> creator, Function buildFunction, FieldReader... fieldReaders) -
ObjectReaderAdapter
-
ObjectReaderAdapter
public ObjectReaderAdapter(Class objectClass, String typeKey, String typeName, long features, JSONSchema schema, Supplier<T> creator, Function buildFunction, Class[] seeAlso, String[] seeAlsoNames, FieldReader... fieldReaders) -
ObjectReaderAdapter
-
-
Method Details
-
getTypeKey
Description copied from interface:ObjectReaderGets the type key used for auto-type support. This key is used to identify the type information in JSON objects.- Returns:
- the type key string
-
getTypeKeyHash
public final long getTypeKeyHash()Description copied from interface:ObjectReaderGets the hash code of the type key used for auto-type support.- Returns:
- the hash code of the type key
-
getFeatures
public final long getFeatures()Description copied from interface:ObjectReaderGets the features enabled by this ObjectReader.- Returns:
- the enabled features as a bit mask
-
getFieldReaders
-
apply
-
autoType
-
getBuildFunction
Description copied from interface:ObjectReaderGets the build function used to construct the final object instance.- Returns:
- the build function, or null if not specified
-
readArrayMappingObject
public T readArrayMappingObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) Description copied from interface:ObjectReaderReads an object from JSON format with array mapping.- Parameters:
jsonReader- the JSONReader to use for parsingfieldType- the type of the field being readfieldName- the name of the field being readfeatures- the features to use- Returns:
- the deserialized object
-
readArrayMappingJSONBObject
public T readArrayMappingJSONBObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) Description copied from interface:ObjectReaderReads an object from JSONB format with array mapping.- Parameters:
jsonReader- the JSONReader to use for parsingfieldType- the type of the field being readfieldName- the name of the field being readfeatures- the features to use- Returns:
- the deserialized object
-
readArrayMappingJSONBObject0
-
createInstance0
-
initDefaultValue
- Overrides:
initDefaultValuein classObjectReaderBean<T>
-
createInstance
- Returns:
ObjectReader
-
createInstance
- Returns:
ObjectReader
-
ignoreError
-
getFieldReader
Description copied from interface:ObjectReaderGets the FieldReader for the specified field hash code.- Parameters:
hashCode- the hash code of the field name- Returns:
- the FieldReader for the field, or null if not found
-
getFieldOrdinal
public int getFieldOrdinal(long hashCode) -
getFieldReaderUL
-
readFieldValue
-
readFieldValue
protected final void readFieldValue(long hashCode, JSONReader jsonReader, long features, Object object) -
getFieldReaderLCase
Description copied from interface:ObjectReaderGets the FieldReader for the specified field hash code, using lowercase matching.- Parameters:
hashCode- the hash code of the field name (lowercase)- Returns:
- the FieldReader for the field, or null if not found
-
autoType
-
readJSONBObject
Description copied from interface:ObjectReaderReads an object from JSONB format.- Parameters:
jsonReader- the JSONReader to use for parsingfieldType- the type of the field being readfieldName- the name of the field being readfeatures- the features to use- Returns:
- the deserialized object
-
autoType
Description copied from interface:ObjectReaderResolves an ObjectReader for the specified type hash using the ObjectReaderProvider.- Parameters:
provider- the ObjectReaderProvidertypeHash- the hash code of the type name- Returns:
- the ObjectReader for the type, or null if not found
-
autoType
Description copied from interface:ObjectReaderResolves an ObjectReader for the specified type hash using the JSON reader context.- Parameters:
context- the JSON reader contexttypeHash- the hash code of the type name- Returns:
- the ObjectReader for the type, or null if not found
-
initStringFieldAsEmpty
- Overrides:
initStringFieldAsEmptyin classObjectReaderBean<T>
-
createInstance
- Returns:
ObjectReader
-