NSPropertyDescription.m
1 /* Copyright (c) 2008 Dan Knapp 2 3 Permission is hereby granted, free of charge, to any person obtaining a copy of 4 this software and associated documentation files (the "Software"), to deal in 5 the Software without restriction, including without limitation the rights to 6 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 the Software, and to permit persons to whom the Software is furnished to do so, 8 subject to the following conditions: 9 10 The above copyright notice and this permission notice shall be included in all 11 copies or substantial portions of the Software. 12 13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 19 #import <CoreData/NSPropertyDescription.h> 20 #import <Foundation/NSCoder.h> 21 #import <Foundation/NSRaise.h> 22 23 @implementation NSPropertyDescription 24 25 - init { 26 NSInvalidAbstractInvocation(); 27 return nil; 28 } 29 30 - initWithCoder: (NSCoder *) coder { 31 if (![coder allowsKeyedCoding]) 32 [NSException raise: NSInvalidArgumentException 33 format: @"%@ can not initWithCoder:%@", [self class], 34 [coder class]]; 35 36 _entity = [coder decodeObjectForKey: @"NSEntity"]; 37 _propertyName = [[coder decodeObjectForKey: @"NSPropertyName"] copy]; 38 39 return self; 40 } 41 42 - (void) encodeWithCoder: (NSCoder *) coder { 43 NSInvalidAbstractInvocation(); 44 } 45 46 - (BOOL) isEqual: (id) object { 47 if (![object isKindOfClass: [NSPropertyDescription class]]) 48 return NO; 49 NSPropertyDescription *property = (NSPropertyDescription *) object; 50 if ((_entity == [property entity]) && 51 [_propertyName isEqualToString: [property name]]) 52 return YES; 53 else 54 return NO; 55 } 56 57 - (id) copyWithZone: (NSZone *) zone { 58 return [self retain]; 59 } 60 61 - (NSEntityDescription *) entity { 62 return _entity; 63 } 64 65 - (NSString *) name { 66 return _propertyName; 67 } 68 69 - (BOOL) isOptional { 70 NSUnimplementedMethod(); 71 return NO; 72 } 73 74 - (BOOL) isTransient { 75 NSUnimplementedMethod(); 76 return NO; 77 } 78 79 - (NSDictionary *) userInfo { 80 NSUnimplementedMethod(); 81 return nil; 82 } 83 84 - (NSArray *) validationPredicates { 85 NSUnimplementedMethod(); 86 return nil; 87 } 88 89 - (NSArray *) validationWarnings { 90 NSUnimplementedMethod(); 91 return nil; 92 } 93 94 - (void) setName: (NSString *) value { 95 NSUnimplementedMethod(); 96 } 97 98 - (void) setOptional: (BOOL) value { 99 NSUnimplementedMethod(); 100 } 101 102 - (void) setTransient: (BOOL) value { 103 NSUnimplementedMethod(); 104 } 105 106 - (void) setUserInfo: (NSDictionary *) value { 107 NSUnimplementedMethod(); 108 } 109 110 - (void) setValidationPredicates: (NSArray *) predicates 111 withValidationWarnings: (NSArray *) warnings 112 { 113 NSUnimplementedMethod(); 114 } 115 116 @end