Class ASFile

  • All Implemented Interfaces:
    ASFileType, java.lang.Comparable<ASFileType>

    public final class ASFile
    extends java.lang.Object
    implements ASFileType
    A file name and size.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ASFile.Builder
      Builds instances of type ASFile.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ASFile.Builder builder()
      Creates a builder for ASFile.
      static ASFile copyOf​(ASFileType instance)
      Creates an immutable copy of a ASFileType value.
      java.lang.String directory()  
      boolean equals​(java.lang.Object another)
      This instance is equal to all instances of ASFile that have equal attribute values.
      int hashCode()
      Computes a hash code from attributes: directory, name, size.
      java.lang.String name()  
      long size()  
      java.lang.String toString()
      Prints the immutable value ASFile with attribute values.
      ASFile withDirectory​(java.lang.String value)
      Copy the current immutable object by setting a value for the directory attribute.
      ASFile withName​(java.lang.String value)
      Copy the current immutable object by setting a value for the name attribute.
      ASFile withSize​(long value)
      Copy the current immutable object by setting a value for the size attribute.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • directory

        public java.lang.String directory()
        Specified by:
        directory in interface ASFileType
        Returns:
        The directory name
      • name

        public java.lang.String name()
        Specified by:
        name in interface ASFileType
        Returns:
        The file name
      • size

        public long size()
        Specified by:
        size in interface ASFileType
        Returns:
        The file size
      • withDirectory

        public final ASFile withDirectory​(java.lang.String value)
        Copy the current immutable object by setting a value for the directory attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for directory
        Returns:
        A modified copy of the this object
      • withName

        public final ASFile withName​(java.lang.String value)
        Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for name
        Returns:
        A modified copy of the this object
      • withSize

        public final ASFile withSize​(long value)
        Copy the current immutable object by setting a value for the size attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for size
        Returns:
        A modified copy of the this object
      • equals

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

        public int hashCode()
        Computes a hash code from attributes: directory, name, size.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

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

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

        public static ASFile.Builder builder()
        Creates a builder for ASFile.
         ASFile.builder()
            .setDirectory(String) // required directory
            .setName(String) // required name
            .setSize(long) // required size
            .build();
         
        Returns:
        A new ASFile builder