Class SimpleStringFilter
java.lang.Object
com.vaadin.featurepack.data.util.filter.SimpleStringFilter
- All Implemented Interfaces:
Container.Filter,Serializable
Simple string filter for matching items that start with or contain a
specified string. The matching can be case-sensitive or case-insensitive.
This filter also directly supports in-memory filtering. When performing
in-memory filtering, values of other types are converted using toString(),
but other (lazy container) implementations do not need to perform such
conversions and might not support values of different types.
Note that this filter is modeled after the pre-6.6 filtering mechanisms, and
might not be very efficient e.g. for database filtering.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleStringFilter(Object propertyId, String filterString, boolean ignoreCase, boolean onlyMatchPrefix) -
Method Summary
Modifier and TypeMethodDescriptionbooleanappliesToProperty(Object propertyId) Check if a change in the value of a property can affect the filtering result.booleanReturns the filter string.Returns the property identifier to which this filter applies.inthashCode()booleanReturns whether the filter is case-insensitive or case-sensitive.booleanReturns true if the filter only applies to the beginning of the value string, false for any location in the value.booleanpassesFilter(Object itemId, Item item) Check if an item passes the filter (in-memory filtering).
-
Constructor Details
-
SimpleStringFilter
-
-
Method Details
-
passesFilter
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
-
appliesToProperty
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- Parameters:
propertyId-- Returns:
- true if the filtering result may/does change based on changes to the property identified by propertyId
-
equals
-
hashCode
public int hashCode() -
getPropertyId
Returns the property identifier to which this filter applies.- Returns:
- property id
-
getFilterString
Returns the filter string. Note: this method is intended only for implementations of lazy string filters and may change in the future.- Returns:
- filter string given to the constructor
-
isIgnoreCase
public boolean isIgnoreCase()Returns whether the filter is case-insensitive or case-sensitive. Note: this method is intended only for implementations of lazy string filters and may change in the future.- Returns:
- true if performing case-insensitive filtering, false for case-sensitive
-
isOnlyMatchPrefix
public boolean isOnlyMatchPrefix()Returns true if the filter only applies to the beginning of the value string, false for any location in the value. Note: this method is intended only for implementations of lazy string filters and may change in the future.- Returns:
- true if checking for matches at the beginning of the value only, false if matching any part of value
-