public final class TypeUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Type[] |
getElementTypes(com.google.gson.reflect.TypeToken<?> typeToken,
java.lang.Class<?> targetType)
Determine the actual type arguments of the given type token with regard to the given target type.
|
static java.util.Collection<java.lang.reflect.Type> |
getExpectedTypes(java.lang.reflect.Type type)
Return all possible types that can be expected when an element of the given type is parsed.
|
static boolean |
isEither(java.lang.reflect.Type type)
Test whether the given type is Either.
|
static boolean |
isTwoTuple(java.lang.reflect.Type type)
Test whether the given type is a two-tuple (pair).
|
public static java.lang.reflect.Type[] getElementTypes(com.google.gson.reflect.TypeToken<?> typeToken, java.lang.Class<?> targetType)
public static java.util.Collection<java.lang.reflect.Type> getExpectedTypes(java.lang.reflect.Type type)
isEither(Type)
, a list of the corresponding type arguments is returned,
otherwise a list containg the type itself is returned. Type parameters are not resolved
by this method (use getElementTypes(TypeToken, Class)
to get resolved parameters).public static boolean isEither(java.lang.reflect.Type type)
public static boolean isTwoTuple(java.lang.reflect.Type type)