Package com.tangosol.coherence.rest.util
Class ComparatorBuilder
java.lang.Object
com.tangosol.coherence.rest.util.ComparatorBuilder
Comparator builder that provides a small set of builder methods to
simplify creation of a chain of
ExtractorComparator
s from given
ValueExtractor
s.- Author:
- ic 2011.06.30
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
add
(Comparator comparator) Append specified comparator to the end of list of comparators owned by this builder.asc
(ValueExtractor extractor) Add comparator to this builder.Add comparator to this builder.build()
Build comparator.protected Comparator
createComparator
(ValueExtractor extractor) Create extractor comparator.protected Comparator
createComparator
(String sExpr) Create extractor comparator.protected ValueExtractor
createExtractor
(String sExpr) Create expression extractor.desc
(ValueExtractor extractor) Add comparator to this builder.Add comparator to builder.protected Comparator
inverse
(Comparator comparator) Reverse ordering of a given comparator.protected Comparator
safe
(Comparator comparator) Wrap given comparator with aSafeComparator
.
-
Constructor Details
-
ComparatorBuilder
public ComparatorBuilder()
-
-
Method Details
-
asc
Add comparator to this builder.- Parameters:
sExpr
- expression used to create an expression extractor- Returns:
- this ComparatorBuilder
-
asc
Add comparator to this builder.- Parameters:
extractor
- extractor used to extract values- Returns:
- this ComparatorBuilder
-
desc
Add comparator to builder.- Parameters:
sExpr
- expression used to create expression extractor- Returns:
- this ComparatorBuilder
-
desc
Add comparator to this builder.- Parameters:
extractor
- extractor used to extract values- Returns:
- this ComparatorBuilder
-
build
Build comparator.- Returns:
- comparator representing current state of builder
-
add
Append specified comparator to the end of list of comparators owned by this builder.- Parameters:
comparator
- comparator to add
-
inverse
Reverse ordering of a given comparator.- Parameters:
comparator
- comparator to be reversed- Returns:
- a reversed comparator
-
createComparator
Create extractor comparator.- Parameters:
sExpr
- expression used to create expression extractor- Returns:
- comparator that will evaluate given expression when comparing values
-
createComparator
Create extractor comparator.- Parameters:
extractor
- extractor used while comparing values- Returns:
- comparator that will use given extractor when comparing values
-
safe
Wrap given comparator with aSafeComparator
.- Parameters:
comparator
- to be wrapped- Returns:
- SafeComparator wrapping given comparator
-
createExtractor
Create expression extractor.- Parameters:
sExpr
- expression to create extractor for- Returns:
- extractor for the specified expression
-