2727#import " QCloudACLPolicy.h"
2828
2929#import " QCloudACLOwner.h"
30- #import " QCloudACLGrant .h"
30+ #import " QCloudAccessControlList .h"
3131
32- @class QCloudACLGrant;
3332
3433NS_ASSUME_NONNULL_BEGIN
3534@implementation QCloudACLPolicy
3635
37- + (NSDictionary *)modelContainerPropertyGenericClass
38- {
39- return @ {
40- @" accessControlList" :[QCloudACLGrant class ],
41- };
42- }
4336
4437
4538+ (NSDictionary *)modelCustomPropertyMapper
@@ -53,22 +46,6 @@ + (NSDictionary *)modelCustomPropertyMapper
5346
5447- (BOOL )modelCustomTransformToDictionary : (NSMutableDictionary *)dic
5548{
56- void (^TransformDictionary)(NSString * originKey, NSString * aimKey) = ^(NSString * originKey, NSString * aimKey) {
57- id object = [dic objectForKey: originKey];
58- if (!object) {
59- return ;
60- }
61- if ([object isKindOfClass: [NSNull class ]]) {
62- return ;
63- }
64- if ([object isKindOfClass: [NSArray class ]]) {
65- NSArray * objects = (NSArray *)object;
66- [dic removeObjectForKey: originKey];
67- NSMutableDictionary * transferDic = [@{aimKey:objects} mutableCopy];
68- [dic setObject: transferDic forKey: originKey];
69- }
70- };
71- TransformDictionary (@" AccessControlList" , @" Grant" );
7249
7350
7451 return YES ;
@@ -80,31 +57,6 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
8057 return dic;
8158 }
8259 NSMutableDictionary * transfromDic = [NSMutableDictionary dictionaryWithDictionary: dic];
83- NSArray * transformArrayKeypaths = @[
84- @" AccessControlList" ,
85- ];
86-
87- for (NSString * keyPath in transformArrayKeypaths) {
88- id object = [dic valueForKeyPath: keyPath];
89- if (!object) {
90- continue ;
91- }
92- if ([object isKindOfClass: [NSNull class ]]) {
93- continue ;
94- }
95- if (![object isKindOfClass: [NSArray class ]]) {
96- if ([object isKindOfClass: [NSDictionary class ]] && [(NSDictionary *)object count ] == 1 ) {
97- id value = [[object allValues ] firstObject ];
98- if ([value isKindOfClass: [NSArray class ]]) {
99- [transfromDic setValue: value forKey: keyPath];
100- } else {
101- [transfromDic setValue: @[value] forKey: keyPath];
102- }
103- } else {
104- [transfromDic setValue: @[object] forKeyPath: keyPath];
105- }
106- }
107- }
10860
10961 return transfromDic;
11062}
0 commit comments