Class ASFile
java.lang.Object
com.io7m.coffeepick.shipilev_net.internal.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 classASFile.BuilderBuilds instances of typeASFile. -
Method Summary
Modifier and Type Method Description static ASFile.Builderbuilder()Creates a builder forASFile.static ASFilecopyOf(ASFileType instance)Creates an immutable copy of aASFileTypevalue.java.lang.Stringdirectory()booleanequals(java.lang.Object another)This instance is equal to all instances ofASFilethat have equal attribute values.inthashCode()Computes a hash code from attributes:directory,name,size.java.lang.Stringname()longsize()java.lang.StringtoString()Prints the immutable valueASFilewith attribute values.ASFilewithDirectory(java.lang.String value)Copy the current immutable object by setting a value for thedirectoryattribute.ASFilewithName(java.lang.String value)Copy the current immutable object by setting a value for thenameattribute.ASFilewithSize(long value)Copy the current immutable object by setting a value for thesizeattribute.
-
Method Details
-
directory
public java.lang.String directory()- Specified by:
directoryin interfaceASFileType- Returns:
- The directory name
-
name
public java.lang.String name()- Specified by:
namein interfaceASFileType- Returns:
- The file name
-
size
public long size()- Specified by:
sizein interfaceASFileType- Returns:
- The file size
-
withDirectory
Copy the current immutable object by setting a value for thedirectoryattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for directory- Returns:
- A modified copy of the
thisobject
-
withName
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withSize
Copy the current immutable object by setting a value for thesizeattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for size- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofASFilethat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:directory,name,size.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueASFilewith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aASFileTypevalue. 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
Creates a builder forASFile.ASFile.builder() .setDirectory(String) // requireddirectory.setName(String) // requiredname.setSize(long) // requiredsize.build();- Returns:
- A new ASFile builder
-