View Javadoc
1   /**
2    *    Copyright 2009-2019 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.apache.ibatis.annotations;
17  
18  import java.lang.annotation.Documented;
19  import java.lang.annotation.ElementType;
20  import java.lang.annotation.Repeatable;
21  import java.lang.annotation.Retention;
22  import java.lang.annotation.RetentionPolicy;
23  import java.lang.annotation.Target;
24  
25  import org.apache.ibatis.type.JdbcType;
26  import org.apache.ibatis.type.TypeHandler;
27  import org.apache.ibatis.type.UnknownTypeHandler;
28  
29  /**
30   * The annotation that specify a mapping definition for the property.
31   *
32   * @see Results
33   * @author Clinton Begin
34   */
35  @Documented
36  @Retention(RetentionPolicy.RUNTIME)
37  @Target(ElementType.METHOD)
38  @Repeatable(Results.class)
39  public @interface Result {
40    /**
41     * Returns whether id column or not.
42     *
43     * @return {@code true} if id column; {@code false} if otherwise
44     */
45    boolean id() default false;
46  
47    /**
48     * Return the column name(or column label) to map to this argument.
49     *
50     * @return the column name(or column label)
51     */
52    String column() default "";
53  
54    /**
55     * Returns the property name for applying this mapping.
56     *
57     * @return the property name
58     */
59    String property() default "";
60  
61    /**
62     * Return the java type for this argument.
63     *
64     * @return the java type
65     */
66    Class<?> javaType() default void.class;
67  
68    /**
69     * Return the jdbc type for column that map to this argument.
70     *
71     * @return the jdbc type
72     */
73    JdbcType jdbcType() default JdbcType.UNDEFINED;
74  
75    /**
76     * Returns the {@link TypeHandler} type for retrieving a column value from result set.
77     *
78     * @return the {@link TypeHandler} type
79     */
80    Class<? extends TypeHandler> typeHandler() default UnknownTypeHandler.class;
81  
82    /**
83     * Returns the mapping definition for single relationship.
84     *
85     * @return the mapping definition for single relationship
86     */
87    One one() default @One;
88  
89    /**
90     * Returns the mapping definition for collection relationship.
91     *
92     * @return the mapping definition for collection relationship
93     */
94    Many many() default @Many;
95  }