cz.cuni.pogamut.introspection
Class DefaultIntrospectableProxy<T>

java.lang.Object
  extended by cz.cuni.pogamut.introspection.DefaultIntrospectableProxy<T>
All Implemented Interfaces:
IntrospectableProxy
Direct Known Subclasses:
IntrospectableProxyUnion, JavaReflectionProxy, PythonInstrospectableProxy, ScriptProxy

public abstract class DefaultIntrospectableProxy<T>
extends java.lang.Object
implements IntrospectableProxy

This is wrapper class for introspectable objects. You have to give it object to be introspected in the constructor and implement methods computing array of properties and array of children objects (computeProperties() and computeChildren()). This abstract implementation caches computed results and returns them by getProperties() and getChildren() methods.


Field Summary
private  IntrospectableProxy[] children
          Array of introspectable children of object represented by this proxy computed by computeChildren(object).
private  T object
          Object represented by this proxy.
private  Property[] properties
          Array of properties of object represented by this proxy computed by computeProperties(object).
 
Constructor Summary
DefaultIntrospectableProxy(T object)
          Creates a new instance of IntrospectableProxy and bind it with given object.
 
Method Summary
protected abstract  IntrospectableProxy[] computeChildren(T object)
          Computes list of introspectable children of object to be introspected.
protected abstract  Property[] computeProperties(T object)
          Computes list of properties of object to be introspected.
 IntrospectableProxy[] getChildren()
          Returns lazy initialized list of children.
 java.lang.String getName()
          Returns getProxiedObject().toString(); It is strongly recomended to override this method.
 Property[] getProperties()
          Returns lazy initialized list of properties.
protected  T getProxiedObject()
          Return object proxied by this IntrospectableProxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.pogamut.introspection.IntrospectableProxy
closeIntrospection
 

Field Detail

children

private IntrospectableProxy[] children
Array of introspectable children of object represented by this proxy computed by computeChildren(object).


properties

private Property[] properties
Array of properties of object represented by this proxy computed by computeProperties(object).


object

private T object
Object represented by this proxy.

Constructor Detail

DefaultIntrospectableProxy

public DefaultIntrospectableProxy(T object)
Creates a new instance of IntrospectableProxy and bind it with given object.

Parameters:
object - Object to be introspected.
Method Detail

getChildren

public IntrospectableProxy[] getChildren()
Returns lazy initialized list of children.

Specified by:
getChildren in interface IntrospectableProxy
Returns:
list of children

getProperties

public Property[] getProperties()
Returns lazy initialized list of properties.

Specified by:
getProperties in interface IntrospectableProxy
Returns:
list of properties

getName

public java.lang.String getName()
Returns getProxiedObject().toString(); It is strongly recomended to override this method.

Specified by:
getName in interface IntrospectableProxy
Returns:
getProxiedObject().toString();

computeProperties

protected abstract Property[] computeProperties(T object)
Computes list of properties of object to be introspected.

Parameters:
object - Object to be introspected.
Returns:
Array of properties.

computeChildren

protected abstract IntrospectableProxy[] computeChildren(T object)
Computes list of introspectable children of object to be introspected.

Parameters:
object - Object to be introspected.
Returns:
Array of introspectable children.

getProxiedObject

protected T getProxiedObject()
Return object proxied by this IntrospectableProxy.

Returns:
An object proxied by this IntrospectableProxy.