Skip to content

Commit

Permalink
Use dumb if-else instead of reflection
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
harawata committed May 5, 2020
1 parent b165e81 commit 4aba814
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 272 deletions.
5 changes: 0 additions & 5 deletions src/main/java/org/apache/ibatis/annotations/Delete.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand All @@ -44,7 +41,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(Delete.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
public @interface Delete {
/**
* Returns an SQL for deleting record(s).
Expand All @@ -67,7 +63,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
@interface List {
Delete[] value();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand Down Expand Up @@ -52,7 +49,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(DeleteProvider.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
public @interface DeleteProvider {

/**
Expand Down Expand Up @@ -111,7 +107,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.DELETE)
@interface List {
DeleteProvider[] value();
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/apache/ibatis/annotations/Insert.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand All @@ -44,7 +41,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(Insert.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
public @interface Insert {
/**
* Returns an SQL for inserting record(s).
Expand All @@ -67,7 +63,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
@interface List {
Insert[] value();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand Down Expand Up @@ -52,7 +49,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(InsertProvider.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
public @interface InsertProvider {

/**
Expand Down Expand Up @@ -111,7 +107,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.INSERT)
@interface List {
InsertProvider[] value();
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/apache/ibatis/annotations/Select.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand All @@ -44,7 +41,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(Select.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
public @interface Select {
/**
* Returns an SQL for retrieving record(s).
Expand All @@ -67,7 +63,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
@interface List {
Select[] value();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand Down Expand Up @@ -52,7 +49,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(SelectProvider.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
public @interface SelectProvider {

/**
Expand Down Expand Up @@ -111,7 +107,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.SELECT)
@interface List {
SelectProvider[] value();
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/apache/ibatis/annotations/Update.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand All @@ -44,7 +41,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(Update.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
public @interface Update {
/**
* Returns an SQL for updating record(s).
Expand All @@ -67,7 +63,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
@interface List {
Update[] value();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.apache.ibatis.annotations;

import org.apache.ibatis.builder.annotation.StatementAnnotationMetadata;
import org.apache.ibatis.mapping.SqlCommandType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
Expand Down Expand Up @@ -52,7 +49,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(UpdateProvider.List.class)
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
public @interface UpdateProvider {

/**
Expand Down Expand Up @@ -111,7 +107,6 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@StatementAnnotationMetadata(commandType = SqlCommandType.UPDATE)
@interface List {
UpdateProvider[] value();
}
Expand Down
Loading

0 comments on commit 4aba814

Please sign in to comment.