public class GenericType extends ReifiedType
Constructor and Description |
---|
GenericType(Class clazz,
GenericType... parameters) |
GenericType(Type type) |
Modifier and Type | Method and Description |
---|---|
ReifiedType |
getActualTypeArgument(int i)
Access to a type argument.
|
static GenericType |
parse(String type,
Object loader) |
int |
size()
Return the number of type arguments.
|
String |
toString() |
getRawClass
public GenericType(Type type)
public GenericType(Class clazz, GenericType... parameters)
public static GenericType parse(String type, Object loader) throws ClassNotFoundException, IllegalArgumentException
public ReifiedType getActualTypeArgument(int i)
ReifiedType
i
. This method returns a Reified Type that
has Object as class when no generic type information is available. Any
object is assignable to Object and therefore no conversion is then
necessary, this is compatible with older Javas than 5. For this reason,
the implementation in this class always returns the
Object class, regardless of the given index.
This method should be overridden by a subclass that provides access to
the generic information.
For example, in the following example:
Map<String, Object> map;
The type argument 0 is String
, and type argument 1 is
Object
.
getActualTypeArgument
in class ReifiedType
i
- The index of the type argumentReifiedType(Object.class), subclasses must override this and return the generic argument at index i
public int size()
ReifiedType
size
in class ReifiedType
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.