java.lang.Object
org.codehaus.mojo.jaxb2.shared.filters.Filters

public final class Filters extends Object

Algorithm definitions for common operations using Filters.

SPI Note:This class/these methods should be replaced with stream operations when JDK8 is required to build/run this plugin.

Since:
2.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    adapt(List<Filter<File>> toAdapt)
    Adapts the supplied List of Filter specifications to a List of FileFilters.
    static FileFilter
    adapt(Filter<File> toAdapt)
    Adapts the Filter specification to the FileFilter interface, to enable immediate use for filtering File lists.
    static <T> void
    initialize(org.apache.maven.plugin.logging.Log log, List<Filter<T>> filters)
    Initializes the supplied Filters by assigning the given Log.
    static <T> void
    initialize(org.apache.maven.plugin.logging.Log log, Filter<T>... filters)
    Initializes the supplied Filters by assigning the given Log.
    static <T> boolean
    matchAtLeastOnce(T object, List<Filter<T>> filters)
    Algorithms for accepting the supplied object if at least one of the supplied Filters accepts it.
    static <T> boolean
    noFilterMatches(T object, List<Filter<T>> filters)
    Algorithms for rejecting the supplied object if at least one of the supplied Filters rejects it.
    static <T> boolean
    rejectAtLeastOnce(T object, List<Filter<T>> filters)
    Algorithms for rejecting the supplied object if at least one of the supplied Filters does not accept it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Filters

      public Filters()
  • Method Details

    • matchAtLeastOnce

      public static <T> boolean matchAtLeastOnce(T object, List<Filter<T>> filters)
      Algorithms for accepting the supplied object if at least one of the supplied Filters accepts it.
      Type Parameters:
      T - The Filter type.
      Parameters:
      object - The object to accept (or not).
      filters - The non-null list of Filters to examine the supplied object.
      Returns:
      true if at least one of the filters return true from its accept method.
      See Also:
    • rejectAtLeastOnce

      public static <T> boolean rejectAtLeastOnce(T object, List<Filter<T>> filters)
      Algorithms for rejecting the supplied object if at least one of the supplied Filters does not accept it.
      Type Parameters:
      T - The Filter type.
      Parameters:
      object - The object to reject (or not).
      filters - The non-null list of Filters to examine the supplied object.
      Returns:
      true if at least one of the filters returns false from its accept method.
      See Also:
    • noFilterMatches

      public static <T> boolean noFilterMatches(T object, List<Filter<T>> filters)
      Algorithms for rejecting the supplied object if at least one of the supplied Filters rejects it.
      Type Parameters:
      T - The Filter type.
      Parameters:
      object - The object to accept (or not).
      filters - The non-null list of Filters to examine the supplied object.
      Returns:
      true if at least one of the filters return false from its accept method.
      See Also:
    • adapt

      public static FileFilter adapt(Filter<File> toAdapt)
      Adapts the Filter specification to the FileFilter interface, to enable immediate use for filtering File lists.
      Parameters:
      toAdapt - The non-null Filter which should be adapted to a FileFilter interface.
      Returns:
      If the toAdapt instance already implements the FileFilter interface, simply return the toAdapt instance. Otherwise, returns a FileFilter interface which delegates its execution to the wrapped Filter.
    • adapt

      public static List<FileFilter> adapt(List<Filter<File>> toAdapt)
      Adapts the supplied List of Filter specifications to a List of FileFilters.
      Parameters:
      toAdapt - The List of Filters to adapts.
      Returns:
      A List holding FileFilter instances. If toAdapt is null or empty, an empty list is returned from this method. Thus, this method will never return a null value.
    • initialize

      public static <T> void initialize(org.apache.maven.plugin.logging.Log log, List<Filter<T>> filters)
      Initializes the supplied Filters by assigning the given Log.
      Type Parameters:
      T - The Filter type.
      Parameters:
      log - The active Maven Log.
      filters - The List of Filters to initialize.
    • initialize

      public static <T> void initialize(org.apache.maven.plugin.logging.Log log, Filter<T>... filters)
      Initializes the supplied Filters by assigning the given Log.
      Type Parameters:
      T - The Filter type.
      Parameters:
      log - The active Maven Log.
      filters - The List of Filters to initialize.