Enum Class JsonSerialize.Inclusion

java.lang.Object
java.lang.Enum<JsonSerialize.Inclusion>
org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion
All Implemented Interfaces:
Serializable, Comparable<JsonSerialize.Inclusion>, Constable
Enclosing class:
JsonSerialize

public static enum JsonSerialize.Inclusion extends Enum<JsonSerialize.Inclusion>
Enumeration used with JsonSerialize.include() property to define which properties of Java Beans are to be included in serialization
Since:
1.1
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Value that indicates that properties are to be always included, independent of value
    Value that indicates that only properties that have values that differ from default settings (meaning values they have when Bean is constructed with its no-arguments constructor) are to be included.
    Value that indicates that only properties that have values that values that are null or what is considered empty are not to be included.
    Value that indicates that only properties with non-null values are to be included.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ALWAYS

      public static final JsonSerialize.Inclusion ALWAYS
      Value that indicates that properties are to be always included, independent of value
    • NON_NULL

      public static final JsonSerialize.Inclusion NON_NULL
      Value that indicates that only properties with non-null values are to be included.
    • NON_DEFAULT

      public static final JsonSerialize.Inclusion NON_DEFAULT
      Value that indicates that only properties that have values that differ from default settings (meaning values they have when Bean is constructed with its no-arguments constructor) are to be included. Value is generally not useful with Maps, since they have no default values; and if used, works same as ALWAYS.
    • NON_EMPTY

      public static final JsonSerialize.Inclusion NON_EMPTY
      Value that indicates that only properties that have values that values that are null or what is considered empty are not to be included. Emptiness is defined for following type:
      • For Collections and Maps, method isEmpty() is called;
      • For Java arrays, empty arrays are ones with length of 0
      • For Java Strings, length() is called, and return value of 0 indicates empty String (note that String.isEmpty() was added in Java 1.6 and as such can not be used by Jackson
        • For other types, non-null values are to be included.
      Since:
      1.9
  • Method Details

    • values

      public static JsonSerialize.Inclusion[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JsonSerialize.Inclusion valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null