Class CharSequenceToEnumConverter<T extends Enum<T>>

java.lang.Object
io.micronaut.core.convert.CharSequenceToEnumConverter<T>
Type Parameters:
T - T The enum type
All Implemented Interfaces:
TypeConverter<CharSequence,T>

@Internal public final class CharSequenceToEnumConverter<T extends Enum<T>> extends Object implements TypeConverter<CharSequence,T>
The converter that converts CharSequence to an enum.
Since:
4.2.0
Author:
Denis Stepanov
  • Constructor Details

    • CharSequenceToEnumConverter

      public CharSequenceToEnumConverter()
  • Method Details

    • convert

      public Optional<T> convert(CharSequence charSequence, Class<T> targetType, ConversionContext context)
      Description copied from interface: TypeConverter
      Converts from the given source object type to the target type. Implementers should take care to return Optional.empty() in case the object is not convertible by catching any necessary exceptions and failing gracefully.
      Specified by:
      convert in interface TypeConverter<CharSequence,T extends Enum<T>>
      Parameters:
      charSequence - The object type
      targetType - The target type being converted to
      context - The ConversionContext
      Returns:
      The converted type or empty if the conversion is not possible