Class Equals
java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.constraint.Equals
- All Implemented Interfaces:
BoolCellProcessor
,CellProcessor
,DateCellProcessor
,DoubleCellProcessor
,LongCellProcessor
,StringCellProcessor
public class Equals
extends CellProcessorAdaptor
implements BoolCellProcessor, DateCellProcessor, DoubleCellProcessor, LongCellProcessor, StringCellProcessor
This constraint ensures that all input data is equal (to each other, or to a supplied constant value).
- Since:
- 1.50
-
Field Summary
FieldsFields inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
next
-
Constructor Summary
ConstructorsConstructorDescriptionEquals()
Constructs a new Equals processor, which ensures all input data is equal.Constructs a new Equals processor, which ensures all input data is equal to the supplied constant value.Equals
(Object constantValue, CellProcessor next) Constructs a new Equals processor, which ensures all input data is equal to the supplied constant value, then calls the the next processor in the chain.Equals
(CellProcessor next) Constructs a new Equals processor, which ensures all input data is equal, then calls the the next processor in the chain. -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
Returns true if both objects are null or equal, otherwise false.execute
(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
-
Field Details
-
UNKNOWN
-
constantValue
-
constantSupplied
private boolean constantSupplied
-
-
Constructor Details
-
Equals
public Equals()Constructs a new Equals processor, which ensures all input data is equal. -
Equals
Constructs a new Equals processor, which ensures all input data is equal to the supplied constant value.- Parameters:
constantValue
- the constant value that all input must equal
-
Equals
Constructs a new Equals processor, which ensures all input data is equal, then calls the the next processor in the chain.- Parameters:
next
- the next processor in the chain- Throws:
NullPointerException
- if next is null
-
Equals
Constructs a new Equals processor, which ensures all input data is equal to the supplied constant value, then calls the the next processor in the chain.- Parameters:
constantValue
- the constant value that all input must equalnext
- the next processor in the chain- Throws:
NullPointerException
- 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:
execute
in interfaceCellProcessor
- Parameters:
value
- the value to be processedcontext
- the CSV context- Returns:
- the result of cell processor execution
- Throws:
SuperCsvConstraintViolationException
- if value isn't equal to the constant value (or previously encountered value if a constant wasn't supplied)
-
equals
Returns true if both objects are null or equal, otherwise false.- Parameters:
o1
- the first objecto2
- the second object- Returns:
- true if both objects are null or equal, otherwise false
-