Package org.jdom2.filter
Interface Filter<T>
-
- Type Parameters:
T
- The Generic type of content returned by this Filter
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
AbstractFilter
,AttributeFilter
,ContentFilter
,ElementFilter
public interface Filter<T> extends java.io.Serializable
A generalized filter to restrict visibility or mutability on a list.- Author:
- Jools Enticknap, Bradley S. Huffman, Rolf Lear
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Filter<T>
and(Filter<?> filter)
Creates an ANDing filter.T
filter(java.lang.Object content)
Check to see if the content matches this Filter.java.util.List<T>
filter(java.util.List<?> content)
Filter the input list keeping only the items that match the Filter.boolean
matches(java.lang.Object content)
Check to see if the object matches a predefined set of rules.Filter<? extends java.lang.Object>
negate()
Creates an 'inverse' filterFilter<? extends java.lang.Object>
or(Filter<?> filter)
Creates an ORing filter<R> Filter<R>
refine(Filter<R> filter)
This is similar to the and(Filter) method except the generic type is different.
-
-
-
Method Detail
-
filter
java.util.List<T> filter(java.util.List<?> content)
Filter the input list keeping only the items that match the Filter.- Parameters:
content
- The content to filter.- Returns:
- a new read-only RandomAccess list of the filtered input content.
-
filter
T filter(java.lang.Object content)
Check to see if the content matches this Filter. If it does, return the content cast as this filter's return type, otherwise return null.- Parameters:
content
- The content to test.- Returns:
- The content if it matches the filter, cast as this Filter's type.
-
matches
boolean matches(java.lang.Object content)
Check to see if the object matches a predefined set of rules.- Parameters:
content
- The object to verify.- Returns:
true
if the object matches a predfined set of rules.
-
negate
Filter<? extends java.lang.Object> negate()
Creates an 'inverse' filter- Returns:
- a Filter that returns all content except what this Filter instance would.
-
or
Filter<? extends java.lang.Object> or(Filter<?> filter)
Creates an ORing filter- Parameters:
filter
- a second Filter to OR with.- Returns:
- a new Filter instance that returns the 'union' of this filter and the specified filter.
-
and
Filter<T> and(Filter<?> filter)
Creates an ANDing filter. The generic type of the result is the same as this Filter.- Parameters:
filter
- a second Filter to AND with.- Returns:
- a new Filter instance that returns the 'intersection' of this filter and the specified filter.
-
refine
<R> Filter<R> refine(Filter<R> filter)
This is similar to the and(Filter) method except the generic type is different.- Type Parameters:
R
- The Generic type of the returned data is taken from the input instance.- Parameters:
filter
- The filter to refine our results with.- Returns:
- A Filter that requires content to both match our instance and the refining instance, but the generic type of the returned data is based on the refining instance, not this instance.
-
-