com.autotrader.rhythmyx
Class DebugTools

java.lang.Object
  extended by com.percussion.extension.PSJexlUtilBase
      extended by com.autotrader.rhythmyx.DebugTools
All Implemented Interfaces:
com.percussion.extension.IPSExtension, com.percussion.extension.IPSJexlExpression

public class DebugTools
extends com.percussion.extension.PSJexlUtilBase

A JEXL tool that provides a convenient means to instantiate, reference, inspect and manipulate objects of arbitrary classes. Most of this code is modified variations of the base java Object and Class classes.


Field Summary
 
Fields inherited from interface com.percussion.extension.IPSExtension
BINARY_ASSEMBLER, DATABASE_ASSEMBLER, DEBUG_ASSEMBLER, DISPATCH_ASSEMBLER, ERROR_INVALID_PARAMETER, KNOWN_ASSEMBLERS, LEGACY_ASSEMBLER, NOT_INITIALIZED, VELOCITY_ASSEMBLER
 
Constructor Summary
DebugTools()
           
 
Method Summary
 java.lang.Object getFieldValue(java.lang.Object object, java.lang.String fieldName)
          Gets the value of any field defined for an object, regardless of field scope.
 java.lang.String inspect(java.lang.Object object)
          Gets a generic description of all fields and methods declared in an object's class.
 java.lang.String inspectField(java.lang.Object object, java.lang.String fieldName)
          Gets a generic description of a specific field in an object's class.
 java.lang.String inspectFields(java.lang.Object object)
          Gets a generic description of all fields declared in an object's class.
 java.lang.String inspectMethods(java.lang.Object object)
          Gets a generic description of all methods declared in an object's class.
 java.lang.Object invoke(java.lang.Object object, java.lang.String methodName, java.lang.Object... arguments)
          Calls a method defined for an object, regardless of method scope.
 java.lang.Object setFieldValue(java.lang.Object object, java.lang.String fieldName, java.lang.Object newValue)
          Sets the value of any field defined for an object, regardless of field scope.
 
Methods inherited from class com.percussion.extension.PSJexlUtilBase
init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugTools

public DebugTools()
Method Detail

inspect

public java.lang.String inspect(java.lang.Object object)
                         throws java.lang.ClassNotFoundException
Gets a generic description of all fields and methods declared in an object's class.

Parameters:
object - An object to inspect.
Returns:
a generic description of the object.
Throws:
java.lang.ClassNotFoundException

inspectMethods

public java.lang.String inspectMethods(java.lang.Object object)
                                throws java.lang.ClassNotFoundException
Gets a generic description of all methods declared in an object's class.

Parameters:
object - An object to inspect.
Returns:
generic descriptions of the object's methods.
Throws:
java.lang.ClassNotFoundException

inspectFields

public java.lang.String inspectFields(java.lang.Object object)
                               throws java.lang.ClassNotFoundException
Gets a generic description of all fields declared in an object's class.

Parameters:
object - An object to inspect.
Returns:
generic descriptions of the object's fields.
Throws:
java.lang.ClassNotFoundException

inspectField

public java.lang.String inspectField(java.lang.Object object,
                                     java.lang.String fieldName)
                              throws java.lang.ClassNotFoundException
Gets a generic description of a specific field in an object's class.

Parameters:
object - An object to inspect.
fieldName - The field name.
Returns:
a generic description of the object's field.
Throws:
java.lang.ClassNotFoundException

getFieldValue

public java.lang.Object getFieldValue(java.lang.Object object,
                                      java.lang.String fieldName)
Gets the value of any field defined for an object, regardless of field scope.

Parameters:
object - An object to inspect.
fieldName - The name of the field.
Returns:
The value of the field, or null if the value could not be found.

setFieldValue

public java.lang.Object setFieldValue(java.lang.Object object,
                                      java.lang.String fieldName,
                                      java.lang.Object newValue)
Sets the value of any field defined for an object, regardless of field scope. Returns an exception if there was an error.

Parameters:
object - An object to inspect.
fieldName - The name of the field.
newValue - The new value for the field.
Returns:
null, or an exception if there was an error.

invoke

public java.lang.Object invoke(java.lang.Object object,
                               java.lang.String methodName,
                               java.lang.Object... arguments)
Calls a method defined for an object, regardless of method scope. Returns the result of the method on success, or an exception if there was an error.

Parameters:
object - An object to inspect.
methodName - The name of the method to invoke.
arguments - The arguments to pass in to the method.
Returns:
The method's result, or an exception if there was an error.