org.pfsw.joi
Class AbstractObjectSpy

java.lang.Object
  extended by org.pfsw.joi.Spy
      extended by org.pfsw.joi.AbstractObjectSpy
Direct Known Subclasses:
ArraySpy, AssociationListSpy, DictionarySpy, DynamicProxySpy, ListSpy, MapSpy, ObjectSpy, StringSpy

public abstract class AbstractObjectSpy
extends Spy

An instance of this class is a wrapper for one inspected object. It provides the API an inspector is using, to display internal information about the inspected object.


Field Summary
 
Fields inherited from class org.pfsw.joi.Spy
PRIMITIVE_BOOLEAN, PRIMITIVE_BYTE, PRIMITIVE_CHAR, PRIMITIVE_DOUBLE, PRIMITIVE_FLOAT, PRIMITIVE_INT, PRIMITIVE_LONG, PRIMITIVE_SHORT, RENDERER_MAPPING_FILENAME, RENDERER_MAPPING_FILENAME_ALL, RENDERER_MAPPING_FILENAME_CLASSLOADER
 
Constructor Summary
AbstractObjectSpy(java.lang.Object obj)
          Initialize the new instance with default values.
 
Method Summary
protected abstract  void addAllElements()
           
protected  boolean allowsElementModification()
          Returns true if this object allows the modification of its elements.
protected  boolean canBeSorted()
          Returns whether or not the elements of the underlying object can be sorted.
protected  java.util.List createNewElementList()
           
 ElementFilter getElementFilter()
           
protected  java.util.List getElementHolders()
           
 ElementSpy getElementNamed(java.lang.String elementName)
          Returns the element with the given name or null if no such element can be found in the receiver.
 java.util.List getElements()
          Returns all elements, i.e. including inherited elements as List.
 int getFullElementCount()
          Returns the number of elements ignoring all filter criteria.
 int getModifiers()
          Returns the bit mask indicating the modifiers of the class declaration.
 java.lang.String getName()
          Returns the name of the inspected object
 java.lang.Object getObject()
           
 java.lang.Class getType()
          Returns the type (class) of the underlying object.
 java.lang.Object getValue()
          Returns the value of the underlying object.
protected  void initializeElements()
           
 void setElementFilter(ElementFilter aValue)
           
protected  void setElementHolders(java.util.List newValue)
           
protected  void setElementValue(ElementSpy element, java.lang.Object value)
          Sets the value of the specified element to the given value.
 void setName(java.lang.String newValue)
           
protected  void setObject(java.lang.Object newValue)
           
 boolean sortElements()
          Sorts all elements of the underlying object in ascending order.
 
Methods inherited from class org.pfsw.joi.Spy
getRendererRegistry, getTypeString, getTypeStringOf, getValueComponent, getValueString, getValueTypeString, invokeInspectString, is_boolean, is_byte, is_char, is_double, is_float, is_int, is_long, is_short, isEditable, isElementSpy, isPrimitive, objectAsComponent, objectAsString, rendererFor, setRendererRegistry, setValue, valueIsNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractObjectSpy

public AbstractObjectSpy(java.lang.Object obj)
                  throws java.lang.SecurityException
Initialize the new instance with default values.

Throws:
java.lang.SecurityException
Method Detail

getName

public java.lang.String getName()
Description copied from class: Spy
Returns the name of the inspected object

Specified by:
getName in class Spy

setName

public void setName(java.lang.String newValue)

getObject

public java.lang.Object getObject()

setObject

protected void setObject(java.lang.Object newValue)

getElementHolders

protected java.util.List getElementHolders()

setElementHolders

protected void setElementHolders(java.util.List newValue)

getElementFilter

public ElementFilter getElementFilter()

setElementFilter

public void setElementFilter(ElementFilter aValue)

getType

public java.lang.Class getType()
Returns the type (class) of the underlying object.

Specified by:
getType in class Spy

getValue

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

Specified by:
getValue in class Spy
Throws:
java.lang.Exception

getModifiers

public int getModifiers()
Returns the bit mask indicating the modifiers of the class declaration.

Specified by:
getModifiers in class Spy
See Also:
Modifier

getElements

public java.util.List getElements()
Returns all elements, i.e. including inherited elements as List.
This method is using the current filter, to filter out elements with specific modifiers.


getFullElementCount

public int getFullElementCount()
Returns the number of elements ignoring all filter criteria.


getElementNamed

public ElementSpy getElementNamed(java.lang.String elementName)
Returns the element with the given name or null if no such element can be found in the receiver.


addAllElements

protected abstract void addAllElements()

initializeElements

protected void initializeElements()
                           throws java.lang.SecurityException
Throws:
java.lang.SecurityException

createNewElementList

protected java.util.List createNewElementList()

canBeSorted

protected boolean canBeSorted()
Returns whether or not the elements of the underlying object can be sorted.


sortElements

public boolean sortElements()
Sorts all elements of the underlying object in ascending order.


allowsElementModification

protected boolean allowsElementModification()
Returns true if this object allows the modification of its elements. Here the methods alwys returns false. Subclasses may override it to return true. Such a subclass must override setElementValue() as well.


setElementValue

protected void setElementValue(ElementSpy element,
                               java.lang.Object value)
                        throws java.lang.Exception
Sets the value of the specified element to the given value. This abstract implementation throws a not supported expection. Subclasses may override to do the modification. Such a subclass must override allowsElementModification() as well.

Throws:
java.lang.Exception