Package org.openapitools.codegen.utils
Enum JsonIncludePolicy
- java.lang.Object
-
- java.lang.Enum<JsonIncludePolicy>
-
- org.openapitools.codegen.utils.JsonIncludePolicy
-
- All Implemented Interfaces:
Serializable,Comparable<JsonIncludePolicy>
public enum JsonIncludePolicy extends Enum<JsonIncludePolicy>
Mirrorscom.fasterxml.jackson.annotation.JsonInclude.Include(the set of policies a generated@JsonIncludeannotation can be given), plus aNONEsentinel meaning "emit no@JsonIncludeannotation at all", used by thespringandkotlin-springgenerators (issue #24401) for:- the
optionalNonNullPropertyJsonIncludeconfig option (restricted toNON_NULL,NON_EMPTY,NON_DEFAULT,NONE— seeOPTIONAL_NON_NULL_POLICIES) - the resolved
x-jackson-json-include-policyvendor extension value, whether set manually on a property in the spec or computed by the automatic required/nullable matrix (any value is allowed there)
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALWAYSCUSTOMNON_ABSENTNON_DEFAULTNON_EMPTYNON_NULLNONESentinel meaning "emit no@JsonIncludeannotation".USE_DEFAULTS
-
Field Summary
Fields Modifier and Type Field Description static Set<JsonIncludePolicy>OPTIONAL_NON_NULL_POLICIESThe subset of policies accepted for theoptionalNonNullPropertyJsonIncludeconfig option.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisEmitted()Whether this policy should result in an emitted@JsonIncludeannotation.booleanisValidOptionalNonNullPolicy()Whether this policy is a valid value for theoptionalNonNullPropertyJsonIncludeconfig option.static JsonIncludePolicyparse(Object rawPolicy)Parse a raw string (trimmed, case-insensitive) into aJsonIncludePolicy, or returnnullif blank/whitespace-only (callers treat that the same asNONE).static JsonIncludePolicyvalueOf(String name)Returns the enum constant of this type with the specified name.static JsonIncludePolicy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ALWAYS
public static final JsonIncludePolicy ALWAYS
-
NON_NULL
public static final JsonIncludePolicy NON_NULL
-
NON_ABSENT
public static final JsonIncludePolicy NON_ABSENT
-
NON_EMPTY
public static final JsonIncludePolicy NON_EMPTY
-
NON_DEFAULT
public static final JsonIncludePolicy NON_DEFAULT
-
USE_DEFAULTS
public static final JsonIncludePolicy USE_DEFAULTS
-
CUSTOM
public static final JsonIncludePolicy CUSTOM
-
NONE
public static final JsonIncludePolicy NONE
Sentinel meaning "emit no@JsonIncludeannotation".
-
-
Field Detail
-
OPTIONAL_NON_NULL_POLICIES
public static final Set<JsonIncludePolicy> OPTIONAL_NON_NULL_POLICIES
The subset of policies accepted for theoptionalNonNullPropertyJsonIncludeconfig 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 nameNullPointerException- if the argument is null
-
isEmitted
public boolean isEmitted()
Whether this policy should result in an emitted@JsonIncludeannotation.
-
isValidOptionalNonNullPolicy
public boolean isValidOptionalNonNullPolicy()
Whether this policy is a valid value for theoptionalNonNullPropertyJsonIncludeconfig option.
-
parse
public static JsonIncludePolicy parse(Object rawPolicy)
Parse a raw string (trimmed, case-insensitive) into aJsonIncludePolicy, or returnnullif blank/whitespace-only (callers treat that the same asNONE).- Throws:
IllegalArgumentException- if non-blank but not a validJsonIncludePolicyname
-
-