Class TypeUtils
- java.lang.Object
-
- org.eclipse.lsp4j.jsonrpc.json.adapters.TypeUtils
-
public final class TypeUtils extends java.lang.ObjectUtilities for handling types in the JSON parser / serializer.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 booleanisEither(java.lang.reflect.Type type)Test whether the given type is Either.static booleanisTwoTuple(java.lang.reflect.Type type)Test whether the given type is a two-tuple (pair).
-
-
-
Method Detail
-
getElementTypes
public 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.
-
getExpectedTypes
public 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. If the type satisfiesisEither(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 (usegetElementTypes(TypeToken, Class)to get resolved parameters).
-
isEither
public static boolean isEither(java.lang.reflect.Type type)
Test whether the given type is Either.
-
isTwoTuple
public static boolean isTwoTuple(java.lang.reflect.Type type)
Test whether the given type is a two-tuple (pair).
-
-