ewasylishen@gmail.com
)Copyright: (C) 2009 Eric Wasylishen
- Declared in:
- ETPropertyDescription.h
@group Model and Metamodel @abstract Description of an entity's property.
A property description represents either an attribute or a relationship that belongs to an entity. Whether a property represents an attribute or relationships depends on the -type (the entity description for the propery value).
For a primitive type (see -[ETEntityDescription isPrimitive]), the property is an attribute. For a non-primitive type, it is a relationship. For more explanations, -isAttribute and -isRelationship .
@section Conceptual Model
For a Metamodel overview, see ETModelElementDescription.
@section Model Description
ETPropertyDescription provides a large number of properties to describe the model, these properties can be split into three categories:
The Model Specification properties must be edited to get working metamodel.
Both Persistency and Model Presentation Specifications are optional. These additional specifications are usually generic enough to be reused by Persistency and UI frameworks other than CoreObject and EtoileUI.
Warning: For now, CoreObject validation rules are hardcoded into -[ETPropertyDescription checkConstraints:], and this limits the possibility to reuse the Persistency Specification without CoreObject.
Additional properties or specification can be added by subclassing ETPropertyDescription. In the future, we will probably support extending the metamodel dynamically at run-time too.
@section Role and Validation
A role can be set to provide validation rules that
describe attribute or relationship constraints in
a particular metamodel. The role must be compatible with
the current -type
.
For example, when
-isRelationship
is NO
, setting a ETRelationshipRole will
cause a warning in
-checkConstraints
.
The validation is delegated to the role by -validateValue:forKey: .
@section Multivalues Both attributes and relationships can be univalued or multivalued. A multivalued relationship is a too-many relationship, while a univalued relationship is a to-one relationship. A multivalued attribute is a value object collection (multivalued relationships are entity object collections).
@section Late-Bound References
For easily creating property descriptions that refer to each other or entity descriptions, without worrying about the dependencies accross all the model element descriptions, ETPropertyDescriptions includes properties such as -setOppositeName: or -setTypeName: that can be used to refer to other ETModelElementDescription objects by their -name or -fullName .
When all these related descriptions are added to a repository with -[ETModelDescriptionRepository addUnresolvedDescription:], -[ETModelDescriptionRepository resolveNamedObjectReferences] can be called to resolve the name references to their real objects.
For example, the -opposite is set based on the ETPropertyDescription object returned by -[ETModelDescriptionRepository descriptionForName:] for -oppositeName .
For properties descriptions added to entity descriptions returned by +[NSObject newEntityDescription], all these model element descriptions are collected and resolved in the main repository. For other repositories or entity descriptions created outside of +[NSObject newEntityDescription], you must call -[ETModelDescriptionRepository resolveNamedObjectReferences] manually.
@taskunit Initialization
Returns an autoreleased property description.
The given name and type must not be nil
,
otherwise an NSInvalidArgumentException is
raised.
@taskunit Metamodel Description
Self-description (aka meta-metamodel).
@taskunit Validation