Skip to content

Commit 4aba814

Browse files
committed
Use dumb if-else instead of reflection
Also slightly loosen the validation and it is now possible to mix provider and non-provider annotations if the databaseIds are different. See the new tests.
1 parent b165e81 commit 4aba814

File tree

13 files changed

+195
-272
lines changed

13 files changed

+195
-272
lines changed

src/main/java/org/apache/ibatis/annotations/Delete.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -44,7 +41,6 @@
4441
@Retention(RetentionPolicy.RUNTIME)
4542
@Target(ElementType.METHOD)
4643
@Repeatable(Delete.List.class)
47-
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
4844
public @interface Delete {
4945
/**
5046
* Returns an SQL for deleting record(s).
@@ -67,7 +63,6 @@
6763
@Documented
6864
@Retention(RetentionPolicy.RUNTIME)
6965
@Target(ElementType.METHOD)
70-
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
7166
@interface List {
7267
Delete[] value();
7368
}

src/main/java/org/apache/ibatis/annotations/DeleteProvider.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -52,7 +49,6 @@
5249
@Retention(RetentionPolicy.RUNTIME)
5350
@Target(ElementType.METHOD)
5451
@Repeatable(DeleteProvider.List.class)
55-
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
5652
public @interface DeleteProvider {
5753

5854
/**
@@ -111,7 +107,6 @@
111107
@Documented
112108
@Retention(RetentionPolicy.RUNTIME)
113109
@Target(ElementType.METHOD)
114-
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
115110
@interface List {
116111
DeleteProvider[] value();
117112
}

src/main/java/org/apache/ibatis/annotations/Insert.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -44,7 +41,6 @@
4441
@Retention(RetentionPolicy.RUNTIME)
4542
@Target(ElementType.METHOD)
4643
@Repeatable(Insert.List.class)
47-
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
4844
public @interface Insert {
4945
/**
5046
* Returns an SQL for inserting record(s).
@@ -67,7 +63,6 @@
6763
@Documented
6864
@Retention(RetentionPolicy.RUNTIME)
6965
@Target(ElementType.METHOD)
70-
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
7166
@interface List {
7267
Insert[] value();
7368
}

src/main/java/org/apache/ibatis/annotations/InsertProvider.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -52,7 +49,6 @@
5249
@Retention(RetentionPolicy.RUNTIME)
5350
@Target(ElementType.METHOD)
5451
@Repeatable(InsertProvider.List.class)
55-
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
5652
public @interface InsertProvider {
5753

5854
/**
@@ -111,7 +107,6 @@
111107
@Documented
112108
@Retention(RetentionPolicy.RUNTIME)
113109
@Target(ElementType.METHOD)
114-
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
115110
@interface List {
116111
InsertProvider[] value();
117112
}

src/main/java/org/apache/ibatis/annotations/Select.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -44,7 +41,6 @@
4441
@Retention(RetentionPolicy.RUNTIME)
4542
@Target(ElementType.METHOD)
4643
@Repeatable(Select.List.class)
47-
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
4844
public @interface Select {
4945
/**
5046
* Returns an SQL for retrieving record(s).
@@ -67,7 +63,6 @@
6763
@Documented
6864
@Retention(RetentionPolicy.RUNTIME)
6965
@Target(ElementType.METHOD)
70-
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
7166
@interface List {
7267
Select[] value();
7368
}

src/main/java/org/apache/ibatis/annotations/SelectProvider.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -52,7 +49,6 @@
5249
@Retention(RetentionPolicy.RUNTIME)
5350
@Target(ElementType.METHOD)
5451
@Repeatable(SelectProvider.List.class)
55-
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
5652
public @interface SelectProvider {
5753

5854
/**
@@ -111,7 +107,6 @@
111107
@Documented
112108
@Retention(RetentionPolicy.RUNTIME)
113109
@Target(ElementType.METHOD)
114-
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
115110
@interface List {
116111
SelectProvider[] value();
117112
}

src/main/java/org/apache/ibatis/annotations/Update.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -44,7 +41,6 @@
4441
@Retention(RetentionPolicy.RUNTIME)
4542
@Target(ElementType.METHOD)
4643
@Repeatable(Update.List.class)
47-
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
4844
public @interface Update {
4945
/**
5046
* Returns an SQL for updating record(s).
@@ -67,7 +63,6 @@
6763
@Documented
6864
@Retention(RetentionPolicy.RUNTIME)
6965
@Target(ElementType.METHOD)
70-
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
7166
@interface List {
7267
Update[] value();
7368
}

src/main/java/org/apache/ibatis/annotations/UpdateProvider.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
19-
import org.apache.ibatis.mapping.SqlCommandType;
20-
2118
import java.lang.annotation.Documented;
2219
import java.lang.annotation.ElementType;
2320
import java.lang.annotation.Repeatable;
@@ -52,7 +49,6 @@
5249
@Retention(RetentionPolicy.RUNTIME)
5350
@Target(ElementType.METHOD)
5451
@Repeatable(UpdateProvider.List.class)
55-
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
5652
public @interface UpdateProvider {
5753

5854
/**
@@ -111,7 +107,6 @@
111107
@Documented
112108
@Retention(RetentionPolicy.RUNTIME)
113109
@Target(ElementType.METHOD)
114-
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
115110
@interface List {
116111
UpdateProvider[] value();
117112
}

0 commit comments

Comments
 (0)