jxUtil 0.6

org.sourceforge.jxutil
Class Reflection

java.lang.Object
  |
  +--org.sourceforge.jxutil.Reflection

public final class Reflection
extends Object

Utility functions using reflection.

Author:
Keve Müller

Constructor Summary
private Reflection()
          Cannot instantiate.
 
Method Summary
static String dumpObject(Object obj)
           
(package private) static void dumpObject(StringBuffer sb, Object obj)
           
static Constructor findCompatibleConstructor(Class cl, Object[] oa)
          Find a constructor compatible with given objects.
static Field findCompatibleField(Field[] fa, String name, Object paramObject)
          Find a field given its name and a compatible object.
static Method findCompatibleMethod(Method[] ma, String name, Object[] paramObject)
          Find a compatible method by name given its parameter objects.
static Class getPrimForWrapper(Class cl)
          Get primitive type for given object class.
static Class getWrapperForPrim(Class cl)
          Get wrapper class for given primitive type.
static boolean isCompatible(Class[] paramClass, Object[] paramObject)
          Determine if given objects are compatible with corresponding classes.
static boolean isCompatible(Class paramClass, Object paramObject)
          Determine if the given object is assignability compatible with the given class.
static Object[] primitive2ObjectArray(Object primitiveArray)
          Turn an array of a primitive type into an Object array of corresponding class type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reflection

private Reflection()
Cannot instantiate.

Method Detail

dumpObject

public static String dumpObject(Object obj)

dumpObject

static void dumpObject(StringBuffer sb,
                       Object obj)

findCompatibleConstructor

public static Constructor findCompatibleConstructor(Class cl,
                                                    Object[] oa)
                                             throws NoSuchMethodError
Find a constructor compatible with given objects.

NoSuchMethodError

findCompatibleField

public static Field findCompatibleField(Field[] fa,
                                        String name,
                                        Object paramObject)
                                 throws NoSuchFieldException
Find a field given its name and a compatible object.

NoSuchFieldException

findCompatibleMethod

public static Method findCompatibleMethod(Method[] ma,
                                          String name,
                                          Object[] paramObject)
                                   throws NoSuchMethodException
Find a compatible method by name given its parameter objects.

NoSuchMethodException

getPrimForWrapper

public static Class getPrimForWrapper(Class cl)
Get primitive type for given object class.


getWrapperForPrim

public static Class getWrapperForPrim(Class cl)
Get wrapper class for given primitive type.


isCompatible

public static boolean isCompatible(Class[] paramClass,
                                   Object[] paramObject)
Determine if given objects are compatible with corresponding classes.


isCompatible

public static boolean isCompatible(Class paramClass,
                                   Object paramObject)
Determine if the given object is assignability compatible with the given class. This method also checks for primitive types besides Class.isAssignableFrom.


primitive2ObjectArray

public static Object[] primitive2ObjectArray(Object primitiveArray)
Turn an array of a primitive type into an Object array of corresponding class type.


jxUtil 0.6

Copyright © 2001,2002 Keve Müller, et al.; see LICENSE file for details.