Class LMinMax
java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.constraint.LMinMax
- All Implemented Interfaces:
CellProcessor, StringCellProcessor
Converts the input data to a Long and and ensures the value is between the supplied min and max values (inclusive).
If the data has no upper 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 intMaximum value for a Characterstatic final intMaximum value for an Integerstatic final longMaximum value for a Longstatic final shortMaximum value for a Shortstatic final intMinimum value for 8 bits (signed)static final intMinimum value for 8 bits (unsigned)static final intMinimum value for a Characterstatic final intMinimum value for an Integerstatic final longMinimum value for a Longstatic final shortMinimum value for a ShortFields inherited from class CellProcessorAdaptor
next -
Constructor Summary
ConstructorsConstructorDescriptionLMinMax(long min, long max) Constructs a new LMinMax processor, which converts the input data to a Long and and ensures the value is between the supplied min and max values.LMinMax(long min, long max, LongCellProcessor next) Constructs a new LMinMax processor, which converts the input data to a Long and and 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_LONG
public static final long MAX_LONGMaximum value for a Long- See Also:
-
MIN_LONG
public static final long MIN_LONGMinimum value for a Long- See Also:
-
MAX_INTEGER
public static final int MAX_INTEGERMaximum value for an Integer- See Also:
-
MIN_INTEGER
public static final int MIN_INTEGERMinimum value for an Integer- See Also:
-
MAX_SHORT
public static final short MAX_SHORTMaximum value for a Short- See Also:
-
MIN_SHORT
public static final short MIN_SHORTMinimum value for a Short- See Also:
-
MAX_CHAR
public static final int MAX_CHARMaximum value for a Character- See Also:
-
MIN_CHAR
public static final int 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
-
LMinMax
public LMinMax(long min, long max) Constructs a new LMinMax processor, which converts the input data to a Long and 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
-
LMinMax
Constructs a new LMinMax processor, which converts the input data to a Long and and 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:
NullPointerException- if next is nullIllegalArgumentException- ifmax < min
-
-
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 LongSuperCsvConstraintViolationException- if value, or doesn't lie between min and max (inclusive)
-