Top Description Inners Constructors Methods
org.python.core.adapter

public Class ClassicPyObjectAdapter

extends ExtensiblePyObjectAdapter
Class Inheritance
Imports
java.math.BigInteger, org.python.core.Py, .PyArray, .PyFloat, .PyInteger, .PyJavaType, .PyLong, .PyObject, .PyProxy, .PyType, .PyUnicode

Implements the algorithm originally used in Py#java2py to adapt objects. Pre-class adapters are added to handle instances of PyObject, PyProxy and null values. Class adapters are added to handle builtin Java classes: String, Integer, Float, Double, Byte, Long, Short, Character, Class and Boolean. An adapter is added to the post-class adapters to handle wrapping arrays properly. Finally, if all of the added adapters can handle an object, it's wrapped in a PyJavaInstance.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PyObject
adapt(Object o)

Overrides org.python.core.adapter.ExtensiblePyObjectAdapter.adapt.

Implements org.python.core.adapter.PyObjectAdapter.adapt.

Attempts to adapt o using the preClass, class and postClass adapters.

public boolean
canAdapt(Object o)

Overrides org.python.core.adapter.ExtensiblePyObjectAdapter.canAdapt.

Implements org.python.core.adapter.PyObjectAdapter.canAdapt.

Always returns true as we just return new PyJavaInstance(o) if the adapters added to the superclass can't handle o.

Inherited from org.python.core.adapter.ExtensiblePyObjectAdapter:
addaddPostClassaddPreClass

Constructor Detail

ClassicPyObjectAdapterback to summary
public ClassicPyObjectAdapter()

Method Detail

adaptback to summary
public PyObject adapt(Object o)

Overrides org.python.core.adapter.ExtensiblePyObjectAdapter.adapt.

Implements org.python.core.adapter.PyObjectAdapter.adapt.

Doc from org.python.core.adapter.ExtensiblePyObjectAdapter.adapt.

Attempts to adapt o using the preClass, class and postClass adapters. First each of the preClass adapters is asked in the order of addition if they can adapt o. If so, they adapt it. Otherwise, if o.getClass() is equal to one of the classes from the added ClassAdapters, that class adapter is used. Finally, each of the post class adapters are asked in turn if they can adapt o. If so, that adapter handles it. If none can, null is returned.

Annotations
@Override
canAdaptback to summary
public boolean canAdapt(Object o)

Overrides org.python.core.adapter.ExtensiblePyObjectAdapter.canAdapt.

Implements org.python.core.adapter.PyObjectAdapter.canAdapt.

Always returns true as we just return new PyJavaInstance(o) if the adapters added to the superclass can't handle o.

Returns:boolean

Doc from org.python.core.adapter.ExtensiblePyObjectAdapter.canAdapt.

true if a preClass, postClass or class adapter can handle this

Annotations
@Override

org.python.core.adapter back to summary

private Class ClassicPyObjectAdapter.NumberToPyFloat

extends ClassAdapter
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PyObject
adapt(Object o)

Implements org.python.core.adapter.PyObjectAdapter.adapt.

Returns the PyObject version of o or null if canAdapt(o) returns false.

Inherited from org.python.core.adapter.ClassAdapter:
canAdaptgetAdaptedClass

Constructor Detail

NumberToPyFloatback to summary
public NumberToPyFloat(Class<T> c)

Method Detail

adaptback to summary
public PyObject adapt(Object o)

Implements org.python.core.adapter.PyObjectAdapter.adapt.

Doc from org.python.core.adapter.PyObjectAdapter.adapt.

Returns the PyObject version of o or null if canAdapt(o) returns false.

Annotations
@Override
org.python.core.adapter back to summary

private Class ClassicPyObjectAdapter.NumberToPyInteger

extends ClassAdapter
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PyObject
adapt(Object o)

Implements org.python.core.adapter.PyObjectAdapter.adapt.

Returns the PyObject version of o or null if canAdapt(o) returns false.

Inherited from org.python.core.adapter.ClassAdapter:
canAdaptgetAdaptedClass

Constructor Detail

NumberToPyIntegerback to summary
public NumberToPyInteger(Class<T> c)

Method Detail

adaptback to summary
public PyObject adapt(Object o)

Implements org.python.core.adapter.PyObjectAdapter.adapt.

Doc from org.python.core.adapter.PyObjectAdapter.adapt.

Returns the PyObject version of o or null if canAdapt(o) returns false.

Annotations
@Override