Class FilterFactory
java.lang.Object
com.scaleout.client.caching.query.FilterFactory
This factory is used for constructing query expressions. Each of its methods return a filter (Filter
) which
can be in turn used to construct complex expressions. Methods of this class correspond to four types of operators,
that may be used in query expressions:
equal, notEqual, greaterOrEqual, greaterThan, lessOrEqual, lessThan
represent a comparison of a cached object property to a value. Property name is a name of an object's method annotated as an indexed attributeCacheObjectAttribute
.propertiesEqual, propertiesNotEqual, propertiesGreaterOrEqual, propertiesGreaterThan, propertiesLessOrEqual, propertiesLessThan
represent a comparison of two properties of a cached object.hasAllTags, hasAnyTags
specify a conditions based on object tags. For a class to support tags, it must implement fromTaggable
.and, or, not, expressionsEqual
are combined operators which can be used to define a boolean logic combinations of all four types of operators.
import static com.scaleout.client.filters.FilterFactory.*;After doing this the expressions can be used as in following example:
cache.queryKeys(not(and(equal("a", 0), equal("b", 1))), PlainClass.class);
-
Method Summary
Modifier and TypeMethodDescriptionstatic Filter
Creates a compound filter, matching objects must satisfyfirstFilter
ANDsecondFilter
.static Filter
The string property with the namepropertyName
must CONTAIN the stringstr
.static Filter
The value of the property with the namepropertyName
must be EQUAL tovalue
.static Filter
expressionsEqual
(Filter firstFilter, Filter secondFilter) To pass through this filter objects must satisfy bothfirstFilter
andsecondFilter
or neither of them.static Filter
greaterOrEqual
(String propertyName, Object value) The value of the property with the namepropertyName
must be GREATER than OR EQUAL tovalue
.static Filter
greaterThan
(String propertyName, Object value) The value of the property with the namepropertyName
must be GREATER thanvalue
.static Filter
hasAllTags
(String... tags) Matching objects must be tagged with ALL of the tags provided as parameters.static Filter
hasAnyTags
(String... tags) Matching objects must be tagged with ANY of the tags provided as parameters.static Filter
isContained
(String propertyName, String str) The string property with the namepropertyName
must be CONTAINED IN the stringstr
.static Filter
lessOrEqual
(String propertyName, Object value) The value of the property with the namepropertyName
must be LESS than OR EQUAL tovalue
.static Filter
The value of the property with the namepropertyName
must be LESS thanvalue
.static Filter
Creates a compound filter, matching objects must NOT satisfyfilter
.static Filter
The value of the property with the namepropertyName
must NOT be EQUAL tovalue
.static Filter
Creates a compound filter, matching objects must satisfyfirstFilter
ORsecondFilter
.static Filter
propertiesContains
(String firstPropertyName, String secondPropertyName) The string property with the namepropertyName
must CONTAIN the string property with the namesecondPropertyName
.static Filter
propertiesEqual
(String firstPropertyName, String secondPropertyName) The two properties of matching objects must be EQUAL.static Filter
propertiesGreaterOrEqual
(String firstPropertyName, String secondPropertyName) The value of the property of the matching objects with the namefirstPropertyName
must be GREATER than OR EQUAL to that of the property with the namesecondPropertyName
.static Filter
propertiesGreaterThan
(String firstPropertyName, String secondPropertyName) The value of the property of the matching objects with the namefirstPropertyName
must be GREATER than that of the property with the namesecondPropertyName
.static Filter
propertiesLessOrEqual
(String firstPropertyName, String secondPropertyName) The value of the property of the matching objects with the namefirstPropertyName
must be LESS than OR EQUAL to that of the property with the namesecondPropertyName
.static Filter
propertiesLessThan
(String firstPropertyName, String secondPropertyName) The value of the property of the matching objects with the namefirstPropertyName
must be LESS than that of the property with the namesecondPropertyName
.static Filter
propertiesNotEqual
(String firstPropertyName, String secondPropertyName) The two properties of matching objects must NOT be EQUAL.
-
Method Details
-
and
Creates a compound filter, matching objects must satisfyfirstFilter
ANDsecondFilter
.- Parameters:
firstFilter
- first filter for the expressionsecondFilter
- second filter for the expression- Returns:
- resulting filter
-
or
Creates a compound filter, matching objects must satisfyfirstFilter
ORsecondFilter
.- Parameters:
firstFilter
- first filter for the expressionsecondFilter
- second filter for the expression- Returns:
- resulting filter
-
not
Creates a compound filter, matching objects must NOT satisfyfilter
.- Parameters:
filter
- filter for the expression- Returns:
- resulting filter
-
equal
The value of the property with the namepropertyName
must be EQUAL tovalue
. The property should be annotated withCacheObjectAttribute
.- Parameters:
propertyName
- name of the property to matchvalue
- value to compare property with- Returns:
- resulting filter
-
notEqual
The value of the property with the namepropertyName
must NOT be EQUAL tovalue
. The property should be annotated withCacheObjectAttribute
.- Parameters:
propertyName
- name of the property to matchvalue
- value to compare property with- Returns:
- resulting filter
-
greaterOrEqual
The value of the property with the namepropertyName
must be GREATER than OR EQUAL tovalue
. The property should be annotated withCacheObjectAttribute
.- Parameters:
propertyName
- name of the property to matchvalue
- value to compare property with- Returns:
- resulting filter
-
greaterThan
The value of the property with the namepropertyName
must be GREATER thanvalue
. The property should be annotated withCacheObjectAttribute
.- Parameters:
propertyName
- name of the property to matchvalue
- value to compare property with- Returns:
- resulting filter
-
lessOrEqual
The value of the property with the namepropertyName
must be LESS than OR EQUAL tovalue
. The property should be annotated withCacheObjectAttribute
.- Parameters:
propertyName
- name of the property to matchvalue
- value to compare property with- Returns:
- resulting filter
-
lessThan
The value of the property with the namepropertyName
must be LESS thanvalue
. The property should be annotated withCacheObjectAttribute
.- Parameters:
propertyName
- name of the property to matchvalue
- value to compare property with- Returns:
- resulting filter
-
contains
The string property with the namepropertyName
must CONTAIN the stringstr
. The property should be annotated withCacheObjectAttribute
. This method is case sensitive.- Parameters:
propertyName
- name of the property to matchstr
- value to compare property with- Returns:
- resulting filter
-
isContained
The string property with the namepropertyName
must be CONTAINED IN the stringstr
. The property should be annotated withCacheObjectAttribute
. This method is case sensitive.- Parameters:
propertyName
- name of the property to matchstr
- value to compare property with- Returns:
- resulting filter
-
propertiesEqual
The two properties of matching objects must be EQUAL. The properties should be annotated withCacheObjectAttribute
.- Parameters:
firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to match- Returns:
- resulting filter
-
propertiesNotEqual
The two properties of matching objects must NOT be EQUAL. The properties should be annotated withCacheObjectAttribute
.- Parameters:
firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to match- Returns:
- resulting filter
-
propertiesGreaterOrEqual
The value of the property of the matching objects with the namefirstPropertyName
must be GREATER than OR EQUAL to that of the property with the namesecondPropertyName
. The properties should be annotated withCacheObjectAttribute
.- Parameters:
firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to match- Returns:
- resulting filter
-
propertiesGreaterThan
The value of the property of the matching objects with the namefirstPropertyName
must be GREATER than that of the property with the namesecondPropertyName
. The properties should be annotated withCacheObjectAttribute
.- Parameters:
firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to match- Returns:
- resulting filter
-
propertiesLessOrEqual
The value of the property of the matching objects with the namefirstPropertyName
must be LESS than OR EQUAL to that of the property with the namesecondPropertyName
. The properties should be annotated withCacheObjectAttribute
.- Parameters:
firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to match- Returns:
- resulting filter
-
propertiesLessThan
The value of the property of the matching objects with the namefirstPropertyName
must be LESS than that of the property with the namesecondPropertyName
. The properties should be annotated withCacheObjectAttribute
.- Parameters:
firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to match- Returns:
- resulting filter
-
propertiesContains
The string property with the namepropertyName
must CONTAIN the string property with the namesecondPropertyName
.- Parameters:
firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to match- Returns:
- resulting filter
-
hasAllTags
Matching objects must be tagged with ALL of the tags provided as parameters. Objects should implementTaggable
.- Parameters:
tags
- tags to be present- Returns:
- resulting filter
-
hasAnyTags
Matching objects must be tagged with ANY of the tags provided as parameters. Objects should implementTaggable
.- Parameters:
tags
- tags to be present- Returns:
- resulting filter
-
expressionsEqual
To pass through this filter objects must satisfy bothfirstFilter
andsecondFilter
or neither of them.- Parameters:
firstFilter
- first filter for the expressionsecondFilter
- second filter for the expression- Returns:
- resulting filter
-