# Class VMAAllocationResult<T>

java.lang.Object
com.io7m.jcoronado.vma.VMAAllocationResult<T>

Type Parameters:
  `T` - The type of allocation result

All Implemented Interfaces:
  `VMAAllocationResultType<T>`

public final class VMAAllocationResult<T> extends Object implements VMAAllocationResultType<T>
An allocation result.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `VMAAllocationResult.Builder<T>`
  Builds instances of type `VMAAllocationResult`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `VMAAllocationType`
  `allocation()`
  `static <T> VMAAllocationResult.Builder<T>`
  `builder()`
  Creates a builder for `VMAAllocationResult`.
  `static <T> VMAAllocationResult<T>`
  `copyOf(VMAAllocationResultType<T> instance)`
  Creates an immutable copy of a `VMAAllocationResultType` value.
  `boolean`
  `equals(Object another)`
  This instance is equal to all instances of `VMAAllocationResult` that have equal attribute values.
  `int`
  `hashCode()`
  Computes a hash code from attributes: `allocation`, `result`.
  `static <T> VMAAllocationResult<T>`
  `of(VMAAllocationType allocation, T result)`
  Construct a new immutable `VMAAllocationResult` instance.
  `T`
  `result()`
  `String`
  `toString()`
  Prints the immutable value `VMAAllocationResult` with attribute values.
  `final VMAAllocationResult<T>`
  `withAllocation(VMAAllocationType value)`
  Copy the current immutable object by setting a value for the `allocation` attribute.
  `final VMAAllocationResult<T>`
  `withResult(T value)`
  Copy the current immutable object by setting a value for the `result` attribute.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### allocation

    public VMAAllocationType allocation()
    Specified by:
      `allocation` in interface `VMAAllocationResultType<T>`
    Returns:
      The allocation

  - ### result

    public T result()
    Specified by:
      `result` in interface `VMAAllocationResultType<T>`
    Returns:
      The allocation result. Typically an image or a buffer.

  - ### withAllocation

    public final VMAAllocationResult<T> withAllocation(VMAAllocationType value)
    Copy the current immutable object by setting a value for the `allocation` attribute. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for allocation
    Returns:
      A modified copy or the `this` object

  - ### withResult

    public final VMAAllocationResult<T> withResult(T value)
    Copy the current immutable object by setting a value for the `result` attribute. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for result
    Returns:
      A modified copy or the `this` object

  - ### equals

    public boolean equals(Object another)
    This instance is equal to all instances of `VMAAllocationResult` 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: `allocation`, `result`.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      hashCode value

  - ### toString

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

  - ### of

    public static <T> VMAAllocationResult<T> of(VMAAllocationType allocation, T result)
    Construct a new immutable `VMAAllocationResult` instance.
    Type Parameters:
      `T` - generic parameter T
    Parameters:
      `allocation` - The value for the `allocation` attribute
      `result` - The value for the `result` attribute
    Returns:
      An immutable VMAAllocationResult instance

  - ### copyOf

    public static <T> VMAAllocationResult<T> copyOf(VMAAllocationResultType<T> instance)
    Creates an immutable copy of a `VMAAllocationResultType` value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
    Type Parameters:
      `T` - generic parameter T
    Parameters:
      `instance` - The instance to copy
    Returns:
      A copied immutable VMAAllocationResult instance

  - ### builder

    public static <T> VMAAllocationResult.Builder<T> builder()
    Creates a builder for `VMAAllocationResult`.

        VMAAllocationResult.<T>builder()
           .setAllocation(com.io7m.jcoronado.vma.VMAAllocationType) // required allocation
           .setResult(T) // required result
           .build();

    Type Parameters:
      `T` - generic parameter T
    Returns:
      A new VMAAllocationResult builder