Enum ConstructorDetector.SingleArgConstructor
- java.lang.Object
-
- java.lang.Enum<ConstructorDetector.SingleArgConstructor>
-
- com.fasterxml.jackson.databind.cfg.ConstructorDetector.SingleArgConstructor
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ConstructorDetector.SingleArgConstructor>
- Enclosing class:
- ConstructorDetector
public static enum ConstructorDetector.SingleArgConstructor extends java.lang.Enum<ConstructorDetector.SingleArgConstructor>
Definition of alternate handling modes of single-argument constructors that are annotated withJsonCreator
but without "mode" definition (or explicit name for the argument): this is the case where two interpretations are possible -- "properties" (in which case the argument is named parameter of a JSON Object) and "delegating (in which case the argument maps to the whole JSON value).Default choice is
HEURISTIC
(which is Jackson pre-2.12 always uses)NOTE: does NOT have any effect if explicit
@JsonCreator
} annotation is required.- Since:
- 2.12
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DELEGATING
Assume "delegating" mode if not explicitly annotated otherwiseHEURISTIC
Use heuristics to see if "properties" mode is to be used (POJO has a property with the same name as the implicit name [if available] of the constructor argument).PROPERTIES
Assume "properties" mode if not explicitly annotated otherwiseREQUIRE_MODE
Refuse to decide implicit mode and instead throw aInvalidDefinitionException
in ambiguous case.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConstructorDetector.SingleArgConstructor
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ConstructorDetector.SingleArgConstructor[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DELEGATING
public static final ConstructorDetector.SingleArgConstructor DELEGATING
Assume "delegating" mode if not explicitly annotated otherwise
-
PROPERTIES
public static final ConstructorDetector.SingleArgConstructor PROPERTIES
Assume "properties" mode if not explicitly annotated otherwise
-
HEURISTIC
public static final ConstructorDetector.SingleArgConstructor HEURISTIC
Use heuristics to see if "properties" mode is to be used (POJO has a property with the same name as the implicit name [if available] of the constructor argument). Note: this is the default choice for Jackson versions before 2.12.
-
REQUIRE_MODE
public static final ConstructorDetector.SingleArgConstructor REQUIRE_MODE
Refuse to decide implicit mode and instead throw aInvalidDefinitionException
in ambiguous case.
-
-
Method Detail
-
values
public static ConstructorDetector.SingleArgConstructor[] 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 (ConstructorDetector.SingleArgConstructor c : ConstructorDetector.SingleArgConstructor.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConstructorDetector.SingleArgConstructor valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-