Top Description Fields Constructors Methods
tools.jackson.databind.ser

public abstract Class PropertyWriter

extends ConcreteBeanPropertyBase
Class Inheritance
Known Direct Subclasses
tools.jackson.databind.ser.jdk.MapProperty, tools.jackson.databind.ser.BeanPropertyWriter
Imports
java.lang.annotation.Annotation, tools.jackson.core.JsonGenerator, tools.jackson.databind.*, tools.jackson.databind.introspect.BeanPropertyDefinition, .ConcreteBeanPropertyBase, tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor

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.

Field Summary

Inherited from tools.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 objectVisitor, SerializationContext provider)

Redeclares tools.jackson.databind.BeanProperty.depositSchemaProperty.

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

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 tools.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 tools.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
public abstract String
public abstract void
serializeAsElement(Object value, JsonGenerator g, SerializationContext provider)

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

public abstract void
serializeAsOmittedElement(Object value, JsonGenerator g, SerializationContext provider)

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

public abstract void
serializeAsOmittedProperty(Object value, JsonGenerator g, SerializationContext provider)

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

public abstract void
serializeAsProperty(Object value, JsonGenerator g, SerializationContext provider)

The main serialization method called by filter when property is to be written as an Object property.

Inherited from tools.jackson.databind.introspect.ConcreteBeanPropertyBase:
findAliasesfindFormatOverridesfindPropertyFormatfindPropertyInclusiongetMetadataisRequiredisVirtual

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, SerializationContext provider)

Redeclares tools.jackson.databind.BeanProperty.depositSchemaProperty.

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

Annotations
@Override
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 tools.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 tools.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
getFullNameback to summary
public abstract PropertyName getFullName()

Redeclares tools.jackson.databind.util.FullyNamed.getFullName.

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

Redeclares tools.jackson.core.util.Named.getName.

Annotations
@Override
serializeAsElementback to summary
public abstract void serializeAsElement(Object value, JsonGenerator g, SerializationContext 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.

serializeAsOmittedElementback to summary
public abstract void serializeAsOmittedElement(Object value, JsonGenerator g, SerializationContext 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 serializeAsOmittedProperty.

serializeAsOmittedPropertyback to summary
public abstract void serializeAsOmittedProperty(Object value, JsonGenerator g, SerializationContext provider) throws Exception

Serialization method that filter needs to call in cases where a property value (key, value) 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.

serializeAsPropertyback to summary
public abstract void serializeAsProperty(Object value, JsonGenerator g, SerializationContext provider) throws Exception

The main serialization method called by filter when property is to be written as an Object property.