The PEAK Developers' Center   Diff for "StructuralFeature" UserPreferences
 
HelpContents Search Diffs Info Edit Subscribe XML Print View
Ignore changes in the amount of whitespace

Differences between version dated 2004-02-22 18:31:15 and 2007-08-11 11:37:37 (spanning 5 versions)

Deletions are marked like this.
Additions are marked like this.

StructuralFeature is the base class for "method-exporting properties", such as model.Attribute, model.Collection, etc.
#format rst
 
The following class members affect how StructuralFeatures are used:
``StructuralFeature`` is the base class for "method-exporting
properties", such as model.Attribute, model.Collection, etc.
 
(note, ``peak help IFeature`` and ``peak help IFeatureSPI`` for more
information.. this is just my "scratch book" for figuring out how this
stuff ties together since that is not documented on the interface or
implementation)
 
'''isDerived'''
    Used for "abstract based models". If `True`, it raises `NotImplementedError` on get, and acts immutable (see isChangeable).
The following class members affect how StructuralFeatures are used:
 
    '''type''': `bool` [[BR]]
    '''default''': `False` [[BR]]
    '''set by''': DerivedFeature (`True`)
    
'''isChangeable'''
    Is the slot mutable? If `False`, it prevents the attribute from being set or unset.
 
    '''type''': `bool` [[BR]]
    '''default''': `lambda self: not self.isDerived` [[BR]]
    '''set by''': structField (`True`), DerivedFeature (`True` indirectly)
isDerived
    Used for computed attributes. If ``True``, it raises ``NotImplementedError`` on get,
    and acts immutable (see ``isChangeable``). You must define a ``get()`` method on the
    feature that computes the intended value.
 
    :type: ``bool``
    :default: ``False``
    :set by: ``DerivedFeature`` (``True``)
 
isChangeable
    Is the slot mutable? If ``False``, it prevents the attribute from being set or unset.
 
    :type: ``bool``
    :default: ``lambda self: not self.isDerived``
    :set by: structField (``True``), ``DerivedFeature`` (``True`` indirectly)
 
'''isComposite'''
isComposite
    XXX (is this deprecated, or just obscure?)
 
    '''type''': `bool` [[BR]]
    '''default''': `False` [[BR]]
    '''set by''': Users (?)
 
'''isOrdered'''
    Is the slot an ordered collection? If `True`, it enables the `insertBefore%s` accessor. Note that it is only meaningful if isMany is also `True`.
    
    '''type''': `bool` [[BR]]
    '''default''': `False` [[BR]]
    '''set by''': Sequence (`True`)
 
'''useSlot'''
    Should this slot use a prefixed `__dict__` slot? If `True`, the implementation uses `_f_%s` as the slot name, otherwise `%s` is used.
 
    '''type''': `bool` [[BR]]
    '''default''': `False` [[BR]]
    '''set by''': Users (?)
 
'''lowerBound'''
    The minimum number of elements that can occupy this slot. `0` means that a value is not required (see isRequired). Integers less than `0` are unchecked degenerate values.
 
    '''type''': `int` [[BR]]
    '''default''': `0` [[BR]]
    '''set by''': XXX
 
'''upperBound'''
    The maximum number of elements that can occupy this slot. `None` means no limit, `1` means that this slot is not a collection (see isMany). Integers less than `1` are unchecked degenerate values.
 
    '''type''': `int` or `None` [[BR]]
    '''default''': `None` [[BR]]
    '''set by''': Attribute (`1`), structField (`1`).
    :type: ``bool``
    :default: ``False``
    :set by: Users (?)
 
isOrdered
    Is the slot an ordered collection? If ``True``, it enables the
    ``insertBefore%s`` accessor. Note that it is only meaningful if ``isMany`` is
    also ``True``.
 
    :type: ``bool``
    :default: ``False``
    :set by: Sequence (``True``)
 
useSlot
    Should this attribute be stored in a ``__slots__`` slot? If ``True``, the implementation
    uses ``_f_%s`` as the slot name, otherwise ``%s`` is used. You *must* have the
    ``_f_``-prefixed name in the ``__slots__`` of the element class (or an ancestor thereof)
 
    :type: ``bool``
    :default: ``False``
    :set by: Users
 
lowerBound
    The minimum number of elements that can occupy this slot. ``0`` means that a value is
    not required (see isRequired). Integers less than ``0`` are unchecked degenerate values.
 
    :type: ``int``
    :default: ``0``
    :set by: XXX
 
upperBound
    The maximum number of elements that can occupy this slot. ``None`` means no limit,
    ``1`` means that this slot is not a collection (see ``isMany``). Integers less than
    ``1`` are unchecked degenerate values.
 
    :type: `int` or ``None``
    :default: ``None``
    :set by: Attribute (``1``), structField (``1``).
 
'''isRequired'''
isRequired
    Is a value required for this slot?
 
    '''type''': `bool` [[BR]]
    '''default''': `lambda self: self.lowerBound > 0` [[BR]]
    '''set by''': Attribute (`True` indirectly), structField (`True` indirectly)
 
'''isMany'''
    Is this slot a collection? If `True`, enables the add, replace, and remove accessors and also changes the semantics of get and set.
 
    '''type''': `bool` [[BR]]
    '''default''': `lambda self: self.upperBound <> 1` [[BR]]
    '''set by''': Atttribute (`False` indirectly), structField (`False` indirectly)
 
