Class 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 Detail

      • 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​(java.nio.file.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​(java.nio.file.attribute.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​(java.lang.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​(java.util.Optional<java.lang.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:
        java.lang.IllegalStateException - if any required attributes are missing