Class FieldComparator
java.lang.Object
com.northconcepts.datapipeline.core.FieldComparator
- All Implemented Interfaces:
Cloneable,Comparator<Field>
See
FieldPath for supported field name expressions.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()intintcompareRecord(Record record1, Record record2, boolean cacheFieldIndexes) Compares two records by their field atgetFieldName(), throwing if either lacks it;cacheFieldIndexesis ignored.Copies the field name, sort direction and collator from the given comparator.Returns the collator used to compare string values or null for natural ordering (the default).Returns the field path of the field used for comparisons.booleanIndicates if fields are compared in ascending order (default is true).setAscending(boolean ascending) Indicates if fields are compared in ascending order (default is true).setCollator(Collator collator) Sets the collator used to compare string values or null for natural ordering (the default).setFieldName(String fieldName) Sets the field path of the field to be used for comparisons.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
FieldComparator
public FieldComparator()
-
-
Method Details
-
copyFrom
Copies the field name, sort direction and collator from the given comparator. -
isAscending
public boolean isAscending()Indicates if fields are compared in ascending order (default is true). -
setAscending
Indicates if fields are compared in ascending order (default is true). -
getCollator
Returns the collator used to compare string values or null for natural ordering (the default). -
setCollator
Sets the collator used to compare string values or null for natural ordering (the default). -
getFieldName
Returns the field path of the field used for comparisons. -
setFieldName
Sets the field path of the field to be used for comparisons. Accepts any expression that can be parsed byFieldPath.parse(String). -
clone
-
compare
- Specified by:
comparein interfaceComparator<Field>
-
compareRecord
Compares two records by their field atgetFieldName(), throwing if either lacks it;cacheFieldIndexesis ignored.
-