Skip to content

Commit cf0a588

Browse files
committed
Add javadoc on SQL provider annotation
Related with gh-1279
1 parent a7869b2 commit cf0a588

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,33 @@
2828
@Retention(RetentionPolicy.RUNTIME)
2929
@Target(ElementType.METHOD)
3030
public @interface DeleteProvider {
31+
32+
/**
33+
* Specify a type that implements an SQL provider method.
34+
*
35+
* @return a type that implements an SQL provider method
36+
*/
3137
Class<?> type();
3238

39+
/**
40+
* Specify a method for providing an SQL.
41+
*
42+
* <p>
43+
* Since 3.5.1, this attribute can omit.
44+
* If this attribute omit, the MyBatis will call a method that decide by following rules.
45+
* <ul>
46+
* <li>
47+
* If class that specified the {@link #type()} attribute implements the {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver},
48+
* the MyBatis use a method that returned by it
49+
* </li>
50+
* <li>
51+
* If cannot resolve a method by {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver}(= not implement it or it was returned {@code null}),
52+
* the MyBatis will search and use a fallback method that named {@code resolveSql} from specified type
53+
* </li>
54+
* </ul>
55+
*
56+
* @return a method name of method for providing an SQL
57+
*/
3358
String method() default "";
59+
3460
}

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,33 @@
2828
@Retention(RetentionPolicy.RUNTIME)
2929
@Target(ElementType.METHOD)
3030
public @interface InsertProvider {
31+
32+
/**
33+
* Specify a type that implements an SQL provider method.
34+
*
35+
* @return a type that implements an SQL provider method
36+
*/
3137
Class<?> type();
3238

39+
/**
40+
* Specify a method for providing an SQL.
41+
*
42+
* <p>
43+
* Since 3.5.1, this attribute can omit.
44+
* If this attribute omit, the MyBatis will call a method that decide by following rules.
45+
* <ul>
46+
* <li>
47+
* If class that specified the {@link #type()} attribute implements the {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver},
48+
* the MyBatis use a method that returned by it
49+
* </li>
50+
* <li>
51+
* If cannot resolve a method by {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver}(= not implement it or it was returned {@code null}),
52+
* the MyBatis will search and use a fallback method that named {@code resolveSql} from specified type
53+
* </li>
54+
* </ul>
55+
*
56+
* @return a method name of method for providing an SQL
57+
*/
3358
String method() default "";
59+
3460
}

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,33 @@
2828
@Retention(RetentionPolicy.RUNTIME)
2929
@Target(ElementType.METHOD)
3030
public @interface SelectProvider {
31+
32+
/**
33+
* Specify a type that implements an SQL provider method.
34+
*
35+
* @return a type that implements an SQL provider method
36+
*/
3137
Class<?> type();
3238

39+
/**
40+
* Specify a method for providing an SQL.
41+
*
42+
* <p>
43+
* Since 3.5.1, this attribute can omit.
44+
* If this attribute omit, the MyBatis will call a method that decide by following rules.
45+
* <ul>
46+
* <li>
47+
* If class that specified the {@link #type()} attribute implements the {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver},
48+
* the MyBatis use a method that returned by it
49+
* </li>
50+
* <li>
51+
* If cannot resolve a method by {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver}(= not implement it or it was returned {@code null}),
52+
* the MyBatis will search and use a fallback method that named {@code resolveSql} from specified type
53+
* </li>
54+
* </ul>
55+
*
56+
* @return a method name of method for providing an SQL
57+
*/
3358
String method() default "";
59+
3460
}

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,33 @@
2828
@Retention(RetentionPolicy.RUNTIME)
2929
@Target(ElementType.METHOD)
3030
public @interface UpdateProvider {
31+
32+
/**
33+
* Specify a type that implements an SQL provider method.
34+
*
35+
* @return a type that implements an SQL provider method
36+
*/
3137
Class<?> type();
3238

39+
/**
40+
* Specify a method for providing an SQL.
41+
*
42+
* <p>
43+
* Since 3.5.1, this attribute can omit.
44+
* If this attribute omit, the MyBatis will call a method that decide by following rules.
45+
* <ul>
46+
* <li>
47+
* If class that specified the {@link #type()} attribute implements the {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver},
48+
* the MyBatis use a method that returned by it
49+
* </li>
50+
* <li>
51+
* If cannot resolve a method by {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver}(= not implement it or it was returned {@code null}),
52+
* the MyBatis will search and use a fallback method that named {@code resolveSql} from specified type
53+
* </li>
54+
* </ul>
55+
*
56+
* @return a method name of method for providing an SQL
57+
*/
3358
String method() default "";
59+
3460
}

0 commit comments

Comments
 (0)