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

public abstract Class PropertyWriter

extends ConcreteBeanPropertyBase
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
com.fasterxml.jackson.databind.ser.std.MapProperty, com.fasterxml.jackson.databind.ser.BeanPropertyWriter
Imports
java.lang.annotation.Annotation, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition, .ConcreteBeanPropertyBase, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor, com.fasterxml.jackson.databind.node.ObjectNode

Base class for writers used to output property values (name-value pairs) as key/value pairs via streaming API. This is the most generic abstraction implemented by both POJO and java.util.Map serializers, and invoked by filtering functionality.
Since
2.3

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase:
_aliases_metadata

Constructor Summary

AccessConstructor and Description
protected
protected
protected

Method Summary

Modifier and TypeMethod and Description
public abstract void
depositSchemaProperty(JsonObjectFormatVisitor
Visitor to used as the callback handler
objectVisitor
,
SerializerProvider provider)

Redeclares com.fasterxml.jackson.databind.BeanProperty.depositSchemaProperty.

Traversal method used for things like JSON Schema generation, or POJO introspection.
public abstract void
depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider)

Deprecated Since 2.2
Legacy method called for JSON Schema generation; should not be called by new code
public <A extends Annotation> A
findAnnotation(Class<A> acls)

Convenience method for accessing annotation that may be associated either directly on property, or, if not, via enclosing class (context).

public abstract <A extends Annotation> A
getAnnotation(Class<A> acls)

Redeclares com.fasterxml.jackson.databind.BeanProperty.getAnnotation.

Method for accessing annotations directly declared for property that this writer is associated with.
public abstract <A extends Annotation> A
getContextAnnotation(Class<A> acls)

Redeclares com.fasterxml.jackson.databind.BeanProperty.getContextAnnotation.

Method for accessing annotations declared in context of the property that this writer is associated with; usually this means annotations on enclosing class for property.
public abstract PropertyName
getFullName()

Redeclares com.fasterxml.jackson.databind.BeanProperty.getFullName.

Method for getting full name definition, including possible format-specific additional properties (such as namespace when using XML backend).
public abstract String
getName()

Redeclares com.fasterxml.jackson.databind.BeanProperty.getName.

Method to get logical name of the property
public abstract void
serializeAsElement(Object value, JsonGenerator jgen, SerializerProvider provider)

Serialization method called when output is to be done as an array, that is, not using property names.

public abstract void
serializeAsField(Object value, JsonGenerator jgen, SerializerProvider provider)

The main serialization method called by filter when property is to be written normally.

public abstract void
serializeAsOmittedField(Object value, JsonGenerator jgen, SerializerProvider provider)

Serialization method that filter needs to call in cases where property is to be filtered, but the underlying data format requires a placeholder of some kind.

public abstract void
serializeAsPlaceholder(Object value, JsonGenerator jgen, SerializerProvider provider)

Serialization method called when doing tabular (positional) output from databind, but then value is to be omitted.

Inherited from com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase:
findAliasesfindFormatOverridesfindPropertyFormatfindPropertyInclusiongetMetadataisRequiredisVirtual

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase.serialVersionUID.

Constructor Detail

PropertyWriterback to summary
protected PropertyWriter(PropertyMetadata md)
PropertyWriterback to summary
protected PropertyWriter(BeanPropertyDefinition propDef)
PropertyWriterback to summary
protected PropertyWriter(PropertyWriter base)

Method Detail

depositSchemaPropertyback to summary
public abstract void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException

Redeclares com.fasterxml.jackson.databind.BeanProperty.depositSchemaProperty.

Traversal method used for things like JSON Schema generation, or POJO introspection.

Parameters
objectVisitor:JsonObjectFormatVisitor

Doc from com.fasterxml.jackson.databind.BeanProperty.depositSchemaProperty.

Visitor to used as the callback handler

Annotations
@Override
depositSchemaPropertyback to summary
public abstract void depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider) throws JsonMappingException

Deprecated

Since 2.2

Legacy method called for JSON Schema generation; should not be called by new code

Annotations
@Deprecated
findAnnotationback to summary
public <A extends Annotation> A findAnnotation(Class<A> acls)

Convenience method for accessing annotation that may be associated either directly on property, or, if not, via enclosing class (context). This allows adding baseline contextual annotations, for example, by adding an annotation for a given class and making that apply to all properties unless overridden by per-property annotations.

This method is functionally equivalent to:

  MyAnnotation ann = propWriter.getAnnotation(MyAnnotation.class);
  if (ann == null) {
    ann = propWriter.getContextAnnotation(MyAnnotation.class);
  }
that is, tries to find a property annotation first, but if one is not found, tries to find context-annotation (from enclosing class) of same type.
Since
2.5
getAnnotationback to summary
public abstract <A extends Annotation> A getAnnotation(Class<A> acls)

Redeclares com.fasterxml.jackson.databind.BeanProperty.getAnnotation.

Method for accessing annotations directly declared for property that this writer is associated with.

Annotations
@Override
Since
2.5
getContextAnnotationback to summary
public abstract <A extends Annotation> A getContextAnnotation(Class<A> acls)

Redeclares com.fasterxml.jackson.databind.BeanProperty.getContextAnnotation.

Method for accessing annotations declared in context of the property that this writer is associated with; usually this means annotations on enclosing class for property.

Annotations
@Override
Since
2.5
getFullNameback to summary
public abstract PropertyName getFullName()

Redeclares com.fasterxml.jackson.databind.BeanProperty.getFullName.

Doc from com.fasterxml.jackson.databind.BeanProperty.getFullName.

Method for getting full name definition, including possible format-specific additional properties (such as namespace when using XML backend).

Annotations
@Override
getNameback to summary
public abstract String getName()

Redeclares com.fasterxml.jackson.databind.BeanProperty.getName.

Doc from com.fasterxml.jackson.databind.BeanProperty.getName.

Method to get logical name of the property

Annotations
@Override
serializeAsElementback to summary
public abstract void serializeAsElement(Object value, JsonGenerator jgen, SerializerProvider provider) throws Exception

Serialization method called when output is to be done as an array, that is, not using property names. This is needed when serializing container (java.util.Collection, array) types, or POJOs using tabular ("as array") output format.

Note that this mode of operation is independent of underlying data format; so it is typically NOT called for fully tabular formats such as CSV, where logical output is still as form of POJOs.

serializeAsFieldback to summary
public abstract void serializeAsField(Object value, JsonGenerator jgen, SerializerProvider provider) throws Exception

The main serialization method called by filter when property is to be written normally.

serializeAsOmittedFieldback to summary
public abstract void serializeAsOmittedField(Object value, JsonGenerator jgen, SerializerProvider provider) throws Exception

Serialization method that filter needs to call in cases where property is to be filtered, but the underlying data format requires a placeholder of some kind. This is usually the case for tabular (positional) data formats such as CSV.

serializeAsPlaceholderback to summary
public abstract void serializeAsPlaceholder(Object value, JsonGenerator jgen, SerializerProvider provider) throws Exception

Serialization method called when doing tabular (positional) output from databind, but then value is to be omitted. This requires output of a placeholder value of some sort; often similar to serializeAsOmittedField.