org.ow2.opensuit.core.util
Class ReflectionHelper

java.lang.Object
  extended by org.ow2.opensuit.core.util.ReflectionHelper

public class ReflectionHelper
extends java.lang.Object


Nested Class Summary
static class ReflectionHelper.NumberOutOfBoundsException
           
 
Constructor Summary
ReflectionHelper()
           
 
Method Summary
static java.lang.Object collection2Obj(java.util.Collection<?> iColl, java.lang.Class<?> iTarget)
          Transforms a list into the targeted vector type
static java.lang.Class<?> getNonPrimitiveClass(java.lang.Class<?> iClass)
          Returns the equivalent non-primitive class
static java.lang.Class<?> getVectorElementClass(java.lang.reflect.Type iType)
          Returns the component type if the given type is of vector type (List or Array)
static java.lang.reflect.Type getVectorElementType(java.lang.reflect.Type iType)
           
static boolean isAssignable(java.lang.Class<?> iClass1, java.lang.Class<?> iClass2)
          Checks if class1 is assignable as class2.
static boolean isVector(java.lang.reflect.Type iType)
          Determines whether the given type is vector (array, list, ...)
static void main(java.lang.String[] args)
           
static java.util.Collection<java.lang.Object> obj2Collection(java.lang.Object iObject)
          Returns a Collection object from any vector type.
static java.lang.String obj2String(java.lang.Object o)
           
static java.lang.Object parse2Type(java.lang.String iValue, java.lang.Class target)
           
static java.lang.Class<?> type2Class(java.lang.reflect.Type iType)
          Returns the raw Class from the Java 5 Type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionHelper

public ReflectionHelper()
Method Detail

type2Class

public static java.lang.Class<?> type2Class(java.lang.reflect.Type iType)
Returns the raw Class from the Java 5 Type

Parameters:
iType -
Returns:

getNonPrimitiveClass

public static java.lang.Class<?> getNonPrimitiveClass(java.lang.Class<?> iClass)
Returns the equivalent non-primitive class

Parameters:
iClass -
Returns:

isAssignable

public static boolean isAssignable(java.lang.Class<?> iClass1,
                                   java.lang.Class<?> iClass2)
Checks if class1 is assignable as class2. Manages primitive types.

Parameters:
iClass1 -
iClass2 -
Returns:

getVectorElementClass

public static java.lang.Class<?> getVectorElementClass(java.lang.reflect.Type iType)
Returns the component type if the given type is of vector type (List or Array)

Parameters:
iType - represent the instance's type, which you want to check
Returns:
The vector class of the provided type in parameter, or null if the type isn't assignable.

getVectorElementType

public static java.lang.reflect.Type getVectorElementType(java.lang.reflect.Type iType)

isVector

public static boolean isVector(java.lang.reflect.Type iType)
Determines whether the given type is vector (array, list, ...)

Parameters:
iType -
Returns:

obj2Collection

public static java.util.Collection<java.lang.Object> obj2Collection(java.lang.Object iObject)
Returns a Collection object from any vector type. This collection may be used for read access only.

Parameters:
iObject -
copy -
Returns:

collection2Obj

public static java.lang.Object collection2Obj(java.util.Collection<?> iColl,
                                              java.lang.Class<?> iTarget)
Transforms a list into the targeted vector type

Parameters:
iColl -
iTarget -
Returns:

obj2String

public static java.lang.String obj2String(java.lang.Object o)

parse2Type

public static java.lang.Object parse2Type(java.lang.String iValue,
                                          java.lang.Class target)

main

public static void main(java.lang.String[] args)


Copyright © 2008-2012 OW2 Consortium. All Rights Reserved.