Enum JsonIncludePolicy

  • All Implemented Interfaces:
    Serializable, Comparable<JsonIncludePolicy>

    public enum JsonIncludePolicy
    extends Enum<JsonIncludePolicy>
    Mirrors com.fasterxml.jackson.annotation.JsonInclude.Include (the set of policies a generated @JsonInclude annotation can be given), plus a NONE sentinel meaning "emit no @JsonInclude annotation at all", used by the spring and kotlin-spring generators (issue #24401) for:
    • the optionalNonNullPropertyJsonInclude config option (restricted to NON_NULL, NON_EMPTY, NON_DEFAULT, NONE — see OPTIONAL_NON_NULL_POLICIES)
    • the resolved x-jackson-json-include-policy vendor extension value, whether set manually on a property in the spec or computed by the automatic required/nullable matrix (any value is allowed there)
    • Field Detail

      • OPTIONAL_NON_NULL_POLICIES

        public static final Set<JsonIncludePolicy> OPTIONAL_NON_NULL_POLICIES
        The subset of policies accepted for the optionalNonNullPropertyJsonInclude config option.
    • Method Detail

      • values

        public static JsonIncludePolicy[] 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 (JsonIncludePolicy c : JsonIncludePolicy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JsonIncludePolicy 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
      • isEmitted

        public boolean isEmitted()
        Whether this policy should result in an emitted @JsonInclude annotation.
      • isValidOptionalNonNullPolicy

        public boolean isValidOptionalNonNullPolicy()
        Whether this policy is a valid value for the optionalNonNullPropertyJsonInclude config option.