Class StringToEnumCoercion<T extends java.lang.Enum>

  • Type Parameters:
    T - the type of enumeration
    All Implemented Interfaces:

    public final class StringToEnumCoercion<T extends java.lang.Enum>
    extends java.lang.Object
    implements Coercion<java.lang.String,​T>
    A Coercion for converting strings into an instance of a particular enumerated type. The name is used as the key to identify the enum instance, in a case-insensitive fashion. Moved from tapestry-core to tapestry-ioc in release 5.3, but kept in same package for compatibility. Moved tapestry-ioc to commons in release 5.4, but kept in same package for compatibility.
    • Method Detail

      • coerce

        public T coerce​(java.lang.String input)
        Description copied from interface: Coercion
        Converts an input value.
        Specified by:
        coerce in interface Coercion<java.lang.String,​T extends java.lang.Enum>
        input - the input value
      • addAlias

        public StringToEnumCoercion<TaddAlias​(java.lang.String alias,
                                                T value)
        Allows an alias value (alternate) string to reference a value.