Class: NSEntityDescription
Overview
An NSEntityDescription object describes an entity in Core Data. Entities are to managed objects what Class is to id, or—to use a database analogy—what tables are to rows. An instance specifies an entity’s name, its properties (its attributes and relationships, expressed by instances of NSAttributeDescription and NSRelationshipDescription) and the class by which it is represented.
Class Method Summary (collapse)
-
+ entityForName:inManagedObjectContext:
Returns the entity with the specified name from the managed object model associated with the specified managed object context’s persistent store coordinator.
-
+ insertNewObjectForEntityForName:inManagedObjectContext:
Creates, configures, and returns an instance of the class for the entity with a given name.
Instance Method Summary (collapse)
-
- attributesByName
Returns the attributes of the receiver in a dictionary, where the keys in the dictionary are the attribute names.
-
- compoundIndexes
Returns the compound indexes for the entity as an array of arrays.
-
- copy
Returns a copy of the receiver.
-
- isAbstract
Returns a Boolean value that indicates whether the receiver represents an abstract entity.
-
- isKindOfEntity:
Returns a Boolean value that indicates whether the receiver is a sub-entity of another given entity.
-
- managedObjectClassName
Returns the name of the class that represents the receiver’s entity.
-
- managedObjectModel
Returns the managed object model with which the receiver is associated.
-
- name
Returns the entity name of the receiver.
-
- properties
Returns an array containing the properties of the receiver.
-
- propertiesByName
Returns a dictionary containing the properties of the receiver.
-
- relationshipsByName
Returns the relationships of the receiver in a dictionary, where the keys in the dictionary are the relationship names.
-
- relationshipsWithDestinationEntity:
Returns an array containing the relationships of the receiver where the entity description of the relationship is a given entity.
-
- renamingIdentifier
Returns the renaming identifier for the receiver.
-
- setAbstract:
Sets whether the receiver represents an abstract entity.
-
- setCompoundIndexes:
Sets the compound indexes for the entity as an array of arrays.
-
- setManagedObjectClassName:
Sets the name of the class that represents the receiver’s entity.
-
- setName:
Sets the entity name of the receiver.
-
- setProperties:
Sets the properties array of the receiver.
-
- setRenamingIdentifier:
Sets the renaming identifier for the receiver.
-
- setSubentities:
Sets the subentities of the receiver.
-
- setUserInfo:
Sets the user info dictionary of the receiver.
-
- setVersionHashModifier:
Sets the version hash modifier for the receiver.
-
- subentities
Returns an array containing the sub-entities of the receiver.
-
- subentitiesByName
Returns the sub-entities of the receiver in a dictionary.
-
- superentity
Returns the super-entity of the receiver.
-
- userInfo
Returns the user info dictionary of the receiver.
-
- versionHash
Returns the version hash for the receiver.
-
- versionHashModifier
Returns the version hash modifier for the receiver.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (NSEntityDescription) entityForName(entityName, inManagedObjectContext:context)
Returns the entity with the specified name from the managed object model associated with the specified managed object context’s persistent store coordinator. This method is functionally equivalent to the following code example.
+ (Object) insertNewObjectForEntityForName(entityName, inManagedObjectContext:context)
Creates, configures, and returns an instance of the class for the entity with a given name. This method makes it easy for you to create instances of a given entity without worrying about the details of managed object creation. The method is conceptually similar to the following code example.
Instance Method Details
- (Hash) attributesByName
Returns the attributes of the receiver in a dictionary, where the keys in the dictionary are the attribute names.
- (Array) compoundIndexes
Returns the compound indexes for the entity as an array of arrays.
- (Object) copy
Returns a copy of the receiver
- (Boolean) isAbstract
Returns a Boolean value that indicates whether the receiver represents an abstract entity. An abstract entity might be Shape, with concrete sub-entities such as Rectangle, Triangle, and Circle.
- (Boolean) isKindOfEntity(entity)
Returns a Boolean value that indicates whether the receiver is a sub-entity of another given entity.
- (String) managedObjectClassName
Returns the name of the class that represents the receiver’s entity.
- (NSManagedObjectModel) managedObjectModel
Returns the managed object model with which the receiver is associated.
- (String) name
Returns the entity name of the receiver.
- (Array) properties
Returns an array containing the properties of the receiver.
- (Hash) propertiesByName
Returns a dictionary containing the properties of the receiver.
- (Hash) relationshipsByName
Returns the relationships of the receiver in a dictionary, where the keys in the dictionary are the relationship names.
- (Array) relationshipsWithDestinationEntity(entity)
Returns an array containing the relationships of the receiver where the entity description of the relationship is a given entity.
- (String) renamingIdentifier
Returns the renaming identifier for the receiver. The renaming identifier is used to resolve naming conflicts between models. When creating a mapping model between two managed object models, a source entity and a destination entity that share the same identifier indicate that an entity mapping should be configured to migrate from the source to the destination.If you do not set this value, the identifier will return the entity’s name.
- (Object) setAbstract(flag)
Sets whether the receiver represents an abstract entity.
- (Object) setCompoundIndexes(value)
Sets the compound indexes for the entity as an array of arrays. Compound indexes are only used by stores that natively support compound indices (the setting is thus only advisory). Indexes apply to the entire inheritance hierarchy.
- (Object) setManagedObjectClassName(name)
Sets the name of the class that represents the receiver’s entity. The class specified by name must either be, or inherit from, NSManagedObject.
- (Object) setName(name)
Sets the entity name of the receiver.
- (Object) setProperties(properties)
Sets the properties array of the receiver.
- (Object) setRenamingIdentifier(value)
Sets the renaming identifier for the receiver.
- (Object) setSubentities(array)
Sets the subentities of the receiver.
- (Object) setUserInfo(dictionary)
Sets the user info dictionary of the receiver.
- (Object) setVersionHashModifier(modifierString)
Sets the version hash modifier for the receiver. This value is included in the version hash for the entity. You use it to mark or denote an entity as being a different “version” than another even if all of the values which affect persistence are equal. (Such a difference is important in cases where, for example, the structure of an entity is unchanged but the format or content of data has changed.)
- (Array) subentities
Returns an array containing the sub-entities of the receiver.
- (Hash) subentitiesByName
Returns the sub-entities of the receiver in a dictionary.
- (NSEntityDescription) superentity
Returns the super-entity of the receiver.
- (Hash) userInfo
Returns the user info dictionary of the receiver.
- (NSData) versionHash
Returns the version hash for the receiver. The version hash is used to uniquely identify an entity based on the collection and configuration of properties for the entity. The version hash uses only values which affect the persistence of data and the user-defined versionHashModifier value. (The values which affect persistence are: the name of the entity, the version hash of the superentity (if present), if the entity is abstract, and all of the version hashes for the properties.) This value is stored as part of the version information in the metadata for stores which use this entity, as well as a definition of an entity involved in an NSEntityMapping object.
- (String) versionHashModifier
Returns the version hash modifier for the receiver. This value is included in the version hash for the entity. See setVersionHashModifier: for a full discussion.