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 class
ASFile.Builder
Builds instances of typeASFile
. -
Method Summary
Modifier and Type Method Description static ASFile.Builder
builder()
Creates a builder forASFile
.static ASFile
copyOf(ASFileType instance)
Creates an immutable copy of aASFileType
value.java.lang.String
directory()
boolean
equals(java.lang.Object another)
This instance is equal to all instances ofASFile
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 valueASFile
with attribute values.ASFile
withDirectory(java.lang.String value)
Copy the current immutable object by setting a value for thedirectory
attribute.ASFile
withName(java.lang.String value)
Copy the current immutable object by setting a value for thename
attribute.ASFile
withSize(long value)
Copy the current immutable object by setting a value for thesize
attribute.
-
Method Details
-
directory
public java.lang.String directory()- Specified by:
directory
in interfaceASFileType
- Returns:
- The directory name
-
name
public java.lang.String name()- Specified by:
name
in interfaceASFileType
- Returns:
- The file name
-
size
public long size()- Specified by:
size
in interfaceASFileType
- Returns:
- The file size
-
withDirectory
Copy the current immutable object by setting a value for thedirectory
attribute. 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
this
object
-
withName
Copy the current immutable object by setting a value for thename
attribute. 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
this
object
-
withSize
Copy the current immutable object by setting a value for thesize
attribute. 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
this
object
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofASFile
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()Computes a hash code from attributes:directory
,name
,size
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueASFile
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aASFileType
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
Creates a builder forASFile
.ASFile.builder() .setDirectory(String) // required
directory
.setName(String) // requiredname
.setSize(long) // requiredsize
.build();- Returns:
- A new ASFile builder
-