Package twisted :: Package python :: Module components :: Class AdapterRegistry

[frames | no frames]

## Class AdapterRegistry

Method Summary
| `__init__(self)`
| ``getAdapter`(self, obj, interfaceClass, default, adapterClassLocator, persist)` Return an object that implements the given interface.
| ``getAdapterClass`(self, fromInterface, toInterface, default)` Return registered adapter for a given class and interface.
| ``getAdapterClassWithInheritance`(self, klass, interfaceClass, default)` Return registered adapter for a given class and interface.
| ``getAdapterFactory`(self, fromInterface, toInterface, default)` Return registered adapter for a given class and interface.
| `persistAdapter(self, original, iface, adapter)`
| ``registerAdapter`(self, adapterFactory, origInterface, *interfaceClasses)` Register an adapter class.

Method Details

### getAdapter(self, obj, interfaceClass, default=<class twisted.python.components._Nothing at 0x8199e3c>, adapterClassLocator=None, persist=None)

Return an object that implements the given interface.

The result will be a wrapper around the object passed as a parameter, or the parameter itself if it already implements the interface. If no adapter can be found, the 'default' parameter will be returned.

### getAdapterClass(self, fromInterface, toInterface, default)

Return registered adapter for a given class and interface.

### getAdapterClassWithInheritance(self, klass, interfaceClass, default)

Return registered adapter for a given class and interface.

### getAdapterFactory(self, fromInterface, toInterface, default)

Return registered adapter for a given class and interface.

### registerAdapter(self, adapterFactory, origInterface, *interfaceClasses)

Register an adapter class.

An adapter class is expected to implement the given interface, by adapting instances implementing 'origInterface'. An adapter class's __init__ method should accept one parameter, an instance implementing 'origInterface'.

Generated by Epydoc 2.0 on Sat May 15 20:08:42 2004 | http://epydoc.sf.net