Package com.io7m.jwheatsheaf.ui.internal
Class JWFileItem.Builder
java.lang.Object
com.io7m.jwheatsheaf.ui.internal.JWFileItem.Builder
- Enclosing class:
- JWFileItem
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 TypeMethodDescriptionbuild()Builds a newJWFileItem.final JWFileItem.Builderfrom(JWFileItemType instance) Fill a builder with attribute values from the providedJWFileItemTypeinstance.final JWFileItem.BuildersetDisplayName(String displayName) Initializes the optional valuedisplayNameto displayName.final JWFileItem.BuildersetDisplayName(Optional<String> displayName) Initializes the optional valuedisplayNameto displayName.final JWFileItem.BuildersetKind(JWFileKind kind) Initializes the value for thekindattribute.final JWFileItem.BuildersetModifiedTime(FileTime modifiedTime) Initializes the value for themodifiedTimeattribute.final JWFileItem.BuilderInitializes the value for thepathattribute.final JWFileItem.BuildersetSize(long size) Initializes the value for thesizeattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedJWFileItemTypeinstance. 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:
thisbuilder for use in a chained invocation
-
setKind
Initializes the value for thekindattribute.- Parameters:
kind- The value for kind- Returns:
thisbuilder for use in a chained invocation
-
setPath
Initializes the value for thepathattribute.- Parameters:
path- The value for path- Returns:
thisbuilder for use in a chained invocation
-
setSize
Initializes the value for thesizeattribute.- Parameters:
size- The value for size- Returns:
thisbuilder for use in a chained invocation
-
setModifiedTime
Initializes the value for themodifiedTimeattribute.- Parameters:
modifiedTime- The value for modifiedTime- Returns:
thisbuilder for use in a chained invocation
-
setDisplayName
Initializes the optional valuedisplayNameto displayName.- Parameters:
displayName- The value for displayName- Returns:
thisbuilder for chained invocation
-
setDisplayName
Initializes the optional valuedisplayNameto displayName.- Parameters:
displayName- The value for displayName- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newJWFileItem.- Returns:
- An immutable instance of JWFileItem
- Throws:
IllegalStateException- if any required attributes are missing
-