org.ops4j.pax.swissbox.converter
Class GenericType

java.lang.Object
  extended by org.osgi.service.blueprint.container.ReifiedType
      extended by org.ops4j.pax.swissbox.converter.GenericType

public class GenericType
extends ReifiedType

JAVADOC NOTICE: This class contains code originally developed by "Apache Geronimo Project", OSGi Blueprint Implementation.

Author:
Apache Geronimo Project, Alin Dreghiciu (adreghiciu@gmail.com)

Constructor Summary
GenericType(java.lang.Class clazz, GenericType... parameters)
           
GenericType(java.lang.reflect.Type type)
           
 
Method Summary
 boolean equals(java.lang.Object object)
           
static GenericType genericType(java.lang.Class clazz, GenericType... parameters)
           
static GenericType genericType(java.lang.reflect.Type type)
           
 ReifiedType getActualTypeArgument(int index)
          Return a type parameter for this type.
static GenericType parse(java.lang.String type, Loader 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

getActualTypeArgument

public ReifiedType getActualTypeArgument(int index)
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:
index - 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

parse

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

equals

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

genericType

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

genericType

public static GenericType genericType(java.lang.Class clazz,
                                      GenericType... parameters)


Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.