Enum Class CoercionMode

java.lang.Object
java.lang.Enum<CoercionMode>
io.micronaut.serde.config.CoercionMode
All Implemented Interfaces:
Serializable, Comparable<CoercionMode>, Constable

public enum CoercionMode extends Enum<CoercionMode>
The baseline for the scalar coercions a decoder performs. Individual coercions can always be turned on or off explicitly, the mode only decides the default for the ones that are not configured.
Since:
3.2
Author:
Denis Stepanov
  • Enum Constant Details

    • LENIENT

      public static final CoercionMode LENIENT
      Values of the wrong shape are coerced where a sensible conversion exists, for example a JSON string is read into an int property. This is the historical behaviour.
    • STRICT

      public static final CoercionMode STRICT
      Values must have the shape of the target type. A JSON string is not read into an int property, a floating point number is not read into an integer property, and so on.
  • Method Details

    • values

      public static CoercionMode[] 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

      public static CoercionMode valueOf(String name)
      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 name
      NullPointerException - if the argument is null