Package org.modelmapper
Class TypeToken<T>
java.lang.Object
org.modelmapper.TypeToken<T>
- Type Parameters:
T- Represented type
Represents a generic type
T. Subclassing TypeToken allows for type information to be
preserved at runtime.
Example: To create a type literal for List<String>, you can create an empty anonymous
inner class:
TypeToken<List<String>> list = new TypeToken<List<String>>();
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TypeToken
protected TypeToken()Creates a new type token forT.- Throws:
IllegalArgumentException- ifTis not provided or is a TypeVariable
-
-
Method Details
-
of
Returns a TypeLiteral for thetype.- Throws:
IllegalArgumentException- iftypeis null or if a raw type cannot be resolved
-
equals
-
getRawType
Returns the raw type forT.- If
Tis aClass,Titself is returned. - If
Tis aParameterizedType, the raw type is returned - If
Tis aGenericArrayType, the raw type is returned - If
Tis aTypeVariableorWildcardType, the raw type of the first upper bound is returned
- If
-
getType
Returns the generic typeT. -
hashCode
public final int hashCode() -
toString
-