- 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 java.lang.Object implements VMAAllocationResultType<T>
An allocation result.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VMAAllocationResult.Builder<T>
Builds instances of typeVMAAllocationResult
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VMAAllocationType
allocation()
static <T> VMAAllocationResult.Builder<T>
builder()
Creates a builder forVMAAllocationResult
.static <T> VMAAllocationResult<T>
copyOf(VMAAllocationResultType<T> instance)
Creates an immutable copy of aVMAAllocationResultType
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofVMAAllocationResult
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 immutableVMAAllocationResult
instance.T
result()
java.lang.String
toString()
Prints the immutable valueVMAAllocationResult
with attribute values.VMAAllocationResult<T>
withAllocation(VMAAllocationType value)
Copy the current immutable object by setting a value for theallocation
attribute.VMAAllocationResult<T>
withResult(T value)
Copy the current immutable object by setting a value for theresult
attribute.
-
-
-
Method Detail
-
allocation
public VMAAllocationType allocation()
- Specified by:
allocation
in interfaceVMAAllocationResultType<T>
- Returns:
- The allocation
-
result
public T result()
- Specified by:
result
in interfaceVMAAllocationResultType<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 theallocation
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- 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 theresult
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- 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 ofVMAAllocationResult
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:allocation
,result
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueVMAAllocationResult
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
public static <T> VMAAllocationResult<T> of(VMAAllocationType allocation, T result)
Construct a new immutableVMAAllocationResult
instance.- Parameters:
allocation
- The value for theallocation
attributeresult
- The value for theresult
attribute- Returns:
- An immutable VMAAllocationResult instance
-
copyOf
public static <T> VMAAllocationResult<T> copyOf(VMAAllocationResultType<T> instance)
Creates an immutable copy of aVMAAllocationResultType
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 forVMAAllocationResult
.- Type Parameters:
T
- generic parameter T- Returns:
- A new VMAAllocationResult builder
-
-