#import <Foundation/Foundation.h>
/**
* This protocol let you control conversion between data key
* and class properties
*/
@protocol RMMapping <NSObject>
@optional
// Allow properties to be excluded from parsing data
- (NSArray *)rm_excludedProperties;
// Mapping for properties keys to class properties
- (NSDictionary *)rm_dataKeysForClassProperties;
@end
@interface RMMapper : NSObject
/**
Answer from http://stackoverflow.com/questions/754824/get-an-object-attributes-list-in-objective-c/13000074#13000074
Return dictionary of property name and type from a class.
Useful for Key-Value Coding.
*/
+ (NSDictionary *)propertiesForClass:(Class)cls;
/** Populate existing object with values from dictionary
*/
+ (id) populateObject:(id)obj fromDictionary:(NSDictionary*)dict;
+ (id) populateObject:(id)obj fromDictionary:(NSDictionary*)dict exclude:(NSArray*)excludeArray;
/** Create a new object with given class and populate it with value from dictionary
*/
+ (id) objectWithClass:(Class)cls fromDictionary:(NSDictionary*)dict;
/** Convert an object to a dictionary
*/
+ (NSDictionary*) dictionaryForObject:(id)obj;
+ (NSDictionary*) dictionaryForObject:(id)obj include:(NSArray*)includeArray;
+ (NSMutableDictionary*) mutableDictionaryForObject:(id)obj;
+ (NSMutableDictionary*) mutableDictionaryForObject:(id)obj include:(NSArray*)includeArray;
/** Convert an array of dict to array of object with predefined class
*/
+ (NSArray*) arrayOfClass:(Class)cls fromArrayOfDictionary:(NSArray*)array;
+ (NSMutableArray*) mutableArrayOfClass:(Class)cls fromArrayOfDictionary:(NSArray*)array;
@end
没有合适的资源?快使用搜索试试~ 我知道了~
BaseModel,包含Model基本所需功能
共4个文件
m:2个
h:2个
需积分: 32 41 下载量 108 浏览量
2015-11-27
14:34:22
上传
评论
收藏 7KB ZIP 举报
温馨提示
基础Model类, 实现了 将Model转化成NSDictionary,转化成JsonString,将NSDictionary转化成Model 继承BaseModel类,创建自己的Model类
资源推荐
资源详情
资源评论
收起资源包目录
baseModel.zip (4个子文件)
RMMapper.m 11KB
JZBaseModel.m 5KB
JZBaseModel.h 537B
RMMapper.h 2KB
共 4 条
- 1
资源评论
jasonjz
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功