ExtensiblePyObjectAdapter (Jython API documentation)
Date: 2012-08-13

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.python.core.adapter
Class ExtensiblePyObjectAdapter

    java.lang.Object
      org.python.core.adapter.ExtensiblePyObjectAdapter

All Implemented Interfaces:
  PyObjectAdapter

Direct Known Subclasses:
  ClassicPyObjectAdapter

    public class ExtensiblePyObjectAdapter

extends Object
implements PyObjectAdapter

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

Constructor Summary
`ExtensiblePyObjectAdapter()`

Method Summary
`PyObject` | `adapt(Object o)` Attempts to adapt o using the preClass, class and postClass adapters.
`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.
`void` | `addPostClass(PyObjectAdapter converter)` Adds an adapter to the list of adapters to be tried after the ClassAdapters.
`void` | `addPreClass(PyObjectAdapter adapter)` Adds an adapter to the list of adapters to be tried before the ClassAdapters.
`boolean` | `canAdapt(Object o)` Returns true if o can be adapted by this adapter.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ExtensiblePyObjectAdapter

    public ExtensiblePyObjectAdapter()

Method Detail

### canAdapt

    public boolean canAdapt(Object o)

  Description copied from interface: `PyObjectAdapter`
  Returns true if o can be adapted by this adapter.

  Specified by:
    `canAdapt` in interface `PyObjectAdapter`
  Returns:
    true if a preClass, postClass or class adapter can handle this

### adapt

    public PyObject adapt(Object o)

  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.

  Specified by:
    `adapt` in interface `PyObjectAdapter`

### addPreClass

    public void addPreClass(PyObjectAdapter adapter)

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

### add

    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.

### addPostClass

    public void addPostClass(PyObjectAdapter converter)

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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Jython homepage