-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
MTLTestModel.h
148 lines (93 loc) · 3.82 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//
// 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, has MTLPropertyStorageTransitory.
@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
@interface MTLURLModel : MTLModel <MTLJSONSerializing>
// Defaults to http://github.com.
@property (nonatomic, strong) NSURL *URL;
@end
// Conforms to MTLJSONSerializing but does not inherit from the MTLModel class.
@interface MTLConformingModel : NSObject <MTLJSONSerializing>
@property (nonatomic, copy) NSString *name;
@end
@interface MTLStorageBehaviorModel : MTLModel
@property (readonly, nonatomic, assign) BOOL primitive;
@property (readonly, nonatomic, assign) id assignProperty;
@property (readonly, nonatomic, weak) id weakProperty;
@property (readonly, nonatomic, strong) id strongProperty;
@end
@interface MTLBoolModel : MTLModel <MTLJSONSerializing>
@property (nonatomic, assign) BOOL flag;
@end
@interface MTLIDModel : MTLModel <MTLJSONSerializing>
@property (nonatomic, strong) id anyObject;
@end
@interface MTLNonPropertyModel : MTLModel <MTLJSONSerializing>
- (NSURL *)homepage;
@end
@interface MTLMultiKeypathModel : MTLModel <MTLJSONSerializing>
// This property is associated with the "location" and "length" keys in JSON.
@property (readonly, nonatomic, assign) NSRange range;
// This property is associated with the "nested.location" and "nested.length"
// keys in JSON.
@property (readonly, nonatomic, assign) NSRange nestedRange;
@end
@interface MTLClassClusterModel : MTLModel <MTLJSONSerializing>
@property (readonly, nonatomic, copy) NSString *flavor;
@end
@interface MTLChocolateClassClusterModel : MTLClassClusterModel
// Associated with the "chocolate_bitterness" JSON key and transformed to a
// string.
@property (readwrite, nonatomic, assign) NSUInteger bitterness;
@end
@interface MTLStrawberryClassClusterModel : MTLClassClusterModel
// Associated with the "strawberry_freshness" JSON key.
@property (readwrite, nonatomic, assign) NSUInteger freshness;
@end