java.lang.Object
tools.jackson.databind.introspect.ConcreteBeanPropertyBase
tools.jackson.databind.ser.PropertyWriter
- All Implemented Interfaces:
Named,BeanProperty,FullyNamed
- Direct Known Subclasses:
BeanPropertyWriter,MapProperty
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
Map serializers, and invoked
by filtering functionality.-
Nested Class Summary
Nested classes/interfaces inherited from interface tools.jackson.databind.BeanProperty
BeanProperty.Bogus, BeanProperty.StdNested classes/interfaces inherited from interface tools.jackson.core.util.Named
Named.StringAsNamed -
Field Summary
Fields inherited from class tools.jackson.databind.introspect.ConcreteBeanPropertyBase
_aliases, _metadataFields inherited from interface tools.jackson.databind.BeanProperty
EMPTY_FORMAT, EMPTY_INCLUDE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPropertyWriter(BeanPropertyDefinition propDef) protectedprotectedPropertyWriter(PropertyWriter base) -
Method Summary
Modifier and TypeMethodDescriptionabstract voiddepositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializationContext provider) Traversal method used for things like JSON Schema generation, or POJO introspection.<A extends Annotation>
AfindAnnotation(Class<A> acls) Convenience method for accessing annotation that may be associated either directly on property, or, if not, via enclosing class (context).abstract <A extends Annotation>
AgetAnnotation(Class<A> acls) Method for accessing annotations directly declared for property that this writer is associated with.abstract <A extends Annotation>
AgetContextAnnotation(Class<A> acls) 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.abstract PropertyNameabstract StringgetName()abstract voidserializeAsElement(Object value, JsonGenerator g, SerializationContext provider) Serialization method called when output is to be done as an array, that is, not using property names.abstract voidserializeAsOmittedElement(Object value, JsonGenerator g, SerializationContext provider) Serialization method called when doing tabular (positional) output from databind, but then value is to be omitted.abstract voidserializeAsOmittedProperty(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.abstract voidserializeAsProperty(Object value, JsonGenerator g, SerializationContext provider) The main serialization method called by filter when property is to be written as an Object property.Methods inherited from class tools.jackson.databind.introspect.ConcreteBeanPropertyBase
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtualMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tools.jackson.databind.BeanProperty
getMember, getType, getWrapperNameMethods inherited from interface tools.jackson.databind.util.FullyNamed
hasName
-
Constructor Details
-
PropertyWriter
-
PropertyWriter
-
PropertyWriter
-
-
Method Details
-
getName
-
getFullName
-
findAnnotation
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
-
getAnnotation
Method for accessing annotations directly declared for property that this writer is associated with.- Since:
- 2.5
-
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. -
serializeAsProperty
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.- Throws:
Exception
-
serializeAsOmittedProperty
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.- Throws:
Exception
-
serializeAsElement
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 (Collection, array) types, or POJOs usingtabular("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.
- Throws:
Exception
-
serializeAsOmittedElement
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 toserializeAsOmittedProperty(java.lang.Object, tools.jackson.core.JsonGenerator, tools.jackson.databind.SerializationContext).- Throws:
Exception
-
depositSchemaProperty
public abstract void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializationContext provider) Traversal method used for things like JSON Schema generation, or POJO introspection.- Parameters:
objectVisitor- Visitor to used as the callback handler
-