The PEAK Developers' Center   StructuralFeature UserPreferences
 
HelpContents Search Diffs Info Edit Subscribe XML Print View

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)

The following class members affect how StructuralFeatures are used:

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

XXX (is this deprecated, or just obscure?)

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

Is a value required for this slot?

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
EditText of this page (last modified 2007-08-11 11:37:37)
FindPage by browsing, title search , text search or an index
Or try one of these actions: AttachFile, DeletePage, LikePages, LocalSiteMap, SpellCheck