-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
MTLTestModel.h
76 lines (54 loc) · 2.14 KB
/
MTLTestModel.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// MTLTestModel.h
// Mantle
//
// Created by Justin Spahr-Summers on 2012-09-11.
// Copyright (c) 2012 GitHub. All rights reserved.
//
extern NSString * const MTLTestModelErrorDomain;
extern const NSInteger MTLTestModelNameTooLong;
extern const NSInteger MTLTestModelNameMissing;
@interface MTLEmptyTestModel : MTLModel
@end
@interface MTLTestModel : MTLModel <MTLJSONSerializing>
// Defaults to 1. This changes the behavior of some of the receiver's methods to
// emulate a migration.
+ (void)setModelVersion:(NSUInteger)version;
// Must be less than 10 characters.
//
// This property is associated with a "username" key in JSON.
@property (nonatomic, copy) NSString *name;
// Defaults to 1. When two models are merged, their counts are added together.
//
// This property is a string in JSON.
@property (nonatomic, assign) NSUInteger count;
// This property is associated with a "nested.name" key path in JSON. This
// property should not be encoded into new archives.
@property (nonatomic, copy) NSString *nestedName;
// Should not be stored in the dictionary value or JSON.
@property (nonatomic, copy, readonly) NSString *dynamicName;
// Should not be stored in JSON.
@property (nonatomic, weak) MTLEmptyTestModel *weakModel;
@end
@interface MTLSubclassTestModel : MTLTestModel
// Properties to test merging between subclass and superclass
@property (nonatomic, copy) NSString *role;
@property (nonatomic, copy) NSNumber *generation;
@end
@interface MTLArrayTestModel : MTLModel <MTLJSONSerializing>
// This property is associated with a "users.username" key in JSON.
@property (nonatomic, copy) NSString *names;
@end
// Parses MTLTestModel objects from JSON instead.
@interface MTLSubstitutingTestModel : MTLModel <MTLJSONSerializing>
@end
@interface MTLValidationModel : MTLModel
// Defaults to nil, which is not considered valid.
@property (nonatomic, copy) NSString *name;
@end
// Returns a default name of 'foobar' when validateName:error: is invoked
@interface MTLSelfValidatingModel : MTLValidationModel
@end
// Maps a non-existant property "name" to the "username" key in JSON.
@interface MTLIllegalJSONMappingModel : MTLModel <MTLJSONSerializing>
@end