Class: NSEntityDescription

Inherits:
NSObject show all

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)

Instance Method Summary (collapse)

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.

Parameters:

Returns:

  • (NSEntityDescription)

    The entity with the specified name from the managed object model associated with context’s persistent store coordinator.

+ (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.

Parameters:

Returns:

  • (Object)

    A new, autoreleased, fully configured instance of the class for the entity named entityName. The instance has its entity description set and is inserted it into context.

Instance Method Details

- (Hash) attributesByName

Returns the attributes of the receiver in a dictionary, where the keys in the dictionary are the attribute names.

Returns:

  • (Hash)

    The attributes of the receiver in a dictionary, where the keys in the dictionary are the attribute names and the values are instances of NSAttributeDescription. .

- (Array) compoundIndexes

Returns the compound indexes for the entity as an array of arrays.

Returns:

- (Object) copy

Returns a copy of the receiver

Returns:

  • (Object)

    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.

Returns:

  • (Boolean)

    YES if the receiver represents an abstract entity, otherwise NO.

- (Boolean) isKindOfEntity(entity)

Returns a Boolean value that indicates whether the receiver is a sub-entity of another given entity.

Parameters:

Returns:

  • (Boolean)

    YES if the receiver is a sub-entity of entity, otherwise NO.

- (String) managedObjectClassName

Returns the name of the class that represents the receiver’s entity.

Returns:

  • (String)

    The name of the class that represents the receiver’s entity.

- (NSManagedObjectModel) managedObjectModel

Returns the managed object model with which the receiver is associated.

Returns:

- (String) name

Returns the entity name of the receiver.

Returns:

  • (String)

    The entity name of receiver.

- (Array) properties

Returns an array containing the properties of the receiver.

Returns:

- (Hash) propertiesByName

Returns a dictionary containing the properties of the receiver.

Returns:

- (Hash) relationshipsByName

Returns the relationships of the receiver in a dictionary, where the keys in the dictionary are the relationship names.

Returns:

  • (Hash)

    The relationships of the receiver in a dictionary, where the keys in the dictionary are the relationship names and the values are instances of NSRelationshipDescription.

- (Array) relationshipsWithDestinationEntity(entity)

Returns an array containing the relationships of the receiver where the entity description of the relationship is a given entity.

Parameters:

Returns:

  • (Array)

    An array containing the relationships of the receiver where the entity description of the relationship is entity. Elements in the array are instances of NSRelationshipDescription.

- (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.

Returns:

  • (String)

    The renaming identifier for the receiver.

- (Object) setAbstract(flag)

Sets whether the receiver represents an abstract entity.

Parameters:

  • flag (Boolean)

    A Boolean value indicating whether the receiver is abstract (YES) or not (NO).

Returns:

- (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.

Parameters:

Returns:

- (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.

Parameters:

  • name (String)

    The name of the class that represents the receiver’s entity.

Returns:

- (Object) setName(name)

Sets the entity name of the receiver.

Parameters:

  • name (String)

    The name of the entity the receiver describes.

Returns:

- (Object) setProperties(properties)

Sets the properties array of the receiver.

Parameters:

Returns:

- (Object) setRenamingIdentifier(value)

Sets the renaming identifier for the receiver.

Parameters:

  • value (String)

    The renaming identifier for the receiver.

Returns:

- (Object) setSubentities(array)

Sets the subentities of the receiver.

Parameters:

  • array (Array)

    An array containing sub-entities for the receiver. Objects in the array must be instances of NSEntityDescription.

Returns:

- (Object) setUserInfo(dictionary)

Sets the user info dictionary of the receiver.

Parameters:

  • dictionary (Hash)

    A user info dictionary.

Returns:

- (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.)

Parameters:

  • modifierString (String)

    The version hash modifier for the receiver.

Returns:

- (Array) subentities

Returns an array containing the sub-entities of the receiver.

Returns:

- (Hash) subentitiesByName

Returns the sub-entities of the receiver in a dictionary.

Returns:

  • (Hash)

    A dictionary containing the receiver’s sub-entities. The keys in the dictionary are the sub-entity names, the corresponding values are instances of NSEntityDescription.

- (NSEntityDescription) superentity

Returns the super-entity of the receiver.

Returns:

  • (NSEntityDescription)

    The receiver’s super-entity. If the receiver has no super-entity, returns nil.

- (Hash) userInfo

Returns the user info dictionary of the receiver.

Returns:

  • (Hash)

    The receiver’s user info dictionary.

- (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.

Returns:

  • (NSData)

    The version hash for the receiver.

- (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.

Returns:

  • (String)

    The version hash modifier for the receiver.