JIDE 3.5.15

com.jidesoft.filter
Class LikeFilter<T>

java.lang.Object
  extended by com.jidesoft.filter.AbstractFilter<T>
      extended by com.jidesoft.filter.RegexFilter<T>
          extended by com.jidesoft.filter.LikeFilter<T>
All Implemented Interfaces:
Filter<T>, ObjectGrouperSupport, SqlFilterSupport, Serializable, Cloneable
Direct Known Subclasses:
NotLikeFilter

public class LikeFilter<T>
extends RegexFilter<T>
implements SqlFilterSupport

A filter implements filtering a string based the LIKE condition as in SQL. The pattern is specified in the constructor. The patterns that you can choose from are: '%' allows you to match any string of any length (including zero length) and '_' allows you to match on a single character.

Please note, in Oracle, the SQL supports defining escape character but this is not supported in this LikeFilter. However if you need, you can override convertFromPatternToRegex to convert your own regular expression based on the input pattern.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jidesoft.filter.RegexFilter
_beginWith, _regex
 
Fields inherited from interface com.jidesoft.filter.Filter
ALL, CUSTOM, NULL, SEPARATOR
 
Constructor Summary
LikeFilter()
           
LikeFilter(String pattern)
           
 
Method Summary
protected  String convertFromPatternToRegex(String pattern)
          Converts the SQL Like compatible pattern to the pattern used in Java Pattern class.
 boolean equals(Object obj)
           
 String getOperator()
          Gets the operator.
 
Methods inherited from class com.jidesoft.filter.RegexFilter
convertElementToString, createRegexPattern, getPattern, getPreference, isBeginWith, isCaseSensitive, isEndWith, isValueFiltered, setBeginWith, setCaseSensitive, setEndWith, setPattern, setPreference, stricterThan
 
Methods inherited from class com.jidesoft.filter.AbstractFilter
addFilterListener, clone, fireFilterChanged, fireFilterContentChanged, fireFilterDisabled, fireFilterEnabled, fireFilterNameChanged, getConditionString, getFilterFactory, getFilterFactoryName, getFilterListeners, getName, getObjectGrouper, getObjectGrouperName, isEnabled, isFilterValid, removeFilterListener, setEnabled, setFilterFactory, setFilterFactoryName, setName, setObjectGrouper, setObjectGrouperName
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LikeFilter

public LikeFilter()

LikeFilter

public LikeFilter(String pattern)
Method Detail

convertFromPatternToRegex

protected String convertFromPatternToRegex(String pattern)
Converts the SQL Like compatible pattern to the pattern used in Java Pattern class.

Overrides:
convertFromPatternToRegex in class RegexFilter<T>
Parameters:
pattern - the input pattern.
Returns:
the pattern string used by Pattern.

getOperator

public String getOperator()
Gets the operator. It will return " LIKE " by default.

Specified by:
getOperator in interface SqlFilterSupport
Returns:
the operator.

equals

public boolean equals(Object obj)
Overrides:
equals in class RegexFilter<T>

JIDE 3.5.15