|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.inject.TypeToken<T>
public abstract class TypeToken<T>
Represents a generic type T
.
Assumes Type
implements equals()
and hashCode()
as a value (as opposed to identity) comparison.
Constructor Summary | |
---|---|
protected |
TypeToken()
Constructs a new type token. |
Method Summary | ||
---|---|---|
boolean |
equals(java.lang.Object o)
|
|
static
|
get(java.lang.Class<T> type)
Gets type token for the given Class instance. |
|
static TypeToken<?> |
get(java.lang.reflect.Type type)
Gets type token for the given Type instance. |
|
java.lang.reflect.Type |
getType()
Gets underlying Type instance. |
|
int |
hashCode()
|
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected TypeToken()
Clients create an empty anonymous subclass. Doing so embeds the type parameter in the anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
For example: TypeToken<List<String>> t = new
TypeToken<List<String>>() {};
Method Detail |
---|
public java.lang.reflect.Type getType()
Type
instance.
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static TypeToken<?> get(java.lang.reflect.Type type)
Type
instance.
public static <T> TypeToken<T> get(java.lang.Class<T> type)
Class
instance.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |