Files
peko-ios/YuMi/Tools/NSObject+MJExtension.m

65 lines
1.5 KiB
Mathematica
Raw Normal View History

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