Class DMinMax
java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.constraint.DMinMax
- All Implemented Interfaces:
CellProcessor, StringCellProcessor
Converts the input data to a Double and ensures that number is within a specified numeric range (inclusive). If the
data has no upper bound (or lower bound), you should use either of
MIN or MAX constants
provided in the class.- Author:
- Kasper B. Graversen, James Bassett
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum value for 8 bits (signed)static final intMaximum value for 8 bits (unsigned)static final doubleMaximum value for a Characterstatic final doubleMaximum value for a Doublestatic final doubleMaximum value for a Shortstatic final intMinimum value for 8 bits (signed)static final intMinimum value for 8 bits (unsigned)static final doubleMinimum value for a Characterstatic final doubleMinimum value for a Doublestatic final doubleMinimum value for a ShortFields inherited from class CellProcessorAdaptor
next -
Constructor Summary
ConstructorsConstructorDescriptionDMinMax(double min, double max) Constructs a new DMinMax processor, which converts the input to a Double and ensures the value is between the supplied min and max values.DMinMax(double min, double max, DoubleCellProcessor next) Constructs a new DMinMax processor, which converts the input to a Double, ensures the value is between the supplied min and max values, then calls the next processor in the chain. -
Method Summary
Modifier and TypeMethodDescriptionexecute(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 CellProcessorAdaptor
toString, validateInputNotNull
-
Field Details
-
MAX_DOUBLE
public static final double MAX_DOUBLEMaximum value for a Double- See Also:
-
MIN_DOUBLE
public static final double MIN_DOUBLEMinimum value for a Double- See Also:
-
MAX_SHORT
public static final double MAX_SHORTMaximum value for a Short- See Also:
-
MIN_SHORT
public static final double MIN_SHORTMinimum value for a Short- See Also:
-
MAX_CHAR
public static final double MAX_CHARMaximum value for a Character- See Also:
-
MIN_CHAR
public static final double MIN_CHARMinimum value for a Character- See Also:
-
MAX_8_BIT_UNSIGNED
public static final int MAX_8_BIT_UNSIGNEDMaximum value for 8 bits (unsigned)- See Also:
-
MIN_8_BIT_UNSIGNED
public static final int MIN_8_BIT_UNSIGNEDMinimum value for 8 bits (unsigned)- See Also:
-
MAX_8_BIT_SIGNED
public static final int MAX_8_BIT_SIGNEDMaximum value for 8 bits (signed)- See Also:
-
MIN_8_BIT_SIGNED
public static final int MIN_8_BIT_SIGNEDMinimum value for 8 bits (signed)- See Also:
-
-
Constructor Details
-
DMinMax
public DMinMax(double min, double max) Constructs a new DMinMax processor, which converts the input to a Double and ensures the value is between the supplied min and max values.- Parameters:
min- the minimum value (inclusive)max- the maximum value (inclusive)- Throws:
IllegalArgumentException- ifmax < min
-
DMinMax
Constructs a new DMinMax processor, which converts the input to a Double, ensures the value is between the supplied min and max values, then calls the next processor in the chain.- Parameters:
min- the minimum value (inclusive)max- the maximum value (inclusive)next- the next processor in the chain- Throws:
IllegalArgumentException- ifmax < minNullPointerException- if next is null
-
-
Method Details
-
execute
This method is invoked by the framework when the processor needs to process data or check constraints.- Specified by:
executein interfaceCellProcessor- Parameters:
value- the value to be processedcontext- the CSV context- Returns:
- the result of cell processor execution
- Throws:
SuperCsvCellProcessorException- if value is null or can't be parsed as a DoubleSuperCsvConstraintViolationException- if value doesn't lie between min and max (inclusive)
-