Top Description Methods
org.jdom2.filter

public Interface Filter<T>

extends Serializable
Known Direct Implementers
org.jdom2.filter.AbstractFilter
Type Parameters
<T>
The Generic type of content returned by this Filter
Imports
java.util.List

A generalized filter to restrict visibility or mutability on a list.
Authors
Jools Enticknap, Bradley S. Huffman, Rolf Lear

Method Summary

Modifier and TypeMethod and Description
public Filter<T>

Returns:

a new Filter instance that returns the 'intersection' of this filter and the specified filter.
and
(Filter<?>
a second Filter to AND with.
filter
)

Creates an ANDing filter.

public List<T>

Returns:

a new read-only RandomAccess list of the filtered input content.
filter
(List<?>
The content to filter.
content
)

Filter the input list keeping only the items that match the Filter.

public T

Returns:

The content if it matches the filter, cast as this Filter's type.
filter
(Object
The content to test.
content
)

Check to see if the content matches this Filter.

public boolean

Returns:

true if the object matches a predfined set of rules.
matches
(Object
The object to verify.
content
)

Check to see if the object matches a predefined set of rules.

public Filter<? extends Object>

Returns:

a Filter that returns all content except what this Filter instance would.
negate
()

Creates an 'inverse' filter

public Filter<? extends Object>

Returns:

a new Filter instance that returns the 'union' of this filter and the specified filter.
or
(Filter<?>
a second Filter to OR with.
filter
)

Creates an ORing filter

public <
The Generic type of the returned data is taken from the input instance.
R
>
Filter<R>

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.
refine
(Filter<R>
The filter to refine our results with.
filter
)

This is similar to the and(Filter) method except the generic type is different.

Method Detail

andback to summary
public Filter<T> and(Filter<?> filter)

Creates an ANDing filter. The generic type of the result is the same as this Filter.

Parameters
filter:Filter<?>

a second Filter to AND with.

Returns:Filter<T>

a new Filter instance that returns the 'intersection' of this filter and the specified filter.

filterback to summary
public List<T> filter(List<?> content)

Filter the input list keeping only the items that match the Filter.

Parameters
content:List<?>

The content to filter.

Returns:List<T>

a new read-only RandomAccess list of the filtered input content.

filterback to summary
public T filter(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:Object

The content to test.

Returns:T

The content if it matches the filter, cast as this Filter's type.

matchesback to summary
public boolean matches(Object content)

Check to see if the object matches a predefined set of rules.

Parameters
content:Object

The object to verify.

Returns:boolean

true if the object matches a predfined set of rules.

negateback to summary
public Filter<? extends Object> negate()

Creates an 'inverse' filter

Returns:Filter<? extends Object>

a Filter that returns all content except what this Filter instance would.

orback to summary
public Filter<? extends Object> or(Filter<?> filter)

Creates an ORing filter

Parameters
filter:Filter<?>

a second Filter to OR with.

Returns:Filter<? extends Object>

a new Filter instance that returns the 'union' of this filter and the specified filter.

refineback to summary
public <R> Filter<R> refine(Filter<R> filter)

This is similar to the and(Filter) method except the generic type is different.

Parameters
<R>
The Generic type of the returned data is taken from the input instance.
filter:Filter<R>

The filter to refine our results with.

Returns:Filter<R>

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.