Interface Interfaces
Interface objects
Interface objects describe how an object works. The provide a name and documentation for an interface, and a list of Attribute and Method objects that define the interface.
All Interface objects define the following methods:
-
getName - Returns the name of the object.
-
getDoc - Returns the documentation for the object.
-
setTaggedValue(tag, value) - Associates
valueto the object with the tagtag. -
getTaggedValue(tag) - Returns the value associated with
key. -
getTaggedValueTags() - Returns a list of all tags associated with this object.
Interface object methods
-
getBases - Returns a sequence of base interfaces this interface extends.
-
extends(other) - Does this interface extend the
otherinterface? Returns true or false. -
isImplementedBy(object) - Does
objectimplement this interface? Returns true or false. -
isImplementedByInstancesOf(klass) - Does the class
klassimplement this interface? Returns true or false. -
names() - Returns a list of names of Attributes and Methods that
define this interface.
- JimFulton? 2000-12-9
- Note that methods are attributes, so this should say: "Returns a list of names of Attributes (including Methods) that define this interface"
-
namesAndDescriptions() - Returns a mapping from name to description
objects. Description objects are of type
AttributeorMethod.namesAndDescriptions().keys()is equivalent tonames(). -
getDescriptionFor(name, default=None) - Returns the description
object for
nameif it exists, otherwise returnsdefault. -
deferred() - Returns a deferred class that implements the
interface. This class can then be subclasses and the individual
attributes and methods overridden with concrete implementations.
Instances of this class that try to call deferred methods that
haven't been overridden will raise an
Interface.BrokenImplementationexception.
Method objects
Method objects describe interesting meta data about Interface
methods.
Method object methods
-
getSignatureInfo() - returns a mapping from signature
info keys to their values. Current signature info keys are:
- positional
- A sequence of argument names in proper positional
order.
- JimFulton? 2000-12-9
- Hm. This doesn't look quite right. I suggest
that instead of positiona, required, and optional, we have instead
a sequence of parameter objects, where parameter objects have methods
(or attributes) for getting:
- name
- the parameter type
- type
- An interface, interface tuple, python type, python class, or None
- default
- Default value.
- optional
- a flag indicating if it is optional
tagged values.
Maybe you should have a flag indicating whether a parameter is a returned or input parameter (ala UML) or have separate returned-value meta-data.
- required
- A sequence of argument names that are required.
- optional
- A mapping from optional argument names to their default values.
- varargs
- A boolean value, true if the method can accept arbitrary arguments, false otherwise.
- kwargs
- A boolean value, true if the method can accept arbitrary keyword arguments, false otherwise.
-
getSignatureRepr() - Returns a human readable string
representation of the methods signature, for example:
(one, two="foo", **kws)- JimFulton? 2000-12-9
- Reprs atr not for humans. I suggest getSignatureString instead.