Package com.thingworx.types.data.filters
Class LikeFilter
java.lang.Object
com.thingworx.types.data.filters.LikeFilter
- All Implemented Interfaces:
IFilter
@ThingworxExtensionApiClass(since={6,6},
canInstantiate=true)
public final class LikeFilter
extends Object
implements IFilter
Filter which applies a "like" (or "not like") criteria or regular-expression, rather than wildcard-based, forms of these criteria
("matches" and "not matches").
-
Constructor Summary
ConstructorsConstructorDescriptionLikeFilter
(String fieldName, String expression, boolean isSQLPattern, boolean inclusive, boolean caseSensitive) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
evaluateValue
(IPrimitiveType iPrimitive)
Gets the filter expression.boolean
boolean
boolean
void
resolveFields
(DataShapeDefinition metadata) void
setFieldName
(String value) void
setFilterExpression
(String expression)
Sets the filter expression.org.json.JSONObject
toJSON()
Produces JSON representation of this filter.
-
Constructor Details
-
LikeFilter
@ThingworxExtensionApiMethod(since={6,6}) public LikeFilter(String fieldName, String expression, boolean isSQLPattern, boolean inclusive, boolean caseSensitive)
Constructs aLikeFilter
instance.Note that the filtering behavior when using a wildcard expression (as opposed to regular expressions) is SQL-like, but not quite equivalent to SQL's wildcard expressions. Wildcard expressions here support '*' (or '%') as multi-character wildcards and '?' as a single character wildcard, but do not support '_' as a wildcard.
- Parameters:
fieldName
- Name of field to filterexpression
- Wildcard or regular expression to match againstisSQLPattern
- When true, the expression is treated as a wildcard expression; else it is treated as a regular expressioninclusive
- True implies a "like" condition; false implies a "not like" conditioncaseSensitive
- Whether the matching should be case-sensitive
-
-
Method Details
-
resolveFields
- Specified by:
resolveFields
in interfaceIFilter
-
getFieldName
- Specified by:
getFieldName
in interfaceIFilter
-
setFieldName
- Specified by:
setFieldName
in interfaceIFilter
-
setFilterExpression
Description copied from interface:IFilter
Sets the filter expression.- Specified by:
setFilterExpression
in interfaceIFilter
- Parameters:
expression
- the filter expression- See Also:
-
getFilterExpression
Description copied from interface:IFilter
Gets the filter expression.- Specified by:
getFilterExpression
in interfaceIFilter
- Returns:
- the filter expression
- See Also:
-
isInclusive
-
isSQLPattern
-
isCaseSensitive
-
evaluateValue
- Specified by:
evaluateValue
in interfaceIFilter
-
evaluateFilter
- Specified by:
evaluateFilter
in interfaceIFilter
-
toJSON
@ThingworxExtensionApiMethod(since={6,6}) public org.json.JSONObject toJSON() throws org.json.JSONException
Produces JSON representation of this filter. Fields are as follows:CommonPropertyNames.PROP_TYPE
:FilterFactory.FILTER_LIKE
,FilterFactory.FILTER_NOT_LIKE
,FilterFactory.FILTER_MATCHES
, orFilterFactory.FILTER_NOT_MATCHES
as appropriate, based on whether the filter'sisInclusive()
andisSQLPattern()
state.CommonPropertyNames.PROP_FIELDNAME
:getFieldName()
resultCommonPropertyNames.PROP_VALUE
: whenisSQLPattern()
is true (only),getFilterExpression()
resultCommonPropertyNames.PROP_EXPRESSION
: whenisSQLPattern()
is false (only),getFilterExpression()
resultCommonPropertyNames.PROP_ISCASESENSITIVE
:isCaseSensitive()
result, when true
-