public class ReifiedType extends Object
Type
class but
ensures that the type is reified. Reification means that the Type
graph associated with a Java 5 Type
instance is traversed
until the type becomes a concrete class. In Java 1.4 a class has no
arguments. This concrete class implements the Reified Type for Java 1.4.
In Java 1.4, this class works with non-generic types. In that cases, a
Reified Type provides access to the class and has zero type arguments, though
a subclass that provide type arguments should be respected. Blueprint
extender implementations can subclass this class and provide access to the
generics type graph if used in a conversion. Such a subclass must
reify the different Java 5 Type
instances into the
reified form. That is, a form where the raw Class is available with its optional type arguments as Reified Types.Constructor and Description |
---|
ReifiedType(Class clazz)
Create a Reified Type for a raw Java class without any generic arguments.
|
Modifier and Type | Method and Description |
---|---|
ReifiedType |
getActualTypeArgument(int i)
Access to a type argument.
|
Class |
getRawClass()
Access to the raw class.
|
int |
size()
Return the number of type arguments.
|
public ReifiedType(Class clazz)
clazz
- The raw class of the Reified Type.public Class getRawClass()
Map<String, Object> map;The raw class is the Map class.
public ReifiedType getActualTypeArgument(int i)
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
.
i
- The index of the type argumentReifiedType(Object.class), subclasses must override this and return the generic argument at index i
public int size()
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.