net.xoetrope.xui.helper
Class ReflectionHelper

java.lang.Object
  extended by net.xoetrope.xui.helper.ReflectionHelper

public class ReflectionHelper
extends java.lang.Object

A helper to simplify some of the more common reflection tasks used in XUI

Copyright: Copyright (c) 2004

$Revision: 1.5 $


Field Summary
static int LOG_ERROR_MESSAGE
           
static int PRINT_STACK_TRACE
           
 
Constructor Summary
ReflectionHelper()
           
 
Method Summary
static java.lang.Object constructViaReflection(java.lang.String className, java.lang.Object[] values)
          Create a new Object via reflection
static int getErrorMode()
          Get the current error mode
static java.lang.Object getViaReflection(java.lang.String methodName, java.lang.Object comp)
          Get a property using refelction instead of the property helper.
static void setErrorMode(int m)
          Set the error mode for reflection errors
static boolean setViaReflection(java.lang.String methodName, java.lang.Object comp, java.lang.Object value, boolean isBoolean)
          Set a property using reflection instead of the property helper.
static boolean setViaReflection(java.lang.String methodName, java.lang.Object comp, java.lang.Object value, java.lang.Class objectClass)
          Set a property using refelction instead of the property helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINT_STACK_TRACE

public static final int PRINT_STACK_TRACE
See Also:
Constant Field Values

LOG_ERROR_MESSAGE

public static final int LOG_ERROR_MESSAGE
See Also:
Constant Field Values
Constructor Detail

ReflectionHelper

public ReflectionHelper()
Method Detail

setErrorMode

public static void setErrorMode(int m)
Set the error mode for reflection errors

Parameters:
m - the new mode

getErrorMode

public static int getErrorMode()
Get the current error mode

Returns:
the error mode

getViaReflection

public static java.lang.Object getViaReflection(java.lang.String methodName,
                                                java.lang.Object comp)
Get a property using refelction instead of the property helper.

Parameters:
methodName - the method name
comp - the component being modified
Returns:
the property value

setViaReflection

public static boolean setViaReflection(java.lang.String methodName,
                                       java.lang.Object comp,
                                       java.lang.Object value,
                                       boolean isBoolean)
Set a property using reflection instead of the property helper.

Parameters:
methodName - the method name
comp - the component being modified
value - the new value
isBoolean - is it a boolean property being modified
Returns:
true if the property is set OK

setViaReflection

public static boolean setViaReflection(java.lang.String methodName,
                                       java.lang.Object comp,
                                       java.lang.Object value,
                                       java.lang.Class objectClass)
Set a property using refelction instead of the property helper.

Parameters:
methodName - the method name
comp - the component being modified
value - the new value
objectClass - the class of the argument of the set method being invoked
Returns:
true if the property is set OK

constructViaReflection

public static java.lang.Object constructViaReflection(java.lang.String className,
                                                      java.lang.Object[] values)
Create a new Object via reflection

Parameters:
className - the class to construct
values - an array of arguments used by the constructor
Returns:
the new object