Class MFileFilter

java.lang.Object
com.io7m.montarre.api.MFileFilter
All Implemented Interfaces:
MFileFilterType

public final class MFileFilter extends Object implements MFileFilterType

A file filter.

If a file is matched by at least one inclusion filter, and not matched by any exclusion filter, then the file will be treated as included.

  • Method Details

    • includes

      public List<Pattern> includes()
      Specified by:
      includes in interface MFileFilterType
      Returns:
      The filename inclusion patterns
    • excludes

      public List<Pattern> excludes()
      Specified by:
      excludes in interface MFileFilterType
      Returns:
      The filename exclusion patterns
    • withIncludes

      public final MFileFilter withIncludes(Pattern... elements)
      Copy the current immutable object with elements that replace the content of includes.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withIncludes

      public final MFileFilter withIncludes(Iterable<? extends Pattern> elements)
      Copy the current immutable object with elements that replace the content of includes. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of includes elements to set
      Returns:
      A modified copy of this object
    • withExcludes

      public final MFileFilter withExcludes(Pattern... elements)
      Copy the current immutable object with elements that replace the content of excludes.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withExcludes

      public final MFileFilter withExcludes(Iterable<? extends Pattern> elements)
      Copy the current immutable object with elements that replace the content of excludes. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of excludes elements to set
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of MFileFilter that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: includes, excludes.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value MFileFilter with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static MFileFilter copyOf(MFileFilterType instance)
      Creates an immutable copy of a MFileFilterType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable MFileFilter instance
    • builder

      public static MFileFilter.Builder builder()
      Creates a builder for MFileFilter.
       MFileFilter.builder()
          .addIncludes|addAllIncludes(regex.Pattern) // includes elements
          .addExcludes|addAllExcludes(regex.Pattern) // excludes elements
          .build();
       
      Returns:
      A new MFileFilter builder