1. 写在前面
YYModelMeta,嗯,又是一个meta,很明显又是一层封装,这个meta是对YYClassInfo进行了一些描述信息的封装,并且把所有Property都封装成昨天说到的PropertyMetas,在这个代码中也验证了昨天对next指针的使用。这节没什么多补充的知识点,我们就直接上代码
2.YYModelMeta
2.1 .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 |
/// YYModelMeta 对ClassInfo增加描述 @interface _YYModelMeta : NSObject { @package YYClassInfo *_classInfo; // json key 和 property Meta 的映射关系字典 NSDictionary *_mapper; // 所有属性的propertyMeta NSArray *_allPropertyMetas; // 映射jsonkeyPath 的PropertyMetas NSArray *_keyPathPropertyMetas; // 映射多个jsonKey的propertyMeta NSArray *_multiKeysPropertyMetas; /// 需要映射的属性的总个数 NSUInteger _keyMappedCount; /// Model对应的Foundation class类型 YYEncodingNSType _nsType; // 事否实现了自定义的映射关系表 这里之前已经解释过 就不再赘述 BOOL _hasCustomWillTransformFromDictionary; BOOL _hasCustomTransformFromDictionary; BOOL _hasCustomTransformToDictionary; BOOL _hasCustomClassFromDictionary; } @end |
2.2.m文件
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 什么多补充的知识点,我们就直接上代码
2.YYModelMeta2.1 .h 文件
2.2.m文件
|