|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.pogamut.introspection.python.PyObjectAdapter
public class PyObjectAdapter
This class is wrapper for PyObject which probes the PyObject for it's type and accessibility and provides methods neccessary for introspection of the PyObject If you want to extend the number of classes the Python introspection accepts, than simply create class PyNewClassWrapper extends PyObjectWrapper and add it to a PyObjectAdapater.probeObject() body. The problem with Python introspection is, that we can't rely on the information about the wrapper of the object in stored place as it can change between two calls of PyObjectAdapter methods. That's why the method getWrapper() has as an parametr PyObject. It's advised to use the adapter like this: 1) retrieve PyObject object = adapter.getPyObject() 2) retrieve PyObjectWrapper wrapper = adapter.getWrapper(object) 3) get java representation of the object from the wrapper or set the value to the engine using adapter.set(wrapper, newValue)
Field Summary | |
---|---|
private java.lang.String |
name
Visual name of the property. |
private PyObjectPlace |
place
Place of the wrapped object ... if the set() is called this object determines where to write the new value. |
Constructor Summary | |
---|---|
private |
PyObjectAdapter(java.lang.String name)
Basic initialization of the class. |
|
PyObjectAdapter(java.lang.String name,
PyObjectPlace place)
Initialize the read-write adapter for wrapped PyObject. |
Method Summary | |
---|---|
java.util.ArrayList<PyObjectAdapter> |
getChildren()
Returns array list of childrens. |
java.lang.Object |
getJavaObject()
Returns java representation of the object. |
java.lang.String |
getName()
|
java.lang.Object |
getObject()
Returns wrapped object. |
PyObjectWrapper |
getWrapper(java.lang.Object object)
The problem with Python introspection is, that we can't rely on the information about the wrapper of the object in stored place as it can change between two calls of PyObjectAdapter methods. |
boolean |
hasChildren()
Whether the object has children ... ... is list / dictionary / tuple / instance |
void |
set(PyObjectWrapper wrapper,
java.lang.Object newValue)
This accepts java class instance which is proper for the object it wrappes - it uses wrapper.getNewValue() for obtaining the PyObject representation of the java object and then it uses place.set() to insert the new value to it's correct place in another python object. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String name
private PyObjectPlace place
Constructor Detail |
---|
private PyObjectAdapter(java.lang.String name)
object
- place
- public PyObjectAdapter(java.lang.String name, PyObjectPlace place)
name
- place
- Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.ArrayList<PyObjectAdapter> getChildren()
public java.lang.String getName()
public PyObjectWrapper getWrapper(java.lang.Object object)
object
-
public java.lang.Object getObject()
public java.lang.Object getJavaObject()
public void set(PyObjectWrapper wrapper, java.lang.Object newValue)
newValue
- java objectpublic boolean hasChildren()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |