org.apache.aries.blueprint.container
Class GenericType

java.lang.Object
  extended by org.osgi.service.blueprint.container.ReifiedType
      extended by org.apache.aries.blueprint.container.GenericType

public class GenericType
extends ReifiedType

XXXX: Currently, in case of arrays getActualTypeArgument(0) returns something similar to what Class.getComponentType() does for arrays. I don't think this is quite right since getActualTypeArgument() should return the given parameterized type not the component type. Need to check this behavior with the spec.


Constructor Summary
GenericType(java.lang.Class clazz, GenericType... parameters)
           
GenericType(java.lang.reflect.Type type)
           
 
Method Summary
 boolean equals(java.lang.Object object)
           
 ReifiedType getActualTypeArgument(int i)
          Return a type parameter for this type.
static GenericType parse(java.lang.String rawType, java.lang.Object loader)
           
 int size()
          Return the number of type parameters for this type.
 java.lang.String toString()
           
 
Methods inherited from class org.osgi.service.blueprint.container.ReifiedType
getRawClass
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericType

public GenericType(java.lang.reflect.Type type)

GenericType

public GenericType(java.lang.Class clazz,
                   GenericType... parameters)
Method Detail

parse

public static GenericType parse(java.lang.String rawType,
                                java.lang.Object loader)
                         throws java.lang.ClassNotFoundException,
                                java.lang.IllegalArgumentException
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalArgumentException

getActualTypeArgument

public ReifiedType getActualTypeArgument(int i)
Description copied from class: ReifiedType
Return a type parameter for this type. The type parameter refers to a parameter in a generic type declaration given by the zero-based index 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.

Overrides:
getActualTypeArgument in class ReifiedType
Parameters:
i - The zero-based index of the requested type parameter.
Returns:
The ReifiedType for the generic type parameter at the specified index.

size

public int size()
Description copied from class: ReifiedType
Return the number of type parameters for this type.

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.

Overrides:
size in class ReifiedType
Returns:
The number of type parameters for this type.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.