Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.ser

public Class PropertyBuilder

extends Object
Class Inheritance
Imports
com.fasterxml.jackson.annotation.JsonInclude, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.annotation.JsonSerialize, com.fasterxml.jackson.databind.introspect.*, com.fasterxml.jackson.databind.jsontype.TypeSerializer, com.fasterxml.jackson.databind.util.*

Helper class for BeanSerializerFactory that is used to construct BeanPropertyWriter instances. Can be sub-classed to change behavior.

Field Summary

Modifier and TypeField and Description
protected final AnnotationIntrospector
protected final BeanDescription
protected final SerializationConfig
protected Object
_defaultBean

If a property has serialization inclusion value of com.fasterxml.jackson.annotation.JsonInclude.Include#NON_DEFAULT, we may need to know the default value of the bean, to know if property value equals default one.

protected final JsonInclude.Value
_defaultInclusion

Default inclusion mode for properties of the POJO for which properties are collected; possibly overridden on per-property basis.

protected final boolean
_useRealPropertyDefaults

Marker flag used to indicate that "real" default values are to be used for properties, as per per-type value inclusion of type NON_DEFAULT

private static final Object

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected BeanPropertyWriter
_constructPropertyWriter(BeanPropertyDefinition propDef, AnnotatedMember member, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, boolean suppressNulls, Object suppressableValue, Class<?>[] includeInViews)

Overridable factory method for actual construction of BeanPropertyWriter; often needed if subclassing buildWriter method.

protected Object
_throwWrapped(Exception e, String propName, Object defaultBean)

protected BeanPropertyWriter
buildWriter(SerializerProvider prov, BeanPropertyDefinition propDef, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, TypeSerializer
Optional explicit type information serializer to use for contained values (only used for properties that are of container type)
contentTypeSer
,
AnnotatedMember am, boolean defaultUseStaticTyping)

protected JavaType
findSerializationType(Annotated a, boolean useStaticTyping, JavaType declaredType)

Method that will try to determine statically defined type of property being serialized, based on annotations (for overrides), and alternatively declared type (if static typing for serialization is enabled).

public Annotations
protected Object
protected Object
getDefaultValue(JavaType type)

Deprecated Since 2.9
protected Object
getPropertyDefaultValue(String name, AnnotatedMember member, JavaType type)

Deprecated Since 2.9 since this will not allow determining difference between "no default instance" case and default being `null`.
Accessor used to find out "default value" for given property, to use for comparing values to serialize, to determine whether to exclude value from serialization with inclusion type of com.fasterxml.jackson.annotation.JsonInclude.Include#NON_DEFAULT.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_annotationIntrospectorback to summary
protected final AnnotationIntrospector _annotationIntrospector
_beanDescback to summary
protected final BeanDescription _beanDesc
_configback to summary
protected final SerializationConfig _config
_defaultBeanback to summary
protected Object _defaultBean

If a property has serialization inclusion value of com.fasterxml.jackson.annotation.JsonInclude.Include#NON_DEFAULT, we may need to know the default value of the bean, to know if property value equals default one.

Note

only used if enclosing class defines NON_DEFAULT, but NOT if it is the global default OR per-property override.

_defaultInclusionback to summary
protected final JsonInclude.Value _defaultInclusion

Default inclusion mode for properties of the POJO for which properties are collected; possibly overridden on per-property basis. Combines global inclusion defaults and per-type (annotation and type-override) inclusion overrides.

_useRealPropertyDefaultsback to summary
protected final boolean _useRealPropertyDefaults

Marker flag used to indicate that "real" default values are to be used for properties, as per per-type value inclusion of type NON_DEFAULT

Since
2.8
NO_DEFAULT_MARKERback to summary
private static final Object NO_DEFAULT_MARKER

Constructor Detail

PropertyBuilderback to summary
public PropertyBuilder(SerializationConfig config, BeanDescription beanDesc)

Method Detail

_constructPropertyWriterback to summary
protected BeanPropertyWriter _constructPropertyWriter(BeanPropertyDefinition propDef, AnnotatedMember member, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, boolean suppressNulls, Object suppressableValue, Class<?>[] includeInViews) throws JsonMappingException

Overridable factory method for actual construction of BeanPropertyWriter; often needed if subclassing buildWriter method.

Since
2.12
_throwWrappedback to summary
protected Object _throwWrapped(Exception e, String propName, Object defaultBean)
buildWriterback to summary
protected BeanPropertyWriter buildWriter(SerializerProvider prov, BeanPropertyDefinition propDef, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, TypeSerializer contentTypeSer, AnnotatedMember am, boolean defaultUseStaticTyping) throws JsonMappingException
Parameters
contentTypeSer:TypeSerializer

Optional explicit type information serializer to use for contained values (only used for properties that are of container type)

findSerializationTypeback to summary
protected JavaType findSerializationType(Annotated a, boolean useStaticTyping, JavaType declaredType) throws JsonMappingException

Method that will try to determine statically defined type of property being serialized, based on annotations (for overrides), and alternatively declared type (if static typing for serialization is enabled). If neither can be used (no annotations, dynamic typing), returns null.

getClassAnnotationsback to summary
public Annotations getClassAnnotations()
getDefaultBeanback to summary
protected Object getDefaultBean()
getDefaultValueback to summary
protected Object getDefaultValue(JavaType type)

Deprecated

Since 2.9

Annotations
@Deprecated
getPropertyDefaultValueback to summary
protected Object getPropertyDefaultValue(String name, AnnotatedMember member, JavaType type)

Deprecated

Since 2.9 since this will not allow determining difference between "no default instance" case and default being `null`.

Accessor used to find out "default value" for given property, to use for comparing values to serialize, to determine whether to exclude value from serialization with inclusion type of com.fasterxml.jackson.annotation.JsonInclude.Include#NON_DEFAULT. This method is called when we specifically want to know default value within context of a POJO, when annotation is within containing class, and not for property or defined as global baseline.

Note that returning of pseudo-type com.fasterxml.jackson.annotation.JsonInclude.Include#NON_EMPTY requires special handling.

Annotations
@Deprecated
Since
2.7