-
Notifications
You must be signed in to change notification settings - Fork 5
/
NSEntityDescription.j
52 lines (45 loc) · 1.45 KB
/
NSEntityDescription.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// NSEntityDescription.j
//
// Created by Raphael Bartolome on 06.01.10.
//
@implementation NSEntityDescription : CPEntityDescription
{
NSManagedObjectModel ns_model;
CPDictionary ns_properties;
CPDictionary ns_subentities;
NSEntityDescription ns_superentity;
id ns_versionHashModifier;
}
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
[self setName:[aCoder decodeObjectForKey: @"NSEntityName"]];
[self setExternalName:[aCoder decodeObjectForKey: @"NSClassNameForEntity"]];
[self setUserInfo:[aCoder decodeObjectForKey: @"NSUserInfo"]];
ns_model = [aCoder decodeObjectForKey: @"NSManagedObjectModel"]; //will set on addEntity in CPManagedObjectModel
ns_properties = [aCoder decodeObjectForKey: @"NSProperties"];
ns_subentities = [aCoder decodeObjectForKey: @"NSSubentities"];
ns_superentity = [aCoder decodeObjectForKey: @"NSSuperentity"];
ns_versionHashModifier = [aCoder decodeObjectForKey: @"NSVersionHashModifier"];
}
return self;
}
- (void)NS_loadEntityDescription
{
var keyEnumerator = [ns_properties keyEnumerator];
var aPropertyName;
while(aPropertyName = [keyEnumerator nextObject])
{
var aProperty = [ns_properties objectForKey:aPropertyName];
[aProperty setEntity:self];
[self addProperty:aProperty];
}
}
- (Class)classForKeyedArchiver
{
return [NSEntityDescription class];
}
@end