Package com.microsoft.signalr
Class TypeReference<T>
- java.lang.Object
-
- com.microsoft.signalr.TypeReference<T>
-
public abstract class TypeReference<T> extends java.lang.Object
A utility for getting a Java Type from a literal generic Class.
-
-
Constructor Summary
Constructors Constructor Description TypeReference()
Creates a new instance ofTypeReference
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.Type
getType()
Gets the referenced type.
-
-
-
Constructor Detail
-
TypeReference
public TypeReference()
Creates a new instance ofTypeReference
. This class implements Super Type Tokens (Gafter's Gadget) as a way to get a reference to generic types in spite of type erasure since, sadly,Foo<Bar>.class
is not valid Java. To get the Type of ClassFoo<Bar>
, use the following syntax:
To get the Type of class Foo, use a regular Type Token:Type fooBarType = (new TypeReference<Foo<Bar>>() { }).getType();
Type fooType = Foo.class;
- See Also:
- Super Type Tokens
-
-