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 constructor argument. 31 * 32 * @see ConstructorArgs 33 * @author Clinton Begin 34 */ 35 @Documented 36 @Retention(RetentionPolicy.RUNTIME) 37 @Target(ElementType.METHOD) 38 @Repeatable(ConstructorArgs.class) 39 public @interface Arg { 40 41 /** 42 * Returns whether id column or not. 43 * 44 * @return {@code true} if id column; {@code false} if otherwise 45 */ 46 boolean id() default false; 47 48 /** 49 * Return the column name(or column label) to map to this argument. 50 * 51 * @return the column name(or column label) 52 */ 53 String column() default ""; 54 55 /** 56 * Return the java type for this argument. 57 * 58 * @return the java type 59 */ 60 Class<?> javaType() default void.class; 61 62 /** 63 * Return the jdbc type for column that map to this argument. 64 * 65 * @return the jdbc type 66 */ 67 JdbcType jdbcType() default JdbcType.UNDEFINED; 68 69 /** 70 * Returns the {@link TypeHandler} type for retrieving a column value from result set. 71 * 72 * @return the {@link TypeHandler} type 73 */ 74 Class<? extends TypeHandler> typeHandler() default UnknownTypeHandler.class; 75 76 /** 77 * Return the statement id for retrieving a object that map to this argument. 78 * 79 * @return the statement id 80 */ 81 String select() default ""; 82 83 /** 84 * Returns the result map id for mapping to a object that map to this argument. 85 * 86 * @return the result map id 87 */ 88 String resultMap() default ""; 89 90 /** 91 * Returns the parameter name for applying this mapping. 92 * 93 * @return the parameter name 94 * @since 3.4.3 95 */ 96 String name() default ""; 97 98 /** 99 * Returns the column prefix that use when applying {@link #resultMap()}. 100 * 101 * @return the column prefix 102 * @since 3.5.0 103 */ 104 String columnPrefix() default ""; 105 }