public final class FilterFactory extends Object
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 attribute
SossIndexAttribute
.
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 from Taggable
.
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.scaleoutsoftware.soss.client.FilterFactory.*;After doing this the expressions can be used as in following example:
cache.query(PlainClass.class, not(and(equal("a", 0), equal("b", 1))));
Constructor and Description |
---|
FilterFactory() |
Modifier and Type | Method and Description |
---|---|
static Filter |
and(Filter firstFilter,
Filter secondFilter)
Creates a compound filter, matching objects must satisfy
firstFilter AND secondFilter . |
static Filter |
contains(String propertyName,
String str)
The string property with the name
propertyName must CONTAIN the string
str . |
static Filter |
equal(String propertyName,
Object value)
The value of the property with the name
propertyName must be EQUAL to
value . |
static Filter |
expressionsEqual(Filter firstFilter,
Filter secondFilter)
To pass through this filter objects must satisfy both
firstFilter and secondFilter or
neither of them. |
static Filter |
greaterOrEqual(String propertyName,
Object value)
The value of the property with the name
propertyName must be GREATER than OR EQUAL to
value . |
static Filter |
greaterThan(String propertyName,
Object value)
The value of the property with the name
propertyName must be GREATER than
value . |
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 name
propertyName must be CONTAINED IN the string
str . |
static Filter |
lessOrEqual(String propertyName,
Object value)
The value of the property with the name
propertyName must be LESS than OR EQUAL to
value . |
static Filter |
lessThan(String propertyName,
Object value)
The value of the property with the name
propertyName must be LESS than
value . |
static Filter |
not(Filter filter)
Creates a compound filter, matching objects must NOT satisfy
filter . |
static Filter |
notEqual(String propertyName,
Object value)
The value of the property with the name
propertyName must NOT be EQUAL to
value . |
static Filter |
or(Filter firstFilter,
Filter secondFilter)
Creates a compound filter, matching objects must satisfy
firstFilter OR secondFilter . |
static Filter |
propertiesContains(String firstPropertyName,
String secondPropertyName)
The string property with the name
propertyName must CONTAIN the string property with the name
secondPropertyName . |
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 name
firstPropertyName must be
GREATER than OR EQUAL to that of the property with the name secondPropertyName . |
static Filter |
propertiesGreaterThan(String firstPropertyName,
String secondPropertyName)
The value of the property of the matching objects with the name
firstPropertyName must be
GREATER than that of the property with the name secondPropertyName . |
static Filter |
propertiesLessOrEqual(String firstPropertyName,
String secondPropertyName)
The value of the property of the matching objects with the name
firstPropertyName must be
LESS than OR EQUAL to that of the property with the name secondPropertyName . |
static Filter |
propertiesLessThan(String firstPropertyName,
String secondPropertyName)
The value of the property of the matching objects with the name
firstPropertyName must be
LESS than that of the property with the name secondPropertyName . |
static Filter |
propertiesNotEqual(String firstPropertyName,
String secondPropertyName)
The two properties of matching objects must NOT be EQUAL.
|
public static Filter and(Filter firstFilter, Filter secondFilter)
firstFilter
AND secondFilter
.firstFilter
- first filter for the expressionsecondFilter
- second filter for the expressionpublic static Filter or(Filter firstFilter, Filter secondFilter)
firstFilter
OR secondFilter
.firstFilter
- first filter for the expressionsecondFilter
- second filter for the expressionpublic static Filter not(Filter filter)
filter
.filter
- filter for the expressionpublic static Filter equal(String propertyName, Object value)
propertyName
must be EQUAL to
value
. The property should be annotated with SossIndexAttribute
.propertyName
- name of the property to matchvalue
- value to compare property withpublic static Filter notEqual(String propertyName, Object value)
propertyName
must NOT be EQUAL to
value
. The property should be annotated with SossIndexAttribute
.propertyName
- name of the property to matchvalue
- value to compare property withpublic static Filter greaterOrEqual(String propertyName, Object value)
propertyName
must be GREATER than OR EQUAL to
value
. The property should be annotated with SossIndexAttribute
.propertyName
- name of the property to matchvalue
- value to compare property withpublic static Filter greaterThan(String propertyName, Object value)
propertyName
must be GREATER than
value
. The property should be annotated with SossIndexAttribute
.propertyName
- name of the property to matchvalue
- value to compare property withpublic static Filter lessOrEqual(String propertyName, Object value)
propertyName
must be LESS than OR EQUAL to
value
. The property should be annotated with SossIndexAttribute
.propertyName
- name of the property to matchvalue
- value to compare property withpublic static Filter lessThan(String propertyName, Object value)
propertyName
must be LESS than
value
. The property should be annotated with SossIndexAttribute
.propertyName
- name of the property to matchvalue
- value to compare property withpublic static Filter contains(String propertyName, String str)
propertyName
must CONTAIN the string
str
. The property should be annotated with SossIndexAttribute
.
This method is case sensitive.propertyName
- name of the property to matchstr
- value to compare property withpublic static Filter isContained(String propertyName, String str)
propertyName
must be CONTAINED IN the string
str
. The property should be annotated with SossIndexAttribute
.
This method is case sensitive.propertyName
- name of the property to matchstr
- value to compare property withpublic static Filter propertiesEqual(String firstPropertyName, String secondPropertyName)
SossIndexAttribute
.firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to matchpublic static Filter propertiesNotEqual(String firstPropertyName, String secondPropertyName)
SossIndexAttribute
.firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to matchpublic static Filter propertiesGreaterOrEqual(String firstPropertyName, String secondPropertyName)
firstPropertyName
must be
GREATER than OR EQUAL to that of the property with the name secondPropertyName
.
The properties should be annotated with SossIndexAttribute
.firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to matchpublic static Filter propertiesGreaterThan(String firstPropertyName, String secondPropertyName)
firstPropertyName
must be
GREATER than that of the property with the name secondPropertyName
.
The properties should be annotated with SossIndexAttribute
.firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to matchpublic static Filter propertiesLessOrEqual(String firstPropertyName, String secondPropertyName)
firstPropertyName
must be
LESS than OR EQUAL to that of the property with the name secondPropertyName
.
The properties should be annotated with SossIndexAttribute
.firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to matchpublic static Filter propertiesLessThan(String firstPropertyName, String secondPropertyName)
firstPropertyName
must be
LESS than that of the property with the name secondPropertyName
.
The properties should be annotated with SossIndexAttribute
.firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to matchpublic static Filter propertiesContains(String firstPropertyName, String secondPropertyName)
propertyName
must CONTAIN the string property with the name
secondPropertyName
.firstPropertyName
- name of the first property to matchsecondPropertyName
- name of the second property to matchpublic static Filter hasAllTags(String... tags)
Taggable
.tags
- tags to be presentpublic static Filter hasAnyTags(String... tags)
Taggable
.tags
- tags to be presentpublic static Filter expressionsEqual(Filter firstFilter, Filter secondFilter)
firstFilter
and secondFilter
or
neither of them.firstFilter
- first filter for the expressionsecondFilter
- second filter for the expressionCopyright (C) 2007-2014 ScaleOut Software, Inc.