org.pfsw.joi
Class Spy

java.lang.Object
  extended by org.pfsw.joi.Spy
Direct Known Subclasses:
AbstractObjectSpy, ElementSpy

public abstract class Spy
extends java.lang.Object

This is the abstract superclass of all wrapper classes, that are holding inspected objects. It provides the API an inspector can use to display internal information of the inspected object.


Field Summary
protected static java.lang.String PRIMITIVE_BOOLEAN
           
protected static java.lang.String PRIMITIVE_BYTE
           
protected static java.lang.String PRIMITIVE_CHAR
           
protected static java.lang.String PRIMITIVE_DOUBLE
           
protected static java.lang.String PRIMITIVE_FLOAT
           
protected static java.lang.String PRIMITIVE_INT
           
protected static java.lang.String PRIMITIVE_LONG
           
protected static java.lang.String PRIMITIVE_SHORT
           
static java.lang.String RENDERER_MAPPING_FILENAME
          The filename that will be looked up in each classpath element to load renderer classes automatically in the registry of JOI.
static java.lang.String RENDERER_MAPPING_FILENAME_ALL
           
static java.lang.String RENDERER_MAPPING_FILENAME_CLASSLOADER
           
 
Constructor Summary
Spy()
          Initialize the new instance with default values.
 
Method Summary
abstract  int getModifiers()
          Returns the declaration modifiers of the held object.
abstract  java.lang.String getName()
          Returns the name of the inspected object
protected static org.pfsw.joi.ClassAssociations<ObjectRenderer> getRendererRegistry()
           
abstract  java.lang.Class getType()
          Returns the type of the held object.
 java.lang.String getTypeString()
          Returns the string representation of the held object's type (class).
protected  java.lang.String getTypeStringOf(java.lang.Class clazz)
           
abstract  java.lang.Object getValue()
          Returns the value of the held object.
 java.awt.Component getValueComponent()
          Returns the visual component representation of the held object's value or null if such a visual representation is not available.
 java.lang.String getValueString()
          Returns the string representation of the held object's value.
 java.lang.String getValueTypeString()
          Returns the string representation of the held object value's type (class).
protected  java.lang.String invokeInspectString(java.lang.Object object)
           
 boolean is_boolean()
          Returns true if the type of the inspected object is boolean.
 boolean is_byte()
          Returns true if the type of the inspected object is byte.
 boolean is_char()
          Returns true if the type of the inspected object is char.
 boolean is_double()
          Returns true if the type of the inspected object is double.
 boolean is_float()
          Returns true if the type of the inspected object is float.
 boolean is_int()
          Returns true if the type of the inspected object is int.
 boolean is_long()
          Returns true if the type of the inspected object is long.
 boolean is_short()
          Returns true if the type of the inspected object is short.
 boolean isEditable()
          Returns true if the value of this spy can be modified.
 boolean isElementSpy()
          Returns true if this spy is an element spy.
 boolean isPrimitive()
          Returns true if the spyed object is a primitive type (e.g. int, boolean)
protected  java.awt.Component objectAsComponent(java.lang.Object object)
          Returns the visual component representation of the given object.
protected  java.lang.String objectAsString(java.lang.Object object)
          Returns the string representation of the given object.
protected  ObjectRenderer rendererFor(java.lang.Object object)
           
protected static void setRendererRegistry(org.pfsw.joi.ClassAssociations<ObjectRenderer> newValue)
           
 void setValue(java.lang.Object newValue)
          Sets the given object as the new value of the spy's inspected object Here this method does nothing.
 boolean valueIsNull()
          Returns whether or not the value of the underlying object is null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDERER_MAPPING_FILENAME

public static final java.lang.String RENDERER_MAPPING_FILENAME
The filename that will be looked up in each classpath element to load renderer classes automatically in the registry of JOI.
"META-INF/joi.renderer"

See Also:
Constant Field Values

RENDERER_MAPPING_FILENAME_CLASSLOADER

public static final java.lang.String RENDERER_MAPPING_FILENAME_CLASSLOADER
See Also:
Constant Field Values

RENDERER_MAPPING_FILENAME_ALL

public static final java.lang.String RENDERER_MAPPING_FILENAME_ALL
See Also:
Constant Field Values

PRIMITIVE_INT

protected static final java.lang.String PRIMITIVE_INT
See Also:
Constant Field Values

PRIMITIVE_LONG

protected static final java.lang.String PRIMITIVE_LONG
See Also:
Constant Field Values

PRIMITIVE_BOOLEAN

protected static final java.lang.String PRIMITIVE_BOOLEAN
See Also:
Constant Field Values

PRIMITIVE_DOUBLE

protected static final java.lang.String PRIMITIVE_DOUBLE
See Also:
Constant Field Values

PRIMITIVE_FLOAT

protected static final java.lang.String PRIMITIVE_FLOAT
See Also:
Constant Field Values

PRIMITIVE_SHORT

protected static final java.lang.String PRIMITIVE_SHORT
See Also:
Constant Field Values

PRIMITIVE_BYTE

protected static final java.lang.String PRIMITIVE_BYTE
See Also:
Constant Field Values

PRIMITIVE_CHAR

protected static final java.lang.String PRIMITIVE_CHAR
See Also:
Constant Field Values
Constructor Detail

Spy

public Spy()
Initialize the new instance with default values.

Method Detail

getRendererRegistry

protected static org.pfsw.joi.ClassAssociations<ObjectRenderer> getRendererRegistry()

setRendererRegistry

protected static void setRendererRegistry(org.pfsw.joi.ClassAssociations<ObjectRenderer> newValue)

getName

public abstract java.lang.String getName()
Returns the name of the inspected object


getType

public abstract java.lang.Class getType()
Returns the type of the held object.


getValue

public abstract java.lang.Object getValue()
                                   throws java.lang.Exception
Returns the value of the held object.

Throws:
java.lang.Exception

getModifiers

public abstract int getModifiers()
Returns the declaration modifiers of the held object.

See Also:
Modifier

getValueString

public java.lang.String getValueString()
                                throws java.lang.Exception
Returns the string representation of the held object's value.

Throws:
java.lang.Exception

getValueComponent

public java.awt.Component getValueComponent()
                                     throws java.lang.Exception
Returns the visual component representation of the held object's value or null if such a visual representation is not available.

Throws:
java.lang.Exception

getTypeString

public java.lang.String getTypeString()
Returns the string representation of the held object's type (class).


getValueTypeString

public java.lang.String getValueTypeString()
                                    throws java.lang.Exception
Returns the string representation of the held object value's type (class).

Throws:
java.lang.Exception

valueIsNull

public boolean valueIsNull()
                    throws java.lang.Exception
Returns whether or not the value of the underlying object is null

Throws:
java.lang.Exception

isElementSpy

public boolean isElementSpy()
Returns true if this spy is an element spy. Subclasses may override this to return true ;


isPrimitive

public boolean isPrimitive()
Returns true if the spyed object is a primitive type (e.g. int, boolean)


isEditable

public boolean isEditable()
Returns true if the value of this spy can be modified. This method always returns false. Subclasses my override this method to return true if appropriate.


setValue

public void setValue(java.lang.Object newValue)
              throws java.lang.Exception
Sets the given object as the new value of the spy's inspected object Here this method does nothing. Subclasses may override it to implement the actual modification. This method should only be overriden if isEditable() is also overriden to return true!

Throws:
java.lang.Exception

is_int

public boolean is_int()
Returns true if the type of the inspected object is int.


is_long

public boolean is_long()
Returns true if the type of the inspected object is long.


is_short

public boolean is_short()
Returns true if the type of the inspected object is short.


is_byte

public boolean is_byte()
Returns true if the type of the inspected object is byte.


is_char

public boolean is_char()
Returns true if the type of the inspected object is char.


is_boolean

public boolean is_boolean()
Returns true if the type of the inspected object is boolean.


is_double

public boolean is_double()
Returns true if the type of the inspected object is double.


is_float

public boolean is_float()
Returns true if the type of the inspected object is float.


getTypeStringOf

protected java.lang.String getTypeStringOf(java.lang.Class clazz)

rendererFor

protected ObjectRenderer rendererFor(java.lang.Object object)

objectAsString

protected java.lang.String objectAsString(java.lang.Object object)
Returns the string representation of the given object.


objectAsComponent

protected java.awt.Component objectAsComponent(java.lang.Object object)
Returns the visual component representation of the given object. If no such representation is available it returns null.


invokeInspectString

protected java.lang.String invokeInspectString(java.lang.Object object)