Package com.io7m.jwheatsheaf.ui.internal
Class JWFileItem.Builder
java.lang.Object
com.io7m.jwheatsheaf.ui.internal.JWFileItem.Builder
- Enclosing class:
- JWFileItem
public static final class JWFileItem.Builder
extends java.lang.Object
Builds instances of type
JWFileItem
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and Type Method Description JWFileItem
build()
Builds a newJWFileItem
.JWFileItem.Builder
from(JWFileItemType instance)
Fill a builder with attribute values from the providedJWFileItemType
instance.JWFileItem.Builder
setDisplayName(java.lang.String displayName)
Initializes the optional valuedisplayName
to displayName.JWFileItem.Builder
setDisplayName(java.util.Optional<java.lang.String> displayName)
Initializes the optional valuedisplayName
to displayName.JWFileItem.Builder
setKind(JWFileKind kind)
Initializes the value for thekind
attribute.JWFileItem.Builder
setModifiedTime(java.nio.file.attribute.FileTime modifiedTime)
Initializes the value for themodifiedTime
attribute.JWFileItem.Builder
setPath(java.nio.file.Path path)
Initializes the value for thepath
attribute.JWFileItem.Builder
setSize(long size)
Initializes the value for thesize
attribute.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
from
Fill a builder with attribute values from the providedJWFileItemType
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
setKind
Initializes the value for thekind
attribute.- Parameters:
kind
- The value for kind- Returns:
this
builder for use in a chained invocation
-
setPath
Initializes the value for thepath
attribute.- Parameters:
path
- The value for path- Returns:
this
builder for use in a chained invocation
-
setSize
Initializes the value for thesize
attribute.- Parameters:
size
- The value for size- Returns:
this
builder for use in a chained invocation
-
setModifiedTime
Initializes the value for themodifiedTime
attribute.- Parameters:
modifiedTime
- The value for modifiedTime- Returns:
this
builder for use in a chained invocation
-
setDisplayName
Initializes the optional valuedisplayName
to displayName.- Parameters:
displayName
- The value for displayName- Returns:
this
builder for chained invocation
-
setDisplayName
Initializes the optional valuedisplayName
to displayName.- Parameters:
displayName
- The value for displayName- Returns:
this
builder for use in a chained invocation
-
build
Builds a newJWFileItem
.- Returns:
- An immutable instance of JWFileItem
- Throws:
java.lang.IllegalStateException
- if any required attributes are missing
-