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

public class ObjectReaderAdapter<T> extends ObjectReaderBean<T>
  • Field Details

    • typeKey

      protected final String typeKey
    • typeKeyHashCode

      protected final long typeKeyHashCode
    • fieldReaders

      protected final FieldReader[] fieldReaders
  • Constructor Details

  • Method Details

    • getTypeKey

      public final String getTypeKey()
      Description copied from interface: ObjectReader
      Gets 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: ObjectReader
      Gets 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: ObjectReader
      Gets the features enabled by this ObjectReader.
      Returns:
      the enabled features as a bit mask
    • getFieldReaders

      public FieldReader[] getFieldReaders()
    • apply

      public void apply(Consumer<FieldReader> fieldReaderConsumer)
    • autoType

      public Object autoType(JSONReader jsonReader, Class expectClass, long features)
    • getBuildFunction

      public final Function getBuildFunction()
      Description copied from interface: ObjectReader
      Gets 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: ObjectReader
      Reads an object from JSON format with array mapping.
      Parameters:
      jsonReader - the JSONReader to use for parsing
      fieldType - the type of the field being read
      fieldName - the name of the field being read
      features - the features to use
      Returns:
      the deserialized object
    • readArrayMappingJSONBObject

      public T readArrayMappingJSONBObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features)
      Description copied from interface: ObjectReader
      Reads an object from JSONB format with array mapping.
      Parameters:
      jsonReader - the JSONReader to use for parsing
      fieldType - the type of the field being read
      fieldName - the name of the field being read
      features - the features to use
      Returns:
      the deserialized object
    • readArrayMappingJSONBObject0

      protected void readArrayMappingJSONBObject0(JSONReader jsonReader, Object object, int entryCnt)
    • createInstance0

      protected Object createInstance0(long features)
    • initDefaultValue

      protected void initDefaultValue(T object)
      Overrides:
      initDefaultValue in class ObjectReaderBean<T>
    • createInstance

      public T createInstance(Collection collection, long features)
      Returns:
      ObjectReader
    • createInstance

      public T createInstance(long features)
      Returns:
      ObjectReader
    • ignoreError

      protected final boolean ignoreError(FieldReader fieldReader)
    • getFieldReader

      public FieldReader getFieldReader(long hashCode)
      Description copied from interface: ObjectReader
      Gets 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

      protected final FieldReader getFieldReaderUL(long hashCode, JSONReader jsonReader, long features)
    • readFieldValue

      protected final Map<Long,Object> readFieldValue(long hashCode, JSONReader jsonReader, long features, Map<Long,Object> map)
    • readFieldValue

      protected final void readFieldValue(long hashCode, JSONReader jsonReader, long features, Object object)
    • getFieldReaderLCase

      public FieldReader getFieldReaderLCase(long hashCode)
      Description copied from interface: ObjectReader
      Gets 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

      protected T autoType(JSONReader jsonReader)
    • readJSONBObject

      public T readJSONBObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features)
      Description copied from interface: ObjectReader
      Reads an object from JSONB format.
      Parameters:
      jsonReader - the JSONReader to use for parsing
      fieldType - the type of the field being read
      fieldName - the name of the field being read
      features - the features to use
      Returns:
      the deserialized object
    • autoType

      public ObjectReader autoType(ObjectReaderProvider provider, long typeHash)
      Description copied from interface: ObjectReader
      Resolves an ObjectReader for the specified type hash using the ObjectReaderProvider.
      Parameters:
      provider - the ObjectReaderProvider
      typeHash - the hash code of the type name
      Returns:
      the ObjectReader for the type, or null if not found
    • autoType

      public ObjectReader autoType(JSONReader.Context context, long typeHash)
      Description copied from interface: ObjectReader
      Resolves an ObjectReader for the specified type hash using the JSON reader context.
      Parameters:
      context - the JSON reader context
      typeHash - the hash code of the type name
      Returns:
      the ObjectReader for the type, or null if not found
    • initStringFieldAsEmpty

      protected void initStringFieldAsEmpty(Object object)
      Overrides:
      initStringFieldAsEmpty in class ObjectReaderBean<T>
    • createInstance

      public T createInstance(Map map, long features)
      Returns:
      ObjectReader