org.supercsv.cellprocessor
Class ParseEnum
- java.lang.Object
-
- org.supercsv.cellprocessor.CellProcessorAdaptor
-
- org.supercsv.cellprocessor.ParseEnum
-
- All Implemented Interfaces:
- CellProcessor, StringCellProcessor
public class ParseEnum extends CellProcessorAdaptor implements StringCellProcessor
Converts a String to an Enum. Patch originally supplied by Adrian Ber.- Since:
- 2.2.0
-
-
Constructor Summary
Constructors Constructor and Description ParseEnum(java.lang.Class<T> enumClass)Constructs a new ParseEnum processor, which converts a String to a Enum.ParseEnum(java.lang.Class<T> enumClass, boolean ignoreCase)Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag.ParseEnum(java.lang.Class<T> enumClass, boolean ignoreCase, CellProcessor next)Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag, then calls the next processor in the chain.ParseEnum(java.lang.Class<T> enumClass, CellProcessor next)Constructs a new ParseEnum processor, which converts a String to a Enum then calls the next processor in the chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Objectexecute(java.lang.Object value, CsvContext context)This method is invoked by the framework when the processor needs to process data or check constraints.-
Methods inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
toString
-
-
-
-
Constructor Detail
-
ParseEnum
public ParseEnum(java.lang.Class<T> enumClass)
Constructs a new ParseEnum processor, which converts a String to a Enum.- Parameters:
enumClass- the enum class to convert to- Throws:
java.lang.NullPointerException- if enumClass is null
-
ParseEnum
public ParseEnum(java.lang.Class<T> enumClass, boolean ignoreCase)Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag.- Parameters:
enumClass- the enum class to convert toignoreCase- whether to ignore the case of the input- Throws:
java.lang.NullPointerException- if enumClass is null
-
ParseEnum
public ParseEnum(java.lang.Class<T> enumClass, CellProcessor next)Constructs a new ParseEnum processor, which converts a String to a Enum then calls the next processor in the chain.- Parameters:
enumClass- the enum class to convert tonext- the next processor in the chain- Throws:
java.lang.NullPointerException- if enumClass or next is null
-
ParseEnum
public ParseEnum(java.lang.Class<T> enumClass, boolean ignoreCase, CellProcessor next)Constructs a new ParseEnum processor, which converts a String to a Enum, ignoring the case of the input (or not) depending on the supplied flag, then calls the next processor in the chain.- Parameters:
enumClass- the enum class to convert toignoreCase- whether to ignore the case of the inputnext- the next processor in the chain- Throws:
java.lang.NullPointerException- if enumClass or next is null
-
-
Method Detail
-
execute
public java.lang.Object execute(java.lang.Object value, CsvContext context)This method is invoked by the framework when the processor needs to process data or check constraints.- Specified by:
executein interfaceCellProcessor- Throws:
SuperCsvCellProcessorException- if value is null or can't be parsed as an Enum
-
-
DMelt 3.0 © DataMelt by jWork.ORG