Package org.jdbi.v3.sqlobject.customizer
Annotation Type DefineList
-
@Retention(RUNTIME) @Target(PARAMETER) public @interface DefineList
Defines a named attribute as a comma-separatedStringfrom the elements of the annotated array orListargument. Attributes are stored on theStatementContext, and may be used by the template engine. For example:@SqlUpdate("insert into <table> (<columns>) values (<values>)") int insert(@Define String table, @DefineList List<String> columns, @BindList List<Object> values); @SqlQuery("select <columns> from <table> where id = :id") ResultSet select(@DefineList("columns") List<String> columns, @Define("table") String table, @Bind("id") long id);An array or
Listargument passed to@DefineListwill be converted to a comma-separated String and set as a whole as a single specified attribute. Duplicate members in theListmay cause SQL exceptions. An emptyListornullmembers in theListwill result in anIllegalArgumentException.Be aware of the list members you're binding with @DefineList, as there is no input sanitization! Blindly passing Strings through
@DefineListmay make your application vulnerable to SQL Injection.- See Also:
Define
-
-
Element Detail
-
value
String value
The attribute name to define. If omitted, the name of the annotated parameter is used. It is an error to omit the name when there is no parameter naming information in your class files.- Returns:
- the attribute key
- Default:
- ""
-
-