Class ComparisonPredicates
java.lang.Object
org.apache.sling.resource.filter.impl.predicates.ComparisonPredicates
Predicates to handle comparisons that are defined in the filter language
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRight and Left values are converted to String arraysRight and Left values are converted to String arraysValues are converted to a Number, and then additionally converted to a common type as the basis of comparisonValues are converted to a Number, and then additionally converted to a common type as the basis of comparisonRight and Left values are converted to String arraysValues are converted to Strings.Values are converted to Strings.Values are converted to Strings.Values are converted to a Number, and then additionally converted to a common type as the basis of comparisonValues are converted to a Number, and then additionally converted to a common type as the basis of comparison
-
Constructor Details
-
ComparisonPredicates
public ComparisonPredicates()
-
-
Method Details
-
is
Values are converted to Strings.- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if right hand String is equal to left hand String
-
isNot
public static Predicate<Resource> isNot(Function<Resource, Object> lhs, Function<Resource, Object> rhs) Values are converted to Strings.- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if right hand String is equal to left hand String
-
like
public static Predicate<Resource> like(Function<Resource, Object> lhs, Function<Resource, Object> rhs) Values are converted to Strings. Right hand value is treated as a Regular expression.- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if right hand value pattern matches the left hand value
-
gt
Values are converted to a Number, and then additionally converted to a common type as the basis of comparison- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if left hand value is greater than right hand value
-
gte
Values are converted to a Number, and then additionally converted to a common type as the basis of comparison- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if left hand value is greater than or equal to right hand value
-
lt
Values are converted to a Number, and then additionally converted to a common type as the basis of comparison- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if left hand value is less than right hand value
-
lte
Values are converted to a Number, and then additionally converted to a common type as the basis of comparison- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if left hand value is less than or equal to right hand value
-
contains
public static Predicate<Resource> contains(Function<Resource, Object> lhs, Function<Resource, Object> rhs) Right and Left values are converted to String arrays- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if left hand values are a subset of right hand values
-
containsAny
public static Predicate<Resource> containsAny(Function<Resource, Object> lhs, Function<Resource, Object> rhs) Right and Left values are converted to String arrays- Parameters:
lhs
- Function which provides comparison valuerhs
- Function which provides comparison value- Returns:
- true if the left hand values matches any of the right hand values
-
in
Right and Left values are converted to String arrays- Parameters:
lhs
- Function which provides value for comparisonrhs
- Function which provides value for comparison- Returns:
- true if left hand values are a subset of right hand values
-