UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.introspect
Class IntrospectHandler

java.lang.Object
  |
  +--edu.berkeley.guir.lib.introspect.IntrospectHandler
All Implemented Interfaces:
IntrospectConstants
Direct Known Subclasses:
DefaultIntrospectHandler, EmptyIntrospectHandler

public abstract class IntrospectHandler
extends Object
implements IntrospectConstants

Callback for Java object introspection traversal.

Unfortunately, this class requires JDK1.3, because it uses the Modifier class to access values outside of our access scope.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Apr 25 2000, JH
               Created class
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
JDK1.3
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Introspect.parseObject(Object, IntrospectHandler)

Fields inherited from interface edu.berkeley.guir.lib.introspect.IntrospectConstants
CL_BOOLEAN, CL_BOOLEAN_ARR, CL_BYTE, CL_BYTE_ARR, CL_CHAR, CL_CHAR_ARR, CL_DOUBLE, CL_DOUBLE_ARR, CL_FLOAT, CL_FLOAT_ARR, CL_INT, CL_INT_ARR, CL_LONG, CL_LONG_ARR, CL_SHORT, CL_SHORT_ARR, CL_STRING, CL_STRINGBUFFER
 
Constructor Summary
IntrospectHandler()
           
IntrospectHandler(IntrospectFilter newFilter)
           
 
Method Summary
 boolean acceptField(int depth, Field f, Object obj)
          Accept this field or not?
 IntrospectFilter getFilter()
          Get the current filter.
 void onArray(int depth, Field f, Object arr)
           
 void onBoolean(int depth, Field f, boolean val)
           
 void onByte(int depth, Field f, byte val)
           
 void onChar(int depth, Field f, char val)
           
 void onDouble(int depth, Field f, double val)
           
 void onException(int depth, Field f, Exception e)
          Error in processing.
 void onFloat(int depth, Field f, float val)
           
 void onInt(int depth, Field f, int val)
           
 void onLong(int depth, Field f, long val)
           
 void onNull(int depth, Field f)
          Rather than calling onObject or onArray, calls this if value is null.
 void onObject(int depth, Field f, Object obj)
           
 void onRoot(Object obj)
          Start traversal.
 void onShort(int depth, Field f, short val)
           
 void setFilter(IntrospectFilter newFilter)
          Set the current filter.
 boolean shouldRecurse(int depth, Field f, Object obj)
          Should return the correct value as to whether we should recurse on this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntrospectHandler

public IntrospectHandler()

IntrospectHandler

public IntrospectHandler(IntrospectFilter newFilter)
Method Detail

setFilter

public void setFilter(IntrospectFilter newFilter)
Set the current filter.
Parameters:
newFilter - is null to clear out the current filter.

getFilter

public IntrospectFilter getFilter()
Get the current filter.
Returns:
the current IntrospectFilter, or null if there is none.

onRoot

public void onRoot(Object obj)
Start traversal.

onObject

public void onObject(int depth,
                     Field f,
                     Object obj)
Parameters:
depth - is the depth of the node in the tree.
field - is the Field information, and is null for the start object.
obj - is the object value, which may or may not be null.

onArray

public void onArray(int depth,
                    Field f,
                    Object arr)
Parameters:
depth - is the depth of the node in the tree.
field - is the Field information.
obj - is the array, which may or may not be null.

onNull

public void onNull(int depth,
                   Field f)
Rather than calling onObject or onArray, calls this if value is null.

onBoolean

public void onBoolean(int depth,
                      Field f,
                      boolean val)

onChar

public void onChar(int depth,
                   Field f,
                   char val)

onByte

public void onByte(int depth,
                   Field f,
                   byte val)

onShort

public void onShort(int depth,
                    Field f,
                    short val)

onInt

public void onInt(int depth,
                  Field f,
                  int val)

onLong

public void onLong(int depth,
                   Field f,
                   long val)

onFloat

public void onFloat(int depth,
                    Field f,
                    float val)

onDouble

public void onDouble(int depth,
                     Field f,
                     double val)

onException

public void onException(int depth,
                        Field f,
                        Exception e)
Error in processing.

shouldRecurse

public boolean shouldRecurse(int depth,
                             Field f,
                             Object obj)
Should return the correct value as to whether we should recurse on this object.
Returns:
true if no filter, otherwise re-dispatches to filter.

acceptField

public boolean acceptField(int depth,
                           Field f,
                           Object obj)
Accept this field or not?
Returns:
true if no filter, otherwise re-dispatches to filter.

Copyright Information