Class EnumConverter<E extends Enum<E>>

java.lang.Object
org.apache.logging.log4j.core.config.plugins.convert.EnumConverter<E>
Type Parameters:
E - the enum class to parse.
All Implemented Interfaces:
TypeConverter<E>

public class EnumConverter<E extends Enum<E>> extends Object implements TypeConverter<E>
Converts a String into a Enum. Returns null for invalid enum names.
Since:
2.1 moved from TypeConverters
  • Constructor Details

    • EnumConverter

      public EnumConverter(Class<E> clazz)
  • Method Details

    • convert

      public E convert(String s)
      Description copied from interface: TypeConverter
      Converts a String to a given type.
      Specified by:
      convert in interface TypeConverter<E extends Enum<E>>
      Parameters:
      s - the String to convert. Cannot be null.
      Returns:
      the converted object.