Class GenericType<T>
- java.lang.Object
-
- com.oracle.coherence.io.json.genson.GenericType<T>
-
- Type Parameters:
T- the real type
public abstract class GenericType<T> extends Object
This class is a holder for generic types so we can work around type erasure. You can read this blog post who explains a bit more in details what it is about. For example if you want to use at runtime a List<Integer> :GenericType<List<Integer>> genericType = new GenericType<List<Integer>>() { }; List<Integer> listOfIntegers = new Genson().deserialize("[1,2,3]", genericType); // if you want to get the standard java.lang.reflect.Type corresponding to List<Integer> from // genericType Type listOfIntegersType = genericType.getType(); // listOfIntegersType will be an instance of ParameterizedType with Integer class as type argument- Author:
- Eugen Cepoi
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGenericType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<T>getRawClass()TypegetType()static <T> GenericType<T>of(Class<T> rawClass)static GenericType<Object>of(Type type)
-
-
-
Method Detail
-
of
public static <T> GenericType<T> of(Class<T> rawClass)
-
of
public static GenericType<Object> of(Type type)
-
getType
public Type getType()
-
-