ETEntityDescription documentation
ETEntityDescription : ETModelElementDescription <ETCollection, ETCollectionMutation>Overview
For an introduction, see ETModelElementDescription.
Freezing
If -isFrozen is YES, the entity description is largely immutable, you can only add or remove transient property descriptions with -addPropertyDescription: and -removePropertyDescription .
Metamodel Description
- + (ETEntityDescription *) newEntityDescription
Self-description (aka meta-metamodel).
- + (NSString *) rootEntityDescriptionName
The name of the entity description that should end the parent chain of every entity description.
This entity description is the Object primitive in the repository. See ETModelDescriptionRepository.
Will be used by -checkConstraints: .
Querying Type
- - (BOOL) isPrimitive
Whether or not this entity is a primitive (i.e. describes attributes and not relationships).
Primitives include both object and C primitives. e.g. NSString, NSDate, NSInteger, float, etc.
See also -[ETPropertyDescription isRelationship] .
- - (BOOL) isCPrimitive
Whether or not this entity is a C primitive (i.e. describes attributes whose values are not objects). e.g. NSInteger, float, etc.
If YES is returned, -isPrimitive returns the same.
See also -[ETPropertyDescription isPrimitive] .
Model Specification
- - (void) setAbstract: (BOOL)abstract
Whether or not this entity is abstract (i.e. can't be instantiated).
Inheritance and Owning Package
- - (ETEntityDescription *) parent
The parent entity of this entity. (Superclass or prototype)
The parent is retained, because the parent doesn't track its subentities.
- - (void) setParent: (ETEntityDescription *)parent
The parent entity of this entity. (Superclass or prototype)
The parent is retained, because the parent doesn't track its subentities.
- - (BOOL) isKindOfEntity: (ETEntityDescription *)anEntityDesc
Returns whether the given entity is a subentity of the receiver.
- - (ETPackageDescription *) owner
The package to which this entity belongs to.
- - (void) setOwner: (ETPackageDescription *)owner
The package to which this entity belongs to.
Property Descriptions
- - (NSArray *) propertyDescriptionNames
Names of the property descriptions (not including those declared in parent entities).
- - (NSArray *) allPropertyDescriptionNames
Names of all property descriptions including those declared in parent entities.
- - (NSArray *) propertyDescriptions
Descriptions of the properties declared on this entity (not including those declared in parent entities).
For each property added or removed, the behavior described in -addPropertyDescription: and -removePropertyDescription: applies.
If -isFrozen returns YES, transient properties can still be added or removed with -addPropertyDescription: and -removePropertyDescription , but not directly with this setter.
- - (void) setPropertyDescriptions: (NSArray *)propertyDescriptions
Descriptions of the properties declared on this entity (not including those declared in parent entities).
For each property added or removed, the behavior described in -addPropertyDescription: and -removePropertyDescription: applies.
If -isFrozen returns YES, transient properties can still be added or removed with -addPropertyDescription: and -removePropertyDescription , but not directly with this setter.
- - (void) addPropertyDescription: (ETPropertyDescription *)propertyDescription
Adds the given property description to this entity, the entity becomes its owner.
If -isFrozen is YES, this method can still be used to add a transient property description.
- - (void) removePropertyDescription: (ETPropertyDescription *)propertyDescription
Removes the given property description from this entity.
- - (NSArray *) allPropertyDescriptions
Descriptions of the entity's properties, including those declared in parent entities.
If -isFrozen is YES, this method can still be used to remove a transient property description.
- - (NSArray *) allPersistentPropertyDescriptions
Descriptions of the entity's persistent properties, including those declared in parent entities.
See -[ETPropertyDescription isPersistent] .
- - (ETPropertyDescription *) propertyDescriptionForName: (NSString *)name
Returns the property description which matches the given name.
See also -propertyDescriptionsForNames: and -[ETModelElementDescription name] which is inherited by ETPropertyDescription.
- - (NSArray *) propertyDescriptionsForNames: (NSArray *)names
Returns the property descriptions which matches the given names. See also -propertyDescriptionForName: and -[ETModelElementDescription name] which is inherited by ETPropertyDescription.
Late-bound References
- - (NSString *) parentName
The name of the parent entity.
-[ETModelDescriptionRepository resolveNamedObjectReferences] sets -parent based on the parent name. Once resolved, -parentName returns nil.
You should use this setter inside +[NSObject newEntityDescription] .
This property doesn't appear in the meta-metamodel, see +newEntityDescription .
See also -parent .
- - (void) setParentName: (NSString *)parentName
The name of the parent entity.
-[ETModelDescriptionRepository resolveNamedObjectReferences] sets -parent based on the parent name. Once resolved, -parentName returns nil.
You should use this setter inside +[NSObject newEntityDescription] .
This property doesn't appear in the meta-metamodel, see +newEntityDescription .
See also -parent .
- - (NSString *) ownerName
The name of the package to which this entity belongs to.
-[ETModelDescriptionRepository resolveNamedObjectReferences] sets -owner based on the owner name. Once resolved, -ownerName returns nil.
This property doesn't appear in the meta-metamodel, see +newEntityDescription .
You should use this setter inside +[NSObject newEntityDescription] .
- - (void) setOwnerName: (NSString *)ownerName
The name of the package to which this entity belongs to.
-[ETModelDescriptionRepository resolveNamedObjectReferences] sets -owner based on the owner name. Once resolved, -ownerName returns nil.
This property doesn't appear in the meta-metamodel, see +newEntityDescription .
You should use this setter inside +[NSObject newEntityDescription] .
Model Presentation
- - (NSString *) localizedDescription
A short and human-readable description e.g. Person, Music Track.
This is used to present the entity type to the user in the UI.
By default, returns the entity name that is not localized.
- - (void) setLocalizedDescription: (NSString *)localizedDescription
A short and human-readable description e.g. Person, Music Track.
This is used to present the entity type to the user in the UI.
By default, returns the entity name that is not localized.
UI Builder Support
- - (NSArray *) UIBuilderPropertyNames
The names of the entity properties visible in a IDE / UI builder inspector (not including those declared in parent entities).
- - (void) setUIBuilderPropertyNames: (NSArray *)UIBuilderPropertyNames
The names of the entity properties visible in a IDE / UI builder inspector (not including those declared in parent entities).
- - (NSArray *) allUIBuilderPropertyNames
The names of the entity properties visible in a UIDE / UI builder inspector, including those declared in the parent entities.
Diff/Merge
- - (NSString *) diffAlgorithm
Diff algorithm name.
Normally nil, in which case the default diff/merge algorithm is used.
- - (void) setDiffAlgorithm: (NSString *)diffAlgorithm
Diff algorithm name.
Normally nil, in which case the default diff/merge algorithm is used.
Validation and Runtime Consistency Check
- - (ETValidationResult *) validateValue: (id)value forKey: (NSString *)key
Tries to validate the value that corresponds to the given property name, by delegating the validation to the right property description, and returns a validation result object.
- - (BOOL) isValidValue: (id)aValue type: (ETEntityDescription *)anEntityDesc
Checks the given value and its type against the receiver type, and returns whether the value type is a subtype of the receiver.
This method doesn't execute any model validation as -validateValue:forKey: does.