Files
yinmeng-ios/xplan-ios/Base/Tool/NSObject+MJExtension.m

65 lines
1.5 KiB
Mathematica
Raw Normal View History

//
2021-10-26 19:14:01 +08:00
// NSObject+MJExtension.m
// xplan-ios
//
2021-10-26 19:14:01 +08:00
// Created by zu on 2021/10/27.
//
2021-10-26 19:14:01 +08:00
#import "NSObject+MJExtension.h"
#import <MJExtension/MJExtension.h>
2021-10-26 19:14:01 +08:00
@implementation NSObject (MJExtension)
///
/// @param json json
+ (NSArray *)modelsWithArray:(id)json {
2021-10-26 19:14:01 +08:00
return [self mj_objectArrayWithKeyValuesArray:json];
}
///
/// @param dictionary
+ (instancetype)modelWithDictionary:(NSDictionary *)dictionary {
2021-10-26 19:14:01 +08:00
return [self mj_objectWithKeyValues:dictionary];
}
/// JSON
/// @param json json
+ (instancetype)modelWithJSON:(id)json {
2021-10-26 19:14:01 +08:00
return [self mj_objectWithKeyValues:json];
}
///model
- (NSDictionary *)model2dictionary {
2021-10-26 19:14:01 +08:00
return [[self mj_keyValues] copy];
}
2021-10-26 19:14:01 +08:00
- (NSString *)toJSONString {
return [self mj_JSONString];
}
2021-10-26 19:14:01 +08:00
- (id)toJSONObject {
return [self mj_JSONObject];
}
///
+ (NSDictionary *)mj_objectClassInArray {
2021-10-26 19:14:01 +08:00
return [self objectClassInArray];
}
///
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
2021-10-26 19:14:01 +08:00
return [self replacedKeyFromPropertyName];
}
///
///
+ (NSDictionary *)objectClassInArray {
2021-10-26 19:14:01 +08:00
return @{};
}
/// id -> ID name -> other.name
+ (NSDictionary *)replacedKeyFromPropertyName {
2021-10-26 19:14:01 +08:00
return @{};
}
2021-10-26 19:14:01 +08:00
@end