#import <EMRecord.h>
Inherits NSObject.
Inherited by EMProduct, EMReview, and EMStore.
Public Member Functions | |
(id) | - initWithValues: |
(void) | - addValues: |
(void) | - setValue:forKey: |
(NSString *) | - firstValueForKey: |
(NSArray *) | - valueArrayForKey: |
(BOOL) | - isEqualToRecord: |
Protected Attributes | |
NSMutableDictionary * | _values |
BOOL | _detailLoaded |
NSInteger | _tag |
Properties | |
BOOL | isDetailLoaded |
NSString * | spec |
NSInteger | tag |
EMRecord is a Key-Value coding compliant representation of a record. It can be used as-is, or as a base class for more specific data model classes.
Subclasses may implement their values in whatever way they like. By default, EMRecord stores all values in an internal NSMutableDictionary. Child classes may implement values as instance variables, , appropriately name getter and setter methods and expect correct behavior in all cases, or may use EMRecord's storage via calls to -[super valueForKey:] and -[super setValue:forKey:]. For a full breakdown on the potential ways in which to store a key/value pair, read the documentation on Key-Value Coding.
Subclasses are free to implement -(BOOL)validateKeyName:error: methods for specific keys if they wish. This is the preferred way of doing property validation.
Subclasses must override -copyWithZone: from NSCopying if they implement any values using except the root EMRecord's -setValue:forKey: and want those values to be copied. EMRecord expects subclasses and values to exhibit deep-copying behavior, i.e. any type of a value is expected to also implement NSCopying.
- (NSString *) firstValueForKey: | (NSString *) | key |
Returns the NSString value for the key if there's only a single NSString or NSFacetValueSelection, or the first value if the property is multi-assign and is stored in an NSArray.
- (NSArray *) valueArrayForKey: | (NSString *) | key |
Returns a homogeneous array of NSString or EMFacetValueSelection objects (depending on the key). This allows you to work with a multi-assign property as an array.
- (NSInteger) tag [read, write, assign] |
The receiver’s tag, an integer that you can use to identify EMRecord objects in your application.
Default = 0.