@GwtIncompatible(value="reflection")
public class Conversions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Conversions.WrappedArray<T>
A list that is completely backed by an array and that provides access to that array.
|
static class |
Conversions.WrappedPrimitiveArray
A list that is completely backed by an array of primitives and that provides access to that array.
|
Constructor and Description |
---|
Conversions() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
doWrapArray(java.lang.Object object)
Wraps
object in a list if and only if object is an array. |
static java.lang.Object |
unwrapArray(java.lang.Object value)
Unwraps
object to extract the original array if and only if object was previously created by
doWrapArray(Object) . |
static java.lang.Object |
unwrapArray(java.lang.Object value,
java.lang.Class<?> componentType)
Unwraps
object to extract the original array if and only if object was previously created by
doWrapArray(Object) . |
@Pure public static java.lang.Object doWrapArray(java.lang.Object object)
object
in a list if and only if object
is an array. Works for primitive and
object-component types.object
- the object to be wrapped. May be null
.null
if the object was null
.@Pure public static java.lang.Object unwrapArray(java.lang.Object value)
object
to extract the original array if and only if object
was previously created by
doWrapArray(Object)
. If the array's component type cannot be determined at runtime, Object
is
used.value
- the object to be unwrapped. May be null
.null
if the value was null
.@Pure public static java.lang.Object unwrapArray(java.lang.Object value, java.lang.Class<?> componentType)
object
to extract the original array if and only if object
was previously created by
doWrapArray(Object)
.value
- the object to be unwrapped. May be null
.componentType
- the expected component type of the array. May not be null
.null
if the value was null
.java.lang.ArrayStoreException
- if the expected runtime componentType
does not match the actual runtime component type.