Class VMAAllocationResult<T>

  • Type Parameters:
    T - The type of allocation result
    All Implemented Interfaces:
    VMAAllocationResultType<T>

    public final class VMAAllocationResult<T>
    extends java.lang.Object
    implements VMAAllocationResultType<T>
    An allocation result.
    • Method Detail

      • 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 of 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 of the this object
      • equals

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

        public java.lang.String toString()
        Prints the immutable value VMAAllocationResult with attribute values.
        Overrides:
        toString in class java.lang.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.
        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