JsonInclude.Include (Jackson-annotations 2.2.0 API)
Date: 2013-04-22

com.fasterxml.jackson.annotation

## Enum JsonInclude.Include

- java.lang.Object
- - java.lang.Enum<JsonInclude.Include>
  - - com.fasterxml.jackson.annotation.JsonInclude.Include

- All Implemented Interfaces:
    Serializable, Comparable<JsonInclude.Include>
  Enclosing class:
    JsonInclude

      public static enum JsonInclude.Include
      extends Enum<JsonInclude.Include>

  Enumeration used with `JsonInclude` to define which properties of Java Beans are to be included in serialization.

  Note: Jackson 1.x had similarly named ("Inclusion") enumeration included in `JsonSerialize` annotation: it is not deprecated and this value used instead.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ALWAYS` Value that indicates that property is to be always included, independent of value of the property.
    `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.
    `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.
    `NON_NULL` Value that indicates that only properties with non-null values are to be included.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JsonInclude.Include` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static JsonInclude.Include[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### ALWAYS

          public static final JsonInclude.Include ALWAYS

      Value that indicates that property is to be always included, independent of value of the property.

    - #### NON_NULL

          public static final JsonInclude.Include NON_NULL

      Value that indicates that only properties with non-null values are to be included.

    - #### NON_DEFAULT

          public static final JsonInclude.Include 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 `Map`s, since they have no default values; and if used, works same as `ALWAYS`.

    - #### NON_EMPTY

          public static final JsonInclude.Include 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.

      Default emptiness is defined for following type:

      - For `Collection`s and `Map`s, method `isEmpty()` is called;
      - For Java arrays, empty arrays are ones with length of 0
      - For Java `String`s, `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
      and for other types, non-null values are to be included.

      Note that this default handling can be overridden by custom `JsonSerializer` implementation: if method `isEmpty()` is overridden, it will be called to see if non-null values are considered empty (null is always considered empty).

  - ### Method Detail

    - #### values

          public static JsonInclude.Include[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (JsonInclude.Include c : JsonInclude.Include.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static JsonInclude.Include valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        `NullPointerException` - if the argument is null

Copyright © 2012-2013 FasterXML. All Rights Reserved.