Modifier and Type | Method and Description |
---|---|
PyObject |
call(String name,
Object... args)
Call the callable Python object with the given name and arguments.
|
PyObject |
callMethod(String name,
Object... args)
Call the callable Python method with the given name and arguments.
|
<T> T |
createProxy(Class<T> type)
Create a Java proxy instance of this Python object which contains compatible methods to the ones provided in the
interface given by the
type parameter. |
Object |
createProxy(PyLib.CallableKind callableKind,
Class<?>... types)
Create a Java proxy instance of this Python object (or module) which contains compatible methods
(or functions) to the ones provided in the interfaces given by all the
type parameters. |
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
protected void |
finalize()
Decrements the reference count of the Python object which this class represents.
|
PyObject |
getAttribute(String name)
Gets the Python value of a Python attribute.
|
<T> T |
getAttribute(String name,
Class<T> valueType)
Gets the value of a Python attribute as Java object of a given type.
|
double |
getDoubleValue() |
int |
getIntValue() |
<T> T[] |
getObjectArrayValue(Class<T> itemType)
Gets this Python object as Java
Object[] value of the given item type. |
Object |
getObjectValue()
Gets this Python object as Java
Object value. |
long |
getPointer() |
String |
getStringValue() |
int |
hashCode()
Computes a hash code from this object's pointer value.
|
void |
setAttribute(String name,
Object value)
Sets the value of a Python attribute from the given Java object.
|
<T> void |
setAttribute(String name,
T value,
Class<T> valueType)
Sets the value of a Python attribute from the given Java object and Java type (if given).
|
String |
toString()
Gets a string representation of the object using the format "PyObject(pointer=
|
protected void finalize() throws Throwable
public final long getPointer()
public int getIntValue()
int
value.public double getDoubleValue()
double
value.public String getStringValue()
String
value.public Object getObjectValue()
Object
value.
Appropriate type conversions from Python to Java will be performed as needed.
If this Python object cannot be converted into a Java object, a Java wrapper of type PyObject
will be returned.
If this Python object is a wrapped Java object, it will be unwrapped.Object
value.public <T> T[] getObjectArrayValue(Class<T> itemType)
Object[]
value of the given item type.
Appropriate type conversions from Python to Java will be performed as needed.
If a Python item value cannot be converted into a Java item object, a Java wrapper of type PyObject
will be returned.
If a Python item value is a wrapped Java object, it will be unwrapped.
If this Python object value is a wrapped Java array object of given type, it will be unwrapped.Object[]
value.public PyObject getAttribute(String name)
name
- A name of the Python attribute.public <T> T getAttribute(String name, Class<T> valueType)
PyObject
will be returned.
If the Python value is a wrapped Java object, it will be unwrapped.name
- A name of the Python attribute.valueType
- The type of the value or null
, if unknownpublic void setAttribute(String name, Object value)
PyObject
, it will be unwrapped.name
- A name of the Python attribute.value
- The new attribute value as Java object.public <T> void setAttribute(String name, T value, Class<T> valueType)
PyObject
, it will be unwrapped.name
- A name of the Python attribute.value
- The new attribute value as Java object.valueType
- The value type used for the conversion. May be null
.public PyObject callMethod(String name, Object... args)
name
- A name of a Python attribute that evaluates to a callable object.args
- The arguments for the method call.public PyObject call(String name, Object... args)
name
- A name of a Python attribute that evaluates to a callable object,args
- The arguments for the call.public <T> T createProxy(Class<T> type)
type
parameter.T
- The interface name.type
- The interface's type.public Object createProxy(PyLib.CallableKind callableKind, Class<?>... types)
type
parameters.callableKind
- The kind of calls to be made.types
- The interface types.public final String toString()
toString
in class Object
getPointer()
public final boolean equals(Object o)
equals
in class Object
o
- The other object.true
if the other object is an instance of PyObject
and if their pointers are equal, false
otherwise.getPointer()
public final int hashCode()
hashCode
in class Object
getPointer()
Copyright © 2014 Brockmann Consult GmbH. All rights reserved.