com.fasterxml.jackson.databind.ser

## Class PropertyWriter

- java.lang.Object
- - com.fasterxml.jackson.databind.ser.PropertyWriter

- Direct Known Subclasses:
    BeanPropertyWriter, MapProperty

      public abstract class PropertyWriter
      extends Object

  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.
  Since:
    2.3

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertyWriter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `depositSchemaProperty(JsonObjectFormatVisitor objectVisitor)` Traversal method used for things like JSON Schema generation, or POJO introspection.
    `abstract void` | `depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider)` Deprecated. Since 2.2
    `abstract PropertyName` | `getFullName()`
    `abstract String` | `getName()`
    `abstract void` | `serializeAsElement(Object pojo, JsonGenerator jgen, SerializerProvider prov)` Serialization method called when output is to be done as an array, that is, not using property names.
    `abstract void` | `serializeAsField(Object pojo, JsonGenerator jgen, SerializerProvider prov)` The main serialization method called by filter when property is to be written normally.
    `abstract void` | `serializeAsOmittedField(Object pojo, JsonGenerator jgen, SerializerProvider prov)` 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.
    `abstract void` | `serializeAsPlaceholder(Object pojo, JsonGenerator jgen, SerializerProvider prov)` Serialization method called when doing tabular (positional) output from databind, but then value is to be omitted.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PropertyWriter

          public PropertyWriter()

  - ### Method Detail

    - #### getName

          public abstract String getName()

    - #### getFullName

          public abstract PropertyName getFullName()

    - #### serializeAsField

          public abstract void serializeAsField(Object pojo,
                              JsonGenerator jgen,
                              SerializerProvider prov)
                                         throws Exception

      The main serialization method called by filter when property is to be written normally.
      Throws:
        `Exception`

    - #### serializeAsOmittedField

          public abstract void serializeAsOmittedField(Object pojo,
                                     JsonGenerator jgen,
                                     SerializerProvider prov)
                                                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.
      Throws:
        `Exception`

    - #### serializeAsElement

          public abstract void serializeAsElement(Object pojo,
                                JsonGenerator jgen,
                                SerializerProvider prov)
                                           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 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.

      Throws:
        `Exception`

    - #### serializeAsPlaceholder

          public abstract void serializeAsPlaceholder(Object pojo,
                                    JsonGenerator jgen,
                                    SerializerProvider prov)
                                               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(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)`.
      Throws:
        `Exception`

    - #### depositSchemaProperty

          public abstract void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor)
                                              throws JsonMappingException

      Traversal method used for things like JSON Schema generation, or POJO introspection.
      Throws:
        `JsonMappingException`

    - #### depositSchemaProperty

          @Deprecated
          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
      Throws:
        `JsonMappingException`

Copyright © 2012-2013 FasterXML. All Rights Reserved.