|
OSGi™ Service Platform Release 4 Version 4.2 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.osgi.service.blueprint.container.ReifiedType
public class ReifiedType
Provides access to a concrete type and its optional generic type parameters.
Java 5 and later support generic types. These types consist of a raw class
with type parameters. This class models such a 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. This class is available with the
getRawClass()
method. The optional type parameters are recursively
represented as Reified Types.
In Java 1.4, a class has by definition no type parameters. This class
implementation provides the Reified Type for Java 1.4 by making the raw class
the Java 1.4 class and using a Reified Type based on the Object
class for any requested type parameter.
A Blueprint extender implementations can subclass this class and provide
access to the generic type parameter graph for 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 parameters as Reified Types.
Constructor Summary | |
---|---|
ReifiedType(java.lang.Class<?> clazz)
Create a Reified Type for a raw Java class without any generic type parameters. |
Method Summary | |
---|---|
ReifiedType |
getActualTypeArgument(int i)
Return a type parameter for this type. |
java.lang.Class<?> |
getRawClass()
Return the raw class represented by this type. |
int |
size()
Return the number of type parameters for this type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReifiedType(java.lang.Class<?> clazz)
clazz
- The raw class of the Reified Type.Method Detail |
---|
public java.lang.Class<?> getRawClass()
Map<String, ? extends Metadata>The raw class is the Map class.
public ReifiedType getActualTypeArgument(int i)
i
.
For example, in the following example:
Map<String, ? extends Metadata>type parameter 0 is
String
, and type parameter 1 is
Metadata
.
This implementation returns a Reified Type that has Object
as class. Any object is assignable to Object and therefore no conversion
is then necessary. This is compatible with versions of Java language
prior to Java 5.
This method should be overridden by a subclass that provides access to
the generic type parameter information for Java 5 and later.
i
- The zero-based index of the requested type parameter.
ReifiedType
for the generic type parameter at
the specified index.public int size()
This implementation returns 0
. This method should be
overridden by a subclass that provides access to the generic type
parameter information for Java 5 and later.
|
OSGi™ Service Platform Release 4 Version 4.2 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |