@Retention(RUNTIME)
@Target({CONSTRUCTOR,METHOD})
public @interface SqlColumns
Result.ResultMap.get(java.lang.String, java.lang.Class<T>)
.
The method or constructor must be public.
An instance of this type will be constructed by calling the factory method or
constructor. Each element in the value of this annotation is used as a column
identifier. The value of that column is passed to the corresponding parameter
of the annotated method or constructor. The id argument to Result.ResultMap.get(java.lang.String, java.lang.Class<T>)
is
prefixed to the column identifiers.
The following pseudo-code describes how an instance is constructed.
<pre> int i = 0;
String[] columns = methodOrConstructor.getAnnotation(SqlColumns.class).value();
Object[] args = new Object[columns.length];
for (String columnName : columns)
args[i] = resultMap.get(prefix + columnName, parameterTypes[i++];
instance = methodOrConstructor.invoke(null, args);</pre>
Modifier and Type | Required Element | Description |
---|---|---|
java.lang.String[] |
value |
The column names corresponding to the parameters of the factory method or
constructor to construct an instance of this type.
|
java.lang.String[] value
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
DRAFT JDBC 4.4 EA