cz.cuni.pogamut.introspection.java
Class JavaReflectionProxy

java.lang.Object
  extended by cz.cuni.pogamut.introspection.DefaultIntrospectableProxy<java.lang.Object>
      extended by cz.cuni.pogamut.introspection.java.JavaReflectionProxy
All Implemented Interfaces:
IntrospectableProxy

public class JavaReflectionProxy
extends DefaultIntrospectableProxy<java.lang.Object>

Implementation of automatic object introspection using Java Reflection API. Primitive public fields of object (see javadoc fo list of primitive types) marked by PogProp annotation are returned as Properties, unknown more complicated types implementing Introspectable interface are returned as Children for further introspection. TODO annotations arent working ... fix it

All returned properties are for now uneditable. Just for the sake of simplicity.

THIS EXAMPLE IMPLEMENTATION DOESN'T DEAL WITH INHERITANCE.


Field Summary
private  java.util.Set<IntrospectableProxyChangeListener> listeners
          Listeners for change
 
Constructor Summary
JavaReflectionProxy(java.lang.Object object)
          Creates a new instance of JavaReflectionProxy
 
Method Summary
 void closeIntrospection()
          This should clean up any bindings the IntrospectableProxy might have with the object it introspects to allow GC collect the object.
protected  IntrospectableProxy[] computeChildren(java.lang.Object object)
          All data fields of introspected object that implement Introspectable interface are added to the list of children.
protected  Property[] computeProperties(java.lang.Object object)
          All data fields which are marked by @PogProp annotation and PropertyEditorManager can find editor for them are recognized as Properties of introspectable proxy and are returned by this method.
protected  java.util.Collection<Property> getDeclaredProperties(java.lang.Class cls, java.lang.Object object)
          Get all PogProperties from given class.
protected  java.util.Collection<IntrospectableProxy> getDeclaredProxies(java.lang.Class cls, java.lang.Object object)
          Get all IntrospectableProxies from given class.
 
Methods inherited from class cz.cuni.pogamut.introspection.DefaultIntrospectableProxy
getChildren, getName, getProperties, getProxiedObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

private java.util.Set<IntrospectableProxyChangeListener> listeners
Listeners for change

Constructor Detail

JavaReflectionProxy

public JavaReflectionProxy(java.lang.Object object)
Creates a new instance of JavaReflectionProxy

Method Detail

getDeclaredProperties

protected java.util.Collection<Property> getDeclaredProperties(java.lang.Class cls,
                                                               java.lang.Object object)
Get all PogProperties from given class.


getDeclaredProxies

protected java.util.Collection<IntrospectableProxy> getDeclaredProxies(java.lang.Class cls,
                                                                       java.lang.Object object)
Get all IntrospectableProxies from given class.


computeProperties

protected Property[] computeProperties(java.lang.Object object)
All data fields which are marked by @PogProp annotation and PropertyEditorManager can find editor for them are recognized as Properties of introspectable proxy and are returned by this method.

Specified by:
computeProperties in class DefaultIntrospectableProxy<java.lang.Object>
Parameters:
object - Object to be introspected.
Returns:
Array of properties.

computeChildren

protected IntrospectableProxy[] computeChildren(java.lang.Object object)
All data fields of introspected object that implement Introspectable interface are added to the list of children.

Specified by:
computeChildren in class DefaultIntrospectableProxy<java.lang.Object>
Parameters:
object - Object to be introspected.
Returns:
Array of introspectable children.

closeIntrospection

public void closeIntrospection()
This should clean up any bindings the IntrospectableProxy might have with the object it introspects to allow GC collect the object.