2.2.1
Internal Metadata Attributes
The following metadata attributes are used internally by
the Traits package, and can be queried:
·
array: Indicates whether the
trait is an array.
·
default: Returns the default
value for the trait, if known; otherwise it returns Undefined.
·
default_kind: Returns a
string describing the type of value returned by the default attribute for the trait. The possible
values are:
· value: The default
attribute returns the actual default value.
· list: A copy of the list default value.
· dict: A copy of the dictionary default value.
· self: The default value is the object the trait is bound
to; the default attribute returns
Undefined.
· factory: The default value is created by calling a
factory; the default attribute returns
Undefined.
· method: The default value is created by calling a method
on the object the trait is bound to; the default
attribute returns Undefined.
·
delegate: The name of the
attribute on this object that references the object that this object delegates
to.
·
inner_traits: Returns a tuple
containing the “inner” traits for the trait. For most traits, this is empty,
but for List and Dict traits, it contains the traits that define the items in
the list or the keys and values in the dictionary.
·
parent: The trait from which
this one is derived.
·
prefix: A prefix or
substitution applied to the delegate attribute. See Section 4, “Deferring Trait”
for details.
·
trait_type: Returns the type
of the trait, which is typically a handler derived from TraitType.
·
type: One of the following,
depending on the nature of the trait:
·
constant
·
delegate
·
event
·
property
·
trait
|