Package com.alibaba.fastjson2.writer
Class ObjectWriterAdapter<T>
- java.lang.Object
-
- com.alibaba.fastjson2.writer.ObjectWriterAdapter<T>
-
- All Implemented Interfaces:
ObjectWriter<T>
- Direct Known Subclasses:
ObjectWriter1,ObjectWriter10,ObjectWriter11,ObjectWriter12,ObjectWriter2,ObjectWriter3,ObjectWriter4,ObjectWriter5,ObjectWriter6,ObjectWriter7,ObjectWriter8,ObjectWriter9,ObjectWriterException,ObjectWriterRootName
public class ObjectWriterAdapter<T> extends Object implements ObjectWriter<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected FieldWriter[]fieldWriterArrayprotected StringtypeNameprotected longtypeNameHashprotected byte[]typeNameJSONBprotected longtypeNameSymbolCache
-
Constructor Summary
Constructors Constructor Description ObjectWriterAdapter(Class<T> objectClass, String typeKey, String typeName, long features, List<FieldWriter> fieldWriters)ObjectWriterAdapter(Class<T> objectClass, List<FieldWriter> fieldWriters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiderrorOnNoneSerializable()longgetFeatures()FieldWritergetFieldWriter(long hashCode)List<FieldWriter>getFieldWriters()booleanhasFilter(JSONWriter jsonWriter)voidsetNameFilter(NameFilter nameFilter)voidsetPropertyFilter(PropertyFilter propertyFilter)voidsetPropertyPreFilter(PropertyPreFilter propertyPreFilter)voidsetValueFilter(ValueFilter valueFilter)JSONObjecttoJSONObject(T object)JSONObjecttoJSONObject(T object, long features)Map<String,Object>toMap(Object object)StringtoString()voidwrite(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)voidwriteArrayMappingJSONB(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)protected voidwriteClassInfo(JSONWriter jsonWriter)voidwriteJSONB(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)booleanwriteTypeInfo(JSONWriter jsonWriter)voidwriteWithFilter(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.alibaba.fastjson2.writer.ObjectWriter
getFieldValue, getFieldWriter, setFilter, toJSONString, write, writeArrayMapping, writeArrayMappingJSONB, writeWithFilter
-
-
-
-
Field Detail
-
fieldWriterArray
protected final FieldWriter[] fieldWriterArray
-
typeName
protected final String typeName
-
typeNameHash
protected final long typeNameHash
-
typeNameSymbolCache
protected long typeNameSymbolCache
-
typeNameJSONB
protected final byte[] typeNameJSONB
-
-
Constructor Detail
-
ObjectWriterAdapter
public ObjectWriterAdapter(Class<T> objectClass, List<FieldWriter> fieldWriters)
-
-
Method Detail
-
getFeatures
public long getFeatures()
- Specified by:
getFeaturesin interfaceObjectWriter<T>
-
getFieldWriter
public FieldWriter getFieldWriter(long hashCode)
- Specified by:
getFieldWriterin interfaceObjectWriter<T>
-
hasFilter
public final boolean hasFilter(JSONWriter jsonWriter)
- Specified by:
hasFilterin interfaceObjectWriter<T>
-
setPropertyFilter
public void setPropertyFilter(PropertyFilter propertyFilter)
- Specified by:
setPropertyFilterin interfaceObjectWriter<T>
-
setValueFilter
public void setValueFilter(ValueFilter valueFilter)
- Specified by:
setValueFilterin interfaceObjectWriter<T>
-
setNameFilter
public void setNameFilter(NameFilter nameFilter)
- Specified by:
setNameFilterin interfaceObjectWriter<T>
-
setPropertyPreFilter
public void setPropertyPreFilter(PropertyPreFilter propertyPreFilter)
- Specified by:
setPropertyPreFilterin interfaceObjectWriter<T>
-
writeArrayMappingJSONB
public void writeArrayMappingJSONB(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)
- Specified by:
writeArrayMappingJSONBin interfaceObjectWriter<T>
-
writeJSONB
public void writeJSONB(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)
- Specified by:
writeJSONBin interfaceObjectWriter<T>
-
writeClassInfo
protected final void writeClassInfo(JSONWriter jsonWriter)
-
write
public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)
- Specified by:
writein interfaceObjectWriter<T>
-
getFieldWriters
public List<FieldWriter> getFieldWriters()
- Specified by:
getFieldWritersin interfaceObjectWriter<T>
-
writeTypeInfo
public boolean writeTypeInfo(JSONWriter jsonWriter)
- Specified by:
writeTypeInfoin interfaceObjectWriter<T>
-
writeWithFilter
public void writeWithFilter(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features)
- Specified by:
writeWithFilterin interfaceObjectWriter<T>
-
toJSONObject
public JSONObject toJSONObject(T object)
-
toJSONObject
public JSONObject toJSONObject(T object, long features)
-
errorOnNoneSerializable
protected void errorOnNoneSerializable()
-
-