public class JavaBeanSerializer extends SerializeFilterable implements ObjectSerializer
Constructor and Description |
---|
JavaBeanSerializer(Class<?> beanType) |
JavaBeanSerializer(Class<?> beanType,
Map<String,String> aliasMap) |
JavaBeanSerializer(Class<?> beanType,
String... aliasList) |
JavaBeanSerializer(SerializeBeanInfo beanInfo) |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getFieldNames(Object object)
Get field names of not null fields.
|
FieldSerializer |
getFieldSerializer(long hash) |
FieldSerializer |
getFieldSerializer(String key) |
Object |
getFieldValue(Object object,
String key) |
Object |
getFieldValue(Object object,
String key,
long keyHash,
boolean throwFieldNotFoundException) |
List<Object> |
getFieldValues(Object object) |
Map<String,Object> |
getFieldValuesMap(Object object) |
JSONType |
getJSONType() |
List<Object> |
getObjectFieldValues(Object object) |
int |
getSize(Object object) |
Class<?> |
getType() |
void |
write(JSONSerializer serializer,
Object object,
Object fieldName,
Type fieldType,
int features)
fastjson invokes this call-back method during serialization when it encounters a field of the
specified type.
|
void |
writeAsArray(JSONSerializer serializer,
Object object,
Object fieldName,
Type fieldType,
int features) |
void |
writeAsArrayNonContext(JSONSerializer serializer,
Object object,
Object fieldName,
Type fieldType,
int features) |
void |
writeDirectNonContext(JSONSerializer serializer,
Object object,
Object fieldName,
Type fieldType,
int features) |
void |
writeNoneASM(JSONSerializer serializer,
Object object,
Object fieldName,
Type fieldType,
int features) |
boolean |
writeReference(JSONSerializer serializer,
Object object,
int fieldFeatures) |
addFilter, apply, applyName, getAfterFilters, getBeforeFilters, getContextValueFilters, getLabelFilters, getNameFilters, getPropertyFilters, getPropertyPreFilters, getValueFilters
public JavaBeanSerializer(Class<?> beanType)
public JavaBeanSerializer(SerializeBeanInfo beanInfo)
public JSONType getJSONType()
public Class<?> getType()
public void writeDirectNonContext(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException
IOException
public void writeAsArray(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException
IOException
public void writeAsArrayNonContext(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException
IOException
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException
ObjectSerializer
write
in interface ObjectSerializer
object
- src the object that needs to be converted to Json.fieldName
- parent object field namefieldType
- parent object field typefeatures
- parent object field serializer featuresIOException
public void writeNoneASM(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException
IOException
public boolean writeReference(JSONSerializer serializer, Object object, int fieldFeatures)
public Object getFieldValue(Object object, String key, long keyHash, boolean throwFieldNotFoundException)
public FieldSerializer getFieldSerializer(String key)
public FieldSerializer getFieldSerializer(long hash)
public List<Object> getObjectFieldValues(Object object) throws Exception
Exception
public Set<String> getFieldNames(Object object) throws Exception
object
- the object to be checkedException
getSize(Object)
Copyright © 2012–2022 Alibaba Group. All rights reserved.