Package org.supercsv.cellprocessor.time
Class ParsePeriod
- java.lang.Object
-
- org.supercsv.cellprocessor.CellProcessorAdaptor
-
- org.supercsv.cellprocessor.time.ParsePeriod
-
- All Implemented Interfaces:
CellProcessor
public class ParsePeriod extends CellProcessorAdaptor
Converts a String to a Period. The input String must conform to the ISO 8601 period format, recognised byPeriod.parse(CharSequence)
. For example, "P6Y3M7D" represents 6 years, 3 months, 7 days.- Since:
- 2.4.0
-
-
Field Summary
-
Fields inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
next
-
-
Constructor Summary
Constructors Constructor Description ParsePeriod()
Constructs a new ParsePeriod processor, which parses a String as a Period.ParsePeriod(CellProcessor next)
Constructs a new ParsePeriod processor, which parses a String as a Period, then calls the next processor in the chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.-
Methods inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
toString, validateInputNotNull
-
-
-
-
Constructor Detail
-
ParsePeriod
public ParsePeriod()
Constructs a new ParsePeriod processor, which parses a String as a Period.
-
ParsePeriod
public ParsePeriod(CellProcessor next)
Constructs a new ParsePeriod processor, which parses a String as a Period, then calls the next processor in the chain.- Parameters:
next
- the next processor in the chain- Throws:
java.lang.NullPointerException
- if 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.- Parameters:
value
- the value to be processedcontext
- the CSV context- Returns:
- the result of cell processor execution
- Throws:
SuperCsvCellProcessorException
- if value is null or is not a String
-
-