File tree Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 7
7
//
8
8
9
9
#import < UIKit/UIKit.h>
10
- @interface Student : NSObject
10
+ #import " GKDatabase.h"
11
+ @interface Student : NSObject <GKObjcPropertyDelegate>
11
12
@property (nonatomic , copy ) NSString *name;
12
13
@property (nonatomic , assign ) NSInteger age;
13
14
@property (nonatomic , assign ) CGFloat score;
14
15
@property (nonatomic , strong ) NSArray *books;
16
+ - (NSArray *)notSaveToDatabaseFormAttributesList ;
15
17
@end
Original file line number Diff line number Diff line change 9
9
#import " Student.h"
10
10
11
11
@implementation Student
12
-
12
+ // / 不存入数据库
13
+ - (NSArray *)notSaveToDatabaseFormAttributesList {
14
+ return @[@" score" ];
15
+ }
13
16
@end
Original file line number Diff line number Diff line change 25
25
@interface GKObjcProperty : NSObject
26
26
27
27
@property (nonatomic ,strong ) id <GKObjcPropertyDelegate> delegate;
28
+ + (GKObjcProperty *)getObject ;
28
29
29
30
/* *
30
31
* 获取属性名列表 例 name
Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ + (GKObjcProperty *)getObject {
33
33
* @return 属性类型列表
34
34
*/
35
35
+ (NSArray *)getUserNeedOCPropertyTypeListWithClass : (id )className {
36
+
36
37
if (className) {
37
- [self getObject ].delegate = className;
38
+ [self getObject ].delegate = [[[ className class ] alloc ]init] ;
38
39
if ([[self getObject ].delegate respondsToSelector: @selector (notSaveToDatabaseFormAttributesList )]) {
39
40
40
41
NSArray *userNeedAttributeList = [self getUserNeedAttributeListWithClass: className];
@@ -55,7 +56,6 @@ + (NSArray *)getUserNeedOCPropertyTypeListWithClass:(id)className {
55
56
NSString *name = [NSString stringWithCString: property_getName (property) encoding: NSUTF8StringEncoding];
56
57
// 转换为Objective C 字符串
57
58
NSString *type = [NSString stringWithCString: property_getAttributes (property) encoding: NSUTF8StringEncoding];
58
-
59
59
if ([name isEqualToString: userNeedAttribute]) {
60
60
[tempArrayM addObject: [self getAttributesWith: type]];
61
61
}
@@ -116,7 +116,7 @@ + (NSArray *)getSQLPropertyTypeListWithClass:(id)className {
116
116
// / 获取属性名列表
117
117
+ (NSArray *)getUserNeedAttributeListWithClass : (id )className {
118
118
if (className) {
119
- [self getObject ].delegate = className;
119
+ [self getObject ].delegate = [[[ className class ]alloc]init] ;
120
120
if ([[self getObject ].delegate respondsToSelector: @selector (notSaveToDatabaseFormAttributesList )]) {
121
121
122
122
NSArray *arr = [[self getObject ].delegate notSaveToDatabaseFormAttributesList ];
You can’t perform that action at this time.
0 commit comments