TypeReference<T> Class
- java.
lang. Object - com.
microsoft. signalr. TypeReference<T>
- com.
Type Parameters
- T
public abstract class TypeReference
A utility for getting a Java Type from a literal generic Class.
Constructor Summary
Constructor | Description |
---|---|
TypeReference() |
Creates a new instance of TypeReference<T>. |
Method Summary
Modifier and Type | Method and Description |
---|---|
java.lang.reflect.Type |
getType()
Gets the referenced type. |
Inherited Members
java.lang.Object.clone()
java.lang.Object.equals(java.lang.Object)
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.hashCode()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.toString()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)
Constructor Details
TypeReference
public TypeReference()
Creates a new instance of TypeReference<T>. 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.class
is not valid Java. To get the Type of Class Foo
, use the following syntax:
Type fooBarType = (new TypeReference>() { }).getType();
To get the Type of class Foo, use a regular Type Token:
Type fooType = Foo.class;
Method Details
getType
public Type getType()
Gets the referenced type.
Returns:
The Type encapsulated by this TypeReference