'''referencedEnd'''
    XXX (something to do with link and unlink notifications if is not `None`).
 
    '''type''': `ComponentName` (?) or `None` [[BR]]
    '''default''': `None` [[BR]]
    '''set by''': Users (?)
    
'''referencedType'''
    XXX (The type that elements in this slot are allowed to have? Used by users when subclassing Attribute, possibly others)
 
    '''type''': `ComponentName` or `None` [[BR]]
    '''default''': `None` [[BR]]
    '''set by''': Users (?)
    
'''syntax'''
    XXX (Syntax rule for this feature, looks like it's used for documentation/help)
 
    '''type''': `None` or `fmtparse.IRule` [[BR]]
    '''default''': `None` [[BR]]
    '''set by''': Users (?)
 
'''separator'''
    XXX (parsing separator between multivalues, looks like it's used for documentation/help)
 
    '''type''': `str` [[BR]]
    '''default''': `''` [[BR]]
    '''set by''': Users (?)
 
'''sepMayTerm'''
    XXX (Can separator occur after last value?)
 
    '''type''': `bool` [[BR]]
    '''default''': `False` [[BR]]
    '''set by''': Users (?)
    
'''canBeEmpty'''
    XXX
 
    '''type''': `bool` [[BR]]
    '''default''': `False` [[BR]]
    '''set by''': Users (?)
 
'''includeInRepr'''
    XXX (Include feature in default Immutable.__repr__?)
 
    '''type''': `bool` [[BR]]
    '''default''': `True` [[BR]]
    '''set by''': Users (?)
 
'''offerAs'''
    XXX
 
    '''type''': `IBasicSequence` (?) [[BR]]
    '''default''': `()` [[BR]]
    '''set by''': Users (?)
 
'''uponAssembly'''
    XXX
 
    '''type''': `bool` [[BR]]
    '''default''': `False` [[BR]]
    '''set by''': Users (?)
 
'''permissionNeeded'''
    XXX (IGuardedDescriptor, declared in peak.security)
 
    '''type''': `IGuardedDescriptor` or `None` [[BR]]
    '''default''': `None` [[BR]]
    '''set by''': Users (?)
    :type: ``bool``
    :default: ``lambda self: self.lowerBound > 0``
    :set by: Attribute (``True`` indirectly), structField (``True`` indirectly)
 
isMany
    Is this slot a collection? If ``True``, enables the add, replace, and remove
    accessors and also changes the semantics of get and set.
 
    :type: ``bool``
    :default: ``lambda self: self.upperBound <> 1``
    :set by: Atttribute (``False`` indirectly), structField (``False`` indirectly)
 
referencedEnd
    For bidirectional links, this is the name of the "inverse" feature. So, e.g. in a
    parent-child relationship, the ``parent`` feature might have a ``referencedEnd`` of
    ``"child"``, and vice versa.
 
    :type: ``ComponentName`` (?) or ``None``
    :default: ``None``
    :set by: Users (?)
 
referencedType
    The type of the feature, or a name that references a type. Various behaviors of
    the feature are delegated to its type, such as conversion operations, normalization,
    parsing, etc. (Used by users when subclassing ``model.Attribute``, possibly others)
 
    :type: ``model.Type`` (``model.IType``, really), ``ComponentName`` or ``None``
    :default: ``None``
    :set by: Users
 
syntax
    Syntax rule for this feature, used when adapting a feature to ``fmtparse.IRule``, so
    that features can be used as part of the syntax specification for the type they're
    a part of.
 
    :type: ``None`` or ``fmtparse.IRule``
    :default: ``None``
    :set by: Users
 
separator
    parsing separator between multivalues, also used when adapting a feature
    to ``fmtparse.IRule``.
 
    :type: ``str``
    :default: ``""`` (empty string)
    :set by: Users (?)
 
sepMayTerm
    Can separator occur after last value? another option for using a feature as
    a parsing rule.
 
    :type: ``bool``
    :default: ``False``
    :set by: Users (?)
 
canBeEmpty
    Is an empty string a valid parse match for this feature?
 
    :type: ``bool``
    :default: ``False``
    :set by: Users (?)
 
includeInRepr
    Should this feature be included in the default ``Immutable.__repr__``? Immutable
    types normally display all of their features as part of their ``repr()``, but
    sometimes you may have features that you don't want displayed as part of a repr,
    perhaps because they have very large contents.
 
    :type: ``bool``
    :default: ``True``
    :set by: Users (?)
 
offerAs
    This is the same as ``offerAs`` in ``binding.Attribute`` -- see
    ``peak help binding.Attribute``
 
    :type: ``IBasicSequence`` (?)
    :default: ``()``
    :set by: Users (?)
 
uponAssembly
    This is the same as ``uponAssembly`` in ``binding.Attribute`` -- see
    ``peak help binding.Attribute``
 
    :type: ``bool``
    :default: ``False``
    :set by: Users (?)
 
permissionNeeded
    Permission needed to access the feature; used by ``peak.security`` access checks.
 
    :type: ``security.IPermission`` or ``None``
    :default: ``None``
    :set by: Users (?)

PythonPowered
ShowText of this page
EditText of this page
FindPage by browsing, title search , text search or an index
Or try one of these actions: AttachFile, DeletePage, LikePages, LocalSiteMap, SpellCheck