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.Builderbuilder()Creates a builder forJWFileItem.static JWFileItemcopyOf(JWFileItemType instance) Creates an immutable copy of aJWFileItemTypevalue.booleanThis instance is equal to all instances ofJWFileItemthat have equal attribute values.inthashCode()Computes a hash code from attributes:kind,path,size,modifiedTime,displayName.kind()path()longsize()toString()Prints the immutable valueJWFileItemwith attribute values.final JWFileItemwithDisplayName(String value) Copy the current immutable object by setting a present value for the optionaldisplayNameattribute.final JWFileItemwithDisplayName(Optional<String> optional) Copy the current immutable object by setting an optional value for thedisplayNameattribute.final JWFileItemwithKind(JWFileKind value) Copy the current immutable object by setting a value for thekindattribute.final JWFileItemwithModifiedTime(FileTime value) Copy the current immutable object by setting a value for themodifiedTimeattribute.final JWFileItemCopy the current immutable object by setting a value for thepathattribute.final JWFileItemwithSize(long value) Copy the current immutable object by setting a value for thesizeattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.jwheatsheaf.ui.internal.JWFileItemType
name
-
Method Details
-
kind
- Specified by:
kindin interfaceJWFileItemType- Returns:
- The file kind
-
path
- Specified by:
pathin interfaceJWFileItemType- Returns:
- The file path
-
size
public long size()- Specified by:
sizein interfaceJWFileItemType- Returns:
- The file size
-
modifiedTime
- Specified by:
modifiedTimein interfaceJWFileItemType- Returns:
- The file modification time
-
displayName
- Specified by:
displayNamein interfaceJWFileItemType- Returns:
- The file display name override, if any
-
withKind
Copy the current immutable object by setting a value for thekindattribute. 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
thisobject
-
withPath
Copy the current immutable object by setting a value for thepathattribute. 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
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
-
withModifiedTime
Copy the current immutable object by setting a value for themodifiedTimeattribute. 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
thisobject
-
withDisplayName
Copy the current immutable object by setting a present value for the optionaldisplayNameattribute.- Parameters:
value- The value for displayName- Returns:
- A modified copy of
thisobject
-
withDisplayName
Copy the current immutable object by setting an optional value for thedisplayNameattribute. 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
thisobject
-
equals
This instance is equal to all instances ofJWFileItemthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:kind,path,size,modifiedTime,displayName. -
toString
Prints the immutable valueJWFileItemwith attribute values. -
copyOf
Creates an immutable copy of aJWFileItemTypevalue. 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) // requiredkind.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
-