Package twisted :: Package python :: Module components

[show private | hide private]
[frames | no frames]

## Module twisted.python.components

Component architecture for Twisted.

Classes
`Interface` | Base class for interfaces.
`Componentized` | I am a mixin to allow you to be adapted in various ways persistently.

Function Summary
| ``implements`(obj, interfaceClass)` Return boolean indicating if obj implements the given interface.
| ``getInterfaces`(obj)` Return list of all interfaces a class implements.
| ``superInterfaces`(interface)` Given an interface, return list of super-interfaces (including itself).
| ``registerAdapter`(adapterClass, origClass, interfaceClass)` Register an adapter class.
| ``getAdapterClass`(klass, interfaceClass, default)` Return registered adapter for a given class and interface.
| ``getAdapter`(obj, interfaceClass, default, adapterClassLocator)` Return an object that implements the given interface.

Function Details

### getAdapter(obj, interfaceClass, default=<class twisted.python.components._default at..., adapterClassLocator=None)

Return an object that implements the given interface.

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

### getAdapterClass(klass, interfaceClass, default)

Return registered adapter for a given class and interface.

### getInterfaces(obj)

Return list of all interfaces a class implements.

### implements(obj, interfaceClass)

Return boolean indicating if obj implements the given interface.

### registerAdapter(adapterClass, origClass, interfaceClass)

Register an adapter class.

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

### superInterfaces(interface)

Given an interface, return list of super-interfaces (including itself).

Generated by Epydoc 1.1 on Sat Feb 15 21:18:04 2003 | http://epydoc.sf.net