Package com.vaadin.data.util.filter
Class Compare
- java.lang.Object
-
- com.vaadin.data.util.filter.Compare
-
- All Implemented Interfaces:
Container.Filter,Serializable
- Direct Known Subclasses:
Compare.Equal,Compare.Greater,Compare.GreaterOrEqual,Compare.Less,Compare.LessOrEqual
public abstract class Compare extends Object implements Container.Filter
Simple container filter comparing an item property value against a given constant value. Use the nested classesCompare.Equal,Compare.Greater,Compare.Less,Compare.GreaterOrEqualandCompare.LessOrEqualinstead of this class directly. This filter also directly supports in-memory filtering. The reference and actual values must implementComparableand the class of the actual property value must be assignable from the class of the reference value.- Since:
- 6.6
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompare.EqualAComparefilter that accepts items for which the identified property value is equal tovalue.static classCompare.GreaterAComparefilter that accepts items for which the identified property value is greater thanvalue.static classCompare.GreaterOrEqualAComparefilter that accepts items for which the identified property value is greater than or equal tovalue.static classCompare.LessAComparefilter that accepts items for which the identified property value is less thanvalue.static classCompare.LessOrEqualAComparefilter that accepts items for which the identified property value is less than or equal tovalue.static classCompare.Operation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanappliesToProperty(Object propertyId)Check if a change in the value of a property can affect the filtering result.protected intcompareValue(Object value1)booleanequals(Object obj)Compare.OperationgetOperation()Returns the comparison operation.ObjectgetPropertyId()Returns the property id of the property to compare against the fixed value.ObjectgetValue()Returns the value to compare the property against.inthashCode()booleanpassesFilter(Object itemId, Item item)Check if an item passes the filter (in-memory filtering).
-
-
-
Method Detail
-
passesFilter
public boolean passesFilter(Object itemId, Item item)
Description copied from interface:Container.FilterCheck if an item passes the filter (in-memory filtering).- Specified by:
passesFilterin interfaceContainer.Filter- Parameters:
itemId- identifier of the item being filtered; may be null when the item is being added to the containeritem- the item being filtered- Returns:
- true if the item is accepted by this filter
-
compareValue
protected int compareValue(Object value1)
-
appliesToProperty
public boolean appliesToProperty(Object propertyId)
Description copied from interface:Container.FilterCheck if a change in the value of a property can affect the filtering result. May always return true, at the cost of performance. If the filter cannot determine whether it may depend on the property or not, should return true.- Specified by:
appliesToPropertyin interfaceContainer.Filter- Returns:
- true if the filtering result may/does change based on changes to the property identified by propertyId
-
getPropertyId
public Object getPropertyId()
Returns the property id of the property to compare against the fixed value.- Returns:
- property id (not null)
-
getOperation
public Compare.Operation getOperation()
Returns the comparison operation.- Returns:
Compare.Operation
-
getValue
public Object getValue()
Returns the value to compare the property against.- Returns:
- comparison reference value
-
-