Top Description Fields Constructors Methods
net.sf.ehcache.search.expression

public Class ILike

extends BaseCriteria
Class Inheritance
Imports
java.util.Collections, .Map, .Set, java.util.regex.Pattern, net.sf.ehcache.Element, net.sf.ehcache.search.Attribute, .SearchException, net.sf.ehcache.search.attribute.AttributeExtractor

A regular expression criteria that matches attribute string values. For non java.lang.String attributes, the toString() form is used in the comparison.

Expressions are always case insensitive

The following special characters are supported:
The supported wildcard characters can be escaped with a backslash '\', and a literal backslash can be included with '\\'

WARN: Expressions starting with a leading wildcard character are potentially very expensive (ie. full scan) for indexed caches

Author
teck

Field Summary

Modifier and TypeField and Description
private final String
private final Pattern
private final String

Constructor Summary

AccessConstructor and Description
public
ILike(String
attribute name
attributeName
,
String
expression
regex
)

Construct a "like" criteria for the given expression

Method Summary

Modifier and TypeMethod and Description
private static Pattern
convertRegex(final String expr)

public boolean
execute(Element
cache element
e
,
Map<String, AttributeExtractor>
map of attribute extractors to attribute value names
attributeExtractors
)

Implements net.sf.ehcache.search.expression.Criteria.execute.

Test this criteria against a cache element
public String

Returns:

String attribute name
getAttributeName
()

Return attribute name.

public Set<Attribute<?>>
getAttributes()

Implements abstract net.sf.ehcache.search.expression.BaseCriteria.getAttributes.

Returns all search attributes referenced by this instance
public String

Returns:

String regex.
getRegex
()

Return regex string.

private static String
lowerCase(char ch)

Inherited from net.sf.ehcache.search.expression.BaseCriteria:
andgetExtractornotor

Field Detail

attributeNameback to summary
private final String attributeName
patternback to summary
private final Pattern pattern
regexback to summary
private final String regex

Constructor Detail

ILikeback to summary
public ILike(String attributeName, String regex)

Construct a "like" criteria for the given expression

Parameters
attributeName:String

attribute name

regex:String

expression

Method Detail

convertRegexback to summary
private static Pattern convertRegex(final String expr)
executeback to summary
public boolean execute(Element e, Map<String, AttributeExtractor> attributeExtractors)

Implements net.sf.ehcache.search.expression.Criteria.execute.

Doc from net.sf.ehcache.search.expression.Criteria.execute.

Test this criteria against a cache element

Parameters
e:Element

cache element

attributeExtractors:Map<String, AttributeExtractor>

map of attribute extractors to attribute value names

Returns:boolean

true if the criteria matches this element

getAttributeNameback to summary
public String getAttributeName()

Return attribute name.

Returns:String

String attribute name

getAttributesback to summary
public Set<Attribute<?>> getAttributes()

Implements abstract net.sf.ehcache.search.expression.BaseCriteria.getAttributes.

Doc from net.sf.ehcache.search.expression.BaseCriteria.getAttributes.

Returns all search attributes referenced by this instance

Annotations
@Override
getRegexback to summary
public String getRegex()

Return regex string.

Returns:String

String regex.

lowerCaseback to summary
private static String lowerCase(char ch)