Enum CoercionAction

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CoercionAction>

    public enum CoercionAction
    extends java.lang.Enum<CoercionAction>
    Set of possible actions for requested coercion from an input shape CoercionInputShape that does not directly or naturally match target type (LogicalType). This action is suggestion for deserializers to use in cases where alternate actions could be appropriate: it is up to deserializer to check configured action and take it into consideration.
    Since:
    2.12
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AsEmpty
      Action to convert to "empty" value for type, whatever that is: for primitive types and their wrappers this is "default" value (for example, for int that would be 0); for Collections empty collection; for POJOs instance configured with default constructor and so on.
      AsNull
      Action to convert to null value
      Fail
      Action to fail coercion attempt with exceptipn
      TryConvert
      Action to attempt coercion (which may lead to failure)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static CoercionAction valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static CoercionAction[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • Fail

        public static final CoercionAction Fail
        Action to fail coercion attempt with exceptipn
      • TryConvert

        public static final CoercionAction TryConvert
        Action to attempt coercion (which may lead to failure)
      • AsNull

        public static final CoercionAction AsNull
        Action to convert to null value
      • AsEmpty

        public static final CoercionAction AsEmpty
        Action to convert to "empty" value for type, whatever that is: for primitive types and their wrappers this is "default" value (for example, for int that would be 0); for Collections empty collection; for POJOs instance configured with default constructor and so on.
    • Method Detail

      • values

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

        public static CoercionAction 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 name
        java.lang.NullPointerException - if the argument is null