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

[show private | hide private]
[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..., 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 1.1 on Thu May 8 13:16:48 2003 | http://epydoc.sf.net