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

public Class ExtensiblePyObjectAdapter

extends Object
implements PyObjectAdapter
Class Inheritance
All Implemented Interfaces
org.python.core.adapter.PyObjectAdapter
Known Direct Subclasses
org.python.core.adapter.ClassicPyObjectAdapter
Imports
java.util.ArrayList, .HashMap, .Iterator, .List, .Map, org.python.core.PyObject

A PyObjectAdapter attempts to adapt a Java Object with three user fillable groups of adapters: preClass, class and postClass.

Field Summary

Modifier and TypeField and Description
private Map<K, V>
private List<E>
private List<E>

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.

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

public void
add(ClassAdapter adapter)

Adds a Class handling adapter that will adapt any objects of its Class if that object hasn't already been handled by one of the pre class adapters.

public void
addPostClass(PyObjectAdapter converter)

Adds an adapter to the list of adapters to be tried after the ClassAdapters.

public void
addPreClass(PyObjectAdapter adapter)

Adds an adapter to the list of adapters to be tried before the ClassAdapters.

public boolean

Returns:

true if a preClass, postClass or class adapter can handle this
canAdapt
(Object o)

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

Returns true if o can be adapted by this adapter.

private static PyObjectAdapter
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classAdaptersback to summary
private Map<K, V> classAdapters
postClassAdaptersback to summary
private List<E> postClassAdapters
preClassAdaptersback to summary
private List<E> preClassAdapters

Constructor Detail

ExtensiblePyObjectAdapterback to summary
public ExtensiblePyObjectAdapter()

Method Detail

adaptback to summary
public PyObject adapt(Object o)

Implements org.python.core.adapter.PyObjectAdapter.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.

addback to summary
public void add(ClassAdapter adapter)

Adds a Class handling adapter that will adapt any objects of its Class if that object hasn't already been handled by one of the pre class adapters.

addPostClassback to summary
public void addPostClass(PyObjectAdapter converter)

Adds an adapter to the list of adapters to be tried after the ClassAdapters.

addPreClassback to summary
public void addPreClass(PyObjectAdapter adapter)

Adds an adapter to the list of adapters to be tried before the ClassAdapters.

canAdaptback to summary
public boolean canAdapt(Object o)

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

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

Returns true if o can be adapted by this adapter.

Returns:boolean

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

findAdapterback to summary
private static PyObjectAdapter findAdapter(List<E> l, Object o)