com.fasterxml.jackson.databind.ser

Class PropertyWriter

    • Method Detail

      • getFullName

        public abstract PropertyName getFullName()
        Description copied from interface: BeanProperty
        Method for getting full name definition, including possible format-specific additional properties (such as namespace when using XML backend).
        Specified by:
        getFullName in interface BeanProperty
      • findAnnotation

        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
      • getAnnotation

        public abstract <A extends Annotation> A getAnnotation(Class<A> acls)
        Method for accessing annotations directly declared for property that this writer is associated with.
        Specified by:
        getAnnotation in interface BeanProperty
        Since:
        2.5
      • getContextAnnotation

        public abstract <A extends Annotation> A getContextAnnotation(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.
        Specified by:
        getContextAnnotation in interface BeanProperty
        Since:
        2.5
      • serializeAsOmittedField

        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.
        Throws:
        Exception
      • serializeAsElement

        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 (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

Copyright © 2008–2016 FasterXML. All rights reserved.