# Class VulkanAttachmentReference

java.lang.Object
com.io7m.jcoronado.api.VulkanAttachmentReference

All Implemented Interfaces:
  `VulkanAttachmentReferenceType`

public final class VulkanAttachmentReference extends Object implements VulkanAttachmentReferenceType
Structure specifying an attachment reference.

See Also:
  - "VkAttachmentReference2"

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `VulkanAttachmentReference.Builder`
  Builds instances of type `VulkanAttachmentReference`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Set<VulkanImageAspectFlag>`
  `aspectMask()`
  `int`
  `attachment()`
  `static VulkanAttachmentReference.Builder`
  `builder()`
  Creates a builder for `VulkanAttachmentReference`.
  `static VulkanAttachmentReference`
  `copyOf(VulkanAttachmentReferenceType instance)`
  Creates an immutable copy of a `VulkanAttachmentReferenceType` value.
  `boolean`
  `equals(Object another)`
  This instance is equal to all instances of `VulkanAttachmentReference` that have equal attribute values.
  `int`
  `hashCode()`
  Computes a hash code from attributes: `attachment`, `layout`, `aspectMask`.
  `VulkanImageLayout`
  `layout()`
  `String`
  `toString()`
  Prints the immutable value `VulkanAttachmentReference` with attribute values.
  `final VulkanAttachmentReference`
  `withAspectMask(VulkanImageAspectFlag... elements)`
  Copy the current immutable object with elements that replace the content of `aspectMask`.
  `final VulkanAttachmentReference`
  `withAspectMask(Iterable<VulkanImageAspectFlag> elements)`
  Copy the current immutable object with elements that replace the content of `aspectMask`.
  `final VulkanAttachmentReference`
  `withAttachment(int value)`
  Copy the current immutable object by setting a value for the `attachment` attribute.
  `final VulkanAttachmentReference`
  `withLayout(VulkanImageLayout value)`
  Copy the current immutable object by setting a value for the `layout` attribute.

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### attachment

    public int attachment()
    Specified by:
      `attachment` in interface `VulkanAttachmentReferenceType`
    Returns:
      The index of the attachment of the render pass

  - ### layout

    public VulkanImageLayout layout()
    Specified by:
      `layout` in interface `VulkanAttachmentReferenceType`
    Returns:
      The layout the attachment uses during the subpass.

  - ### aspectMask

    public Set<VulkanImageAspectFlag> aspectMask()
    Specified by:
      `aspectMask` in interface `VulkanAttachmentReferenceType`
    Returns:
      A mask of which aspect(s) can be accessed within the specified subpass as an input attachment.

  - ### withAttachment

    public final VulkanAttachmentReference withAttachment(int value)
    Copy the current immutable object by setting a value for the `attachment` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for attachment
    Returns:
      A modified copy or the `this` object

  - ### withLayout

    public final VulkanAttachmentReference withLayout(VulkanImageLayout value)
    Copy the current immutable object by setting a value for the `layout` attribute. A value equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for layout
    Returns:
      A modified copy or the `this` object

  - ### withAspectMask

    public final VulkanAttachmentReference withAspectMask(VulkanImageAspectFlag... elements)
    Copy the current immutable object with elements that replace the content of `aspectMask`.
    Parameters:
      `elements` - The elements to set
    Returns:
      A modified copy of `this` object

  - ### withAspectMask

    public final VulkanAttachmentReference withAspectMask(Iterable<VulkanImageAspectFlag> elements)
    Copy the current immutable object with elements that replace the content of `aspectMask`. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `elements` - An iterable of aspectMask elements to set
    Returns:
      A modified copy or `this` if not changed

  - ### equals

    public boolean equals(Object another)
    This instance is equal to all instances of `VulkanAttachmentReference` that have equal attribute values.
    Overrides:
      `equals` in class `Object`
    Returns:
      `true` if `this` is equal to `another` instance

  - ### hashCode

    public int hashCode()
    Computes a hash code from attributes: `attachment`, `layout`, `aspectMask`.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      hashCode value

  - ### toString

    public String toString()
    Prints the immutable value `VulkanAttachmentReference` with attribute values.
    Overrides:
      `toString` in class `Object`
    Returns:
      A string representation of the value

  - ### copyOf

    public static VulkanAttachmentReference copyOf(VulkanAttachmentReferenceType instance)
    Creates an immutable copy of a `VulkanAttachmentReferenceType` 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 VulkanAttachmentReference instance

  - ### builder

    public static VulkanAttachmentReference.Builder builder()
    Creates a builder for `VulkanAttachmentReference`.

        VulkanAttachmentReference.builder()
           .setAttachment(int) // required attachment
           .setLayout(com.io7m.jcoronado.api.VulkanImageLayout) // optional layout
           .addAspectMask|addAllAspectMask(com.io7m.jcoronado.api.VulkanImageAspectFlag) // aspectMask elements
           .build();

    Returns:
      A new VulkanAttachmentReference builder