KeyValueObjectMapping
KeyValueObjectMapping copied to clipboard
Support Parse configuration merging
Implementation provided may be improved, but it works well for the projects I work on.
1 - Interface
@interface DCParserConfiguration (XBAdditions)
-(void) mergeConfig:(DCParserConfiguration *) parserConfiguration;
@end
2 - Implementation
#import "DCParserConfiguration+XBAdditions.h"
#import "DCArrayMapping.h"
@implementation DCParserConfiguration (XBAdditions)
-(void) mergeConfig:(DCParserConfiguration *) parserConfiguration {
for (DCObjectMapping * objectMapping in parserConfiguration.objectMappers) {
DCArrayMapping * arrayMapping = [parserConfiguration arrayMapperForMapper:objectMapping];
if (arrayMapping) {
[self addArrayMapper:arrayMapping];
}
else{
[self addObjectMapping:objectMapping];
}
}
for (DCPropertyAggregator * propertyAggregator in parserConfiguration.aggregators) {
[self addAggregator:propertyAggregator];
}
for (DCCustomInitialize * customInitialize in parserConfiguration.customInitializers) {
[self addCustomInitializersObject:customInitialize];
}
for (DCCustomParser * customParser in parserConfiguration.customParsers) {
[self addCustomParsersObject:customParser];
}
}
@end