JIDE 3.5.15

com.jidesoft.filter
Class EqualFilter<T>

java.lang.Object
  extended by com.jidesoft.filter.AbstractFilter<T>
      extended by com.jidesoft.filter.EqualFilter<T>
All Implemented Interfaces:
Filter<T>, ObjectGrouperSupport, SqlFilterSupport, Serializable, Cloneable
Direct Known Subclasses:
GreaterOrEqualFilter, GreaterThanFilter, LessOrEqualFilter, LessThanFilter, NotEqualFilter

public class EqualFilter<T>
extends AbstractFilter<T>
implements SqlFilterSupport

A Filter returns false in isValueFiltered(Object) only if the input value equals the specified value.

See Also:
Serialized Form

Field Summary
protected  T _value
           
 
Fields inherited from interface com.jidesoft.filter.Filter
ALL, CUSTOM, NULL, SEPARATOR
 
Constructor Summary
EqualFilter()
          Creates an EqualFilter.
EqualFilter(String name, T value)
          Creates an EqualFilter.
EqualFilter(T value)
          Creates an EqualFilter.
 
Method Summary
 boolean equals(Object obj)
           
 String getName()
          Gets the name of the filter.
 String getOperator()
           
 String getPreference(Class<?> clazz, ConverterContext converterContext)
          Gets the preference while persisting this filter.
 T getValue()
          Sets the only allowed value.
 boolean isValueFiltered(T value)
          Checks if the value is allowed.
 Object[] setPreference(String prefString, Class<?> clazz, ConverterContext converterContext)
          Sets the preference to load the preference string back to this filter.
 void setValue(T value)
          Sets the value.
 boolean stricterThan(Filter inputFilter)
          Check if this filter is stricter than the input filter while the two filters are with the same class.
 
Methods inherited from class com.jidesoft.filter.AbstractFilter
addFilterListener, clone, fireFilterChanged, fireFilterContentChanged, fireFilterDisabled, fireFilterEnabled, fireFilterNameChanged, getConditionString, getFilterFactory, getFilterFactoryName, getFilterListeners, 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
 

Field Detail

_value

protected T _value
Constructor Detail

EqualFilter

public EqualFilter()
Creates an EqualFilter.


EqualFilter

public EqualFilter(T value)
Creates an EqualFilter.

Parameters:
value - the value that will not be filtered

EqualFilter

public EqualFilter(String name,
                   T value)
Creates an EqualFilter.

Parameters:
name - name of the filter
value - the value that will not be filtered
Method Detail

isValueFiltered

public boolean isValueFiltered(T value)
Checks if the value is allowed.

Specified by:
isValueFiltered in interface Filter<T>
Parameters:
value - the value to check.
Returns:
true if not allowed and false if allowed. Please note, this could be the opposite of what you thought as the method name is if the value is filtered.

setValue

public void setValue(T value)
Sets the value.

Parameters:
value - the new value.

getValue

public T getValue()
Sets the only allowed value.

Returns:
the only allowed value.

getOperator

public String getOperator()
Specified by:
getOperator in interface SqlFilterSupport

getName

public String getName()
Description copied from interface: Filter
Gets the name of the filter.

Specified by:
getName in interface Filter<T>
Overrides:
getName in class AbstractFilter<T>
Returns:
the name of the filter.

stricterThan

public boolean stricterThan(Filter inputFilter)
Check if this filter is stricter than the input filter while the two filters are with the same class.

Specified by:
stricterThan in interface Filter<T>
Overrides:
stricterThan in class AbstractFilter<T>
Parameters:
inputFilter - the input filter
Returns:
true if the value of the two filters are equal. Otherwise false.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getPreference

public String getPreference(Class<?> clazz,
                            ConverterContext converterContext)
Description copied from interface: Filter
Gets the preference while persisting this filter.

Specified by:
getPreference in interface Filter<T>
Overrides:
getPreference in class AbstractFilter<T>
Parameters:
clazz - the class type to convert the values inside the filter to string
converterContext - the converter context to convert the values inside the filter to string
Returns:
the preference string.

setPreference

public Object[] setPreference(String prefString,
                              Class<?> clazz,
                              ConverterContext converterContext)
Description copied from interface: Filter
Sets the preference to load the preference string back to this filter.

Specified by:
setPreference in interface Filter<T>
Overrides:
setPreference in class AbstractFilter<T>
Parameters:
prefString - the preference string
clazz - the class type to convert the values inside the filter to string
converterContext - the converter context to convert the values inside the filter to string
Returns:
the object array to be passed into the FilterFactoryManager if necessary.

JIDE 3.5.15