Package org.spockframework.gentyref
Class TypeToken<T>
- java.lang.Object
-
- org.spockframework.gentyref.TypeToken<T>
-
- Type Parameters:
T- The type represented by this TypeToken.
public abstract class TypeToken<T> extends java.lang.ObjectWrapper aroundType. You can use this to create instances of Type for a type known at compile time. For example, to get the Type that represents List<String>:Type listOfString = new TypeToken<List<String>>(){}.getType();- Author:
- Wouter Coekaerts
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTypeToken()Constructs a type token.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)static <T> TypeToken<T>get(java.lang.Class<T> type)Gets type token for the givenClassinstance.static TypeToken<?>get(java.lang.reflect.Type type)Gets type token for the givenTypeinstance.java.lang.reflect.TypegetType()inthashCode()
-
-
-
Method Detail
-
getType
public java.lang.reflect.Type getType()
-
get
public static <T> TypeToken<T> get(java.lang.Class<T> type)
Gets type token for the givenClassinstance.
-
get
public static TypeToken<?> get(java.lang.reflect.Type type)
Gets type token for the givenTypeinstance.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-