Class JWFileItem.Builder

java.lang.Object
com.io7m.jwheatsheaf.ui.internal.JWFileItem.Builder
Enclosing class:
JWFileItem

public static final class JWFileItem.Builder extends 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 Details

    • from

      public final JWFileItem.Builder from(JWFileItemType instance)
      Fill a builder with attribute values from the provided JWFileItemType 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

      public final JWFileItem.Builder setKind(JWFileKind kind)
      Initializes the value for the kind attribute.
      Parameters:
      kind - The value for kind
      Returns:
      this builder for use in a chained invocation
    • setPath

      public final JWFileItem.Builder setPath(Path path)
      Initializes the value for the path attribute.
      Parameters:
      path - The value for path
      Returns:
      this builder for use in a chained invocation
    • setSize

      public final JWFileItem.Builder setSize(long size)
      Initializes the value for the size attribute.
      Parameters:
      size - The value for size
      Returns:
      this builder for use in a chained invocation
    • setModifiedTime

      public final JWFileItem.Builder setModifiedTime(FileTime modifiedTime)
      Initializes the value for the modifiedTime attribute.
      Parameters:
      modifiedTime - The value for modifiedTime
      Returns:
      this builder for use in a chained invocation
    • setDisplayName

      public final JWFileItem.Builder setDisplayName(String displayName)
      Initializes the optional value displayName to displayName.
      Parameters:
      displayName - The value for displayName
      Returns:
      this builder for chained invocation
    • setDisplayName

      public final JWFileItem.Builder setDisplayName(Optional<String> displayName)
      Initializes the optional value displayName to displayName.
      Parameters:
      displayName - The value for displayName
      Returns:
      this builder for use in a chained invocation
    • build

      public JWFileItem build()
      Builds a new JWFileItem.
      Returns:
      An immutable instance of JWFileItem
      Throws:
      IllegalStateException - if any required attributes are missing