Class AbstractFilter<T>

java.lang.Object
org.jdom2.filter.AbstractFilter<T>
Type Parameters:
T - The Generic type of content returned by this Filter
All Implemented Interfaces:
Serializable, Filter<T>
Direct Known Subclasses:
AttributeFilter, ContentFilter, ElementFilter

public abstract class AbstractFilter<T> extends Object implements Filter<T>
Partial implementation of Filter.
Author:
Bradley S. Huffman, Rolf Lear
See Also:
  • Constructor Details

    • AbstractFilter

      public AbstractFilter()
  • Method Details

    • matches

      public final boolean matches(Object content)
      Description copied from interface: Filter
      Check to see if the object matches a predefined set of rules.
      Specified by:
      matches in interface Filter<T>
      Parameters:
      content - The object to verify.
      Returns:
      true if the object matches a predfined set of rules.
    • filter

      public List<T> filter(List<?> content)
      Description copied from interface: Filter
      Filter the input list keeping only the items that match the Filter.
      Specified by:
      filter in interface Filter<T>
      Parameters:
      content - The content to filter.
      Returns:
      a new read-only RandomAccess list of the filtered input content.
    • negate

      public final Filter<?> negate()
      Description copied from interface: Filter
      Creates an 'inverse' filter
      Specified by:
      negate in interface Filter<T>
      Returns:
      a Filter that returns all content except what this Filter instance would.
    • or

      public final Filter<? extends Content> or(Filter<?> filter)
      Description copied from interface: Filter
      Creates an ORing filter
      Specified by:
      or in interface Filter<T>
      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

      public final Filter<T> and(Filter<?> filter)
      Description copied from interface: Filter
      Creates an ANDing filter. The generic type of the result is the same as this Filter.
      Specified by:
      and in interface Filter<T>
      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

      public <R> Filter<R> refine(Filter<R> filter)
      Description copied from interface: Filter
      This is similar to the and(Filter) method except the generic type is different.
      Specified by:
      refine in interface Filter<T>
      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.