Package com.io7m.jwheatsheaf.ui.internal
Class JWFileItem
java.lang.Object
com.io7m.jwheatsheaf.ui.internal.JWFileItem
- All Implemented Interfaces:
JWFileItemType
A resolved file item.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic JWFileItem.Builder
builder()
Creates a builder forJWFileItem
.static JWFileItem
copyOf
(JWFileItemType instance) Creates an immutable copy of aJWFileItemType
value.boolean
This instance is equal to all instances ofJWFileItem
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:kind
,path
,size
,modifiedTime
,displayName
.kind()
path()
long
size()
toString()
Prints the immutable valueJWFileItem
with attribute values.final JWFileItem
withDisplayName
(String value) Copy the current immutable object by setting a present value for the optionaldisplayName
attribute.final JWFileItem
withDisplayName
(Optional<String> optional) Copy the current immutable object by setting an optional value for thedisplayName
attribute.final JWFileItem
withKind
(JWFileKind value) Copy the current immutable object by setting a value for thekind
attribute.final JWFileItem
withModifiedTime
(FileTime value) Copy the current immutable object by setting a value for themodifiedTime
attribute.final JWFileItem
Copy the current immutable object by setting a value for thepath
attribute.final JWFileItem
withSize
(long value) Copy the current immutable object by setting a value for thesize
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.io7m.jwheatsheaf.ui.internal.JWFileItemType
name
-
Method Details
-
kind
- Specified by:
kind
in interfaceJWFileItemType
- Returns:
- The file kind
-
path
- Specified by:
path
in interfaceJWFileItemType
- Returns:
- The file path
-
size
public long size()- Specified by:
size
in interfaceJWFileItemType
- Returns:
- The file size
-
modifiedTime
- Specified by:
modifiedTime
in interfaceJWFileItemType
- Returns:
- The file modification time
-
displayName
- Specified by:
displayName
in interfaceJWFileItemType
- Returns:
- The file display name override, if any
-
withKind
Copy the current immutable object by setting a value for thekind
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for kind- Returns:
- A modified copy of the
this
object
-
withPath
Copy the current immutable object by setting a value for thepath
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for path- 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
-
withModifiedTime
Copy the current immutable object by setting a value for themodifiedTime
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for modifiedTime- Returns:
- A modified copy of the
this
object
-
withDisplayName
Copy the current immutable object by setting a present value for the optionaldisplayName
attribute.- Parameters:
value
- The value for displayName- Returns:
- A modified copy of
this
object
-
withDisplayName
Copy the current immutable object by setting an optional value for thedisplayName
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for displayName- Returns:
- A modified copy of
this
object
-
equals
This instance is equal to all instances ofJWFileItem
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:kind
,path
,size
,modifiedTime
,displayName
. -
toString
Prints the immutable valueJWFileItem
with attribute values. -
copyOf
Creates an immutable copy of aJWFileItemType
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 JWFileItem instance
-
builder
Creates a builder forJWFileItem
.JWFileItem.builder() .setKind(com.io7m.jwheatsheaf.api.JWFileKind) // required
kind
.setPath(java.nio.file.Path) // requiredpath
.setSize(long) // requiredsize
.setModifiedTime(java.nio.file.attribute.FileTime) // requiredmodifiedTime
.setDisplayName(String) // optionaldisplayName
.build();- Returns:
- A new JWFileItem builder
-