Class MPlatformFileFilter

java.lang.Object
com.io7m.montarre.api.MPlatformFileFilter
All Implemented Interfaces:
MPlatformFileFilterType

public final class MPlatformFileFilter extends Object implements MPlatformFileFilterType

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 belonging to the given architecture and operating system.

  • Method Details

    • architecture

      public MArchitectureName architecture()
      Specified by:
      architecture in interface MPlatformFileFilterType
      Returns:
      The architecture
    • operatingSystem

      public MOperatingSystemName operatingSystem()
      Specified by:
      operatingSystem in interface MPlatformFileFilterType
      Returns:
      The operating system
    • includes

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

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

      public final MPlatformFileFilter withArchitecture(MArchitectureName value)
      Copy the current immutable object by setting a value for the architecture attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for architecture
      Returns:
      A modified copy of the this object
    • withOperatingSystem

      public final MPlatformFileFilter withOperatingSystem(MOperatingSystemName value)
      Copy the current immutable object by setting a value for the operatingSystem attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for operatingSystem
      Returns:
      A modified copy of the this object
    • withIncludes

      public final MPlatformFileFilter 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 MPlatformFileFilter 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 MPlatformFileFilter 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 MPlatformFileFilter 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 MPlatformFileFilter 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: architecture, operatingSystem, includes, excludes.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static MPlatformFileFilter copyOf(MPlatformFileFilterType instance)
      Creates an immutable copy of a MPlatformFileFilterType 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 MPlatformFileFilter instance
    • builder

      public static MPlatformFileFilter.Builder builder()
      Creates a builder for MPlatformFileFilter.
       MPlatformFileFilter.builder()
          .setArchitecture(com.io7m.montarre.api.MArchitectureName) // required architecture
          .setOperatingSystem(com.io7m.montarre.api.MOperatingSystemName) // required operatingSystem
          .addIncludes|addAllIncludes(regex.Pattern) // includes elements
          .addExcludes|addAllExcludes(regex.Pattern) // excludes elements
          .build();
       
      Returns:
      A new MPlatformFileFilter builder