Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit f8ba105

Browse files
committed
fix OnMapping() annotation check
1 parent 6c3d9b2 commit f8ba105

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/main/java/com/latte/orm/CSVModel.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,21 @@ public Model<T> startMapping(){
6969
}
7070
}
7171

72-
if (entityClass.getAnnotation(OnMapping.class) == null || entityClass.getAnnotation(OnMapping.class).check()){
72+
OnMapping onMapping = null;
73+
if(entityClass.getAnnotation(OnMapping.class) == null){ //if not declared, set check() true
74+
onMapping = new OnMapping() {
75+
public Class<? extends Annotation> annotationType() {
76+
return OnMapping.class;
77+
}
78+
public boolean check() {
79+
return true;
80+
}
81+
};
82+
} else {
83+
onMapping = entityClass.getAnnotation(OnMapping.class);
84+
}
85+
86+
if(onMapping.check()){
7387
if(CheckAnnotationConstraints(newEntityClassInstance)){
7488
records.add(newEntityClassInstance);
7589
} else {
@@ -79,6 +93,7 @@ public Model<T> startMapping(){
7993
} else {
8094
records.add(newEntityClassInstance);
8195
}
96+
8297
rowNumber++;
8398
}
8499
bf.close();

0 commit comments

Comments
 (0)