Enum Class Nulls
- All Implemented Interfaces:
Serializable,Comparable<Nulls>,Constable
null (or absent
Optional) is encountered on the wire.
Juneau's analog of Jackson's com.fasterxml.jackson.annotation.Nulls. The selected mode
decides what the parser does at the moment of setting the bean property — it does not
affect serialization.
Precedence:
- Per-property
@MarshalledProp(nulls=…). - Context-level default on
Parser.Builder.nulls(Nulls). LEAVEwhen neither is set.
Optional contract:
For an Optional-typed property, EMPTY and DEFAULT both resolve to
Optional.empty() — never a bare null inside the Optional. The same rule
applies to OptionalInt, OptionalLong, and OptionalDouble.
- Since:
- 10.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSubstitute the bean-constructed default for this property — the value the property holds on a fresh no-arg-constructed instance of the bean.Substitute the type's "empty" value:String→""Collection→ empty collection (preserves declared type when possible)Map→ empty map Array → zero-length array of the declared element typeOptional/OptionalInt/OptionalLong/OptionalDouble→ the correspondingempty()sentinel Primitive — the Java primitive default (0,false,(char)0) Other reference types — falls back toLEAVEPass thenullvalue through to the setter unchanged.Sentinel meaning "no value configured" — falls through to the next-higher precedence level.Do not call the setter at all. -
Method Summary
-
Enum Constant Details
-
NOT_SET
Sentinel meaning "no value configured" — falls through to the next-higher precedence level. -
LEAVE
Pass thenullvalue through to the setter unchanged.For an
Optional-typed property this resolves toOptional.empty()per the shared Optional contract — never a barenullinside theOptional.This is the default behavior when no policy is configured.
-
EMPTY
Substitute the type's "empty" value:String→""Collection→ empty collection (preserves declared type when possible)Map→ empty map- Array → zero-length array of the declared element type
Optional/OptionalInt/OptionalLong/OptionalDouble→ the correspondingempty()sentinel- Primitive — the Java primitive default (
0,false,(char)0) - Other reference types — falls back to
LEAVE
-
DEFAULT
Substitute the bean-constructed default for this property — the value the property holds on a fresh no-arg-constructed instance of the bean.The reference instance is built once per bean class (and cached on its
ClassMeta). When no reference instance can be built (no accessible no-arg ctor / constructor throws), this mode silently falls back toLEAVE. -
SKIP
Do not call the setter at all.Any value already present on the bean (typically the bean's own field-initializer value) is preserved. This is useful for properties whose absence on the wire should be treated as "no change" rather than "reset to null".
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-