org.apache.felix.gogo.commands.converter
Class GenericType

java.lang.Object
  extended by org.apache.felix.gogo.commands.converter.ReifiedType
      extended by org.apache.felix.gogo.commands.converter.GenericType

public class GenericType
extends ReifiedType


Constructor Summary
GenericType(java.lang.Class clazz, GenericType... parameters)
           
GenericType(java.lang.reflect.Type type)
           
 
Method Summary
 ReifiedType getActualTypeArgument(int i)
          Access to a type argument.
static GenericType parse(java.lang.String type, java.lang.Object loader)
           
 int size()
          Return the number of type arguments.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.felix.gogo.commands.converter.ReifiedType
getRawClass
 
Methods inherited from class java.lang.Object
clone, equals, 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 type,
                                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
Access to a type argument. The type argument refers to a argument in a generic type declaration given by index 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.

Overrides:
getActualTypeArgument in class ReifiedType
Parameters:
i - The index of the type argument
Returns:
ReifiedType(Object.class), subclasses must override this and return the generic argument at index i

size

public int size()
Description copied from class: ReifiedType
Return the number of type arguments. This method should be overridden by a subclass to support Java 5 types.

Overrides:
size in class ReifiedType
Returns:
0, subclasses must override this and return the number of generic arguments

toString

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


Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.