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 java.lang.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
Constructors Constructor Description LikeFilter(java.lang.String fieldName, java.lang.String expression, boolean isSQLPattern, boolean inclusive, boolean caseSensitive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
evaluateFilter(ValueCollection row)
boolean
evaluateValue(IPrimitiveType iPrimitive)
java.lang.String
getFieldName()
java.lang.String
getFilterExpression()
Gets the filter expression.boolean
isCaseSensitive()
boolean
isInclusive()
boolean
isSQLPattern()
void
resolveFields(DataShapeDefinition metadata)
void
setFieldName(java.lang.String value)
void
setFilterExpression(java.lang.String expression)
Sets the filter expression.org.json.JSONObject
toJSON()
Produces JSON representation of this filter.
-
-
-
Constructor Detail
-
LikeFilter
@ThingworxExtensionApiMethod(since={6,6}) public LikeFilter(java.lang.String fieldName, java.lang.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 Detail
-
resolveFields
@ThingworxExtensionApiMethod(since={6,6}) public void resolveFields(DataShapeDefinition metadata)
- Specified by:
resolveFields
in interfaceIFilter
-
getFieldName
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getFieldName()
- Specified by:
getFieldName
in interfaceIFilter
-
setFieldName
@ThingworxExtensionApiMethod(since={6,6}) public void setFieldName(java.lang.String value)
- Specified by:
setFieldName
in interfaceIFilter
-
setFilterExpression
@ThingworxExtensionApiMethod(since={6,6}) public void setFilterExpression(java.lang.String expression)
Description copied from interface:IFilter
Sets the filter expression.- Specified by:
setFilterExpression
in interfaceIFilter
- Parameters:
expression
- the filter expression- See Also:
IFilter.getFilterExpression()
-
getFilterExpression
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getFilterExpression()
Description copied from interface:IFilter
Gets the filter expression.- Specified by:
getFilterExpression
in interfaceIFilter
- Returns:
- the filter expression
- See Also:
IFilter.setFilterExpression(String)
-
isInclusive
@ThingworxExtensionApiMethod(since={6,6}) public boolean isInclusive()
-
isSQLPattern
@ThingworxExtensionApiMethod(since={6,6}) public boolean isSQLPattern()
-
isCaseSensitive
@ThingworxExtensionApiMethod(since={6,6}) public boolean isCaseSensitive()
-
evaluateValue
@ThingworxExtensionApiMethod(since={6,6}) public boolean evaluateValue(IPrimitiveType iPrimitive)
- Specified by:
evaluateValue
in interfaceIFilter
-
evaluateFilter
@ThingworxExtensionApiMethod(since={6,6}) public boolean evaluateFilter(ValueCollection row)
- 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
-
-