//
//  ProvinceModel.m
//  redstar
//
//  Created by admin on 15/12/13.
//  Copyright © 2015年 ZWF. All rights reserved.
//

#import "ProvinceModel.h"

@implementation ProvinceModel
- (id)initWithName:(NSString *)name children:(NSArray *)children
{
    self = [super init];
    if (self) {
        self.storeArray = [NSArray arrayWithArray:children];
        self.name = name;
    }
    return self;
}

+ (id)dataObjectWithName:(NSString *)name children:(NSArray *)children
{
    return [[self alloc] initWithName:name children:children];
}
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
    Class cls = self.class;
    for (NSString *key in keyedValues.allKeys) {
        NSString *varName = [NSString stringWithFormat:@"_%@", key];
        const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
        Ivar var = class_getInstanceVariable(cls, c_key);
        if (var) {
            [self setValue:[keyedValues objectForKey:key] forKey:key];
        }
    }
}
@end
