Class WXMStorageBackendFile

java.lang.Object
com.io7m.waxmill.machines.WXMStorageBackendFile
All Implemented Interfaces:
WXMDeviceType.WXMStorageBackendFileType, WXMDeviceType.WXMStorageBackendType

public final class WXMStorageBackendFile
extends java.lang.Object
implements WXMDeviceType.WXMStorageBackendFileType
Immutable implementation of WXMDeviceType.WXMStorageBackendFileType.

Use the builder to create immutable instances: WXMStorageBackendFile.builder().

  • Method Details

    • file

      public java.nio.file.Path file()
      Specified by:
      file in interface WXMDeviceType.WXMStorageBackendFileType
      Returns:
      The value of the file attribute
    • options

      public java.util.Set<WXMOpenOption> options()
      Specified by:
      options in interface WXMDeviceType.WXMStorageBackendFileType
      Returns:
      The value of the options attribute
    • sectorSizes

      public java.util.Optional<WXMSectorSizes> sectorSizes()
      Specified by:
      sectorSizes in interface WXMDeviceType.WXMStorageBackendFileType
      Returns:
      The value of the sectorSizes attribute
    • comment

      public java.lang.String comment()
      Specified by:
      comment in interface WXMDeviceType.WXMStorageBackendFileType
      Specified by:
      comment in interface WXMDeviceType.WXMStorageBackendType
      Returns:
      The value of the comment attribute
    • withFile

      public final WXMStorageBackendFile withFile​(java.nio.file.Path value)
      Copy the current immutable object by setting a value for the file attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for file
      Returns:
      A modified copy of the this object
    • withOptions

      public final WXMStorageBackendFile withOptions​(WXMOpenOption... elements)
      Copy the current immutable object with elements that replace the content of options.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withOptions

      public final WXMStorageBackendFile withOptions​(java.lang.Iterable<WXMOpenOption> elements)
      Copy the current immutable object with elements that replace the content of options. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of options elements to set
      Returns:
      A modified copy of this object
    • withSectorSizes

      public final WXMStorageBackendFile withSectorSizes​(WXMSectorSizes value)
      Copy the current immutable object by setting a present value for the optional sectorSizes attribute.
      Parameters:
      value - The value for sectorSizes
      Returns:
      A modified copy of this object
    • withSectorSizes

      public final WXMStorageBackendFile withSectorSizes​(java.util.Optional<? extends WXMSectorSizes> optional)
      Copy the current immutable object by setting an optional value for the sectorSizes attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for sectorSizes
      Returns:
      A modified copy of this object
    • withComment

      public final WXMStorageBackendFile withComment​(java.lang.String value)
      Copy the current immutable object by setting a value for the comment attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for comment
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of WXMStorageBackendFile that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: file, options, sectorSizes, comment.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value WXMStorageBackendFile with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • copyOf

      Creates an immutable copy of a WXMDeviceType.WXMStorageBackendFileType value. 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 WXMStorageBackendFile instance
    • builder

      public static WXMStorageBackendFile.Builder builder()
      Creates a builder for WXMStorageBackendFile.
       WXMStorageBackendFile.builder()
          .setFile(java.nio.file.Path) // required file
          .addOptions|addAllOptions(com.io7m.waxmill.machines.WXMOpenOption) // options elements
          .setSectorSizes(WXMSectorSizes) // optional sectorSizes
          .setComment(String) // optional comment
          .build();
       
      Returns:
      A new WXMStorageBackendFile builder