Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.lang.annotations.*;
- @Target({ElementType.LOCAL_VARIABLE})
- @Retention(RetentionPolicy.RUNTIME)
- public @interface DBAnnotation {
- String variable () default "";
- String table () default "";
- String column () default "";
- boolean isSource () default false;
- }
- public static void addFileToDB(String fileName, String fileLocation, int offerID){
- @DBAnnotation (variable = "fileName", table = "files", column = "FileName", isSource = true)
- @DBAnnotation (variable = "fileLocation", table = "files", column = "fileLocation", isSource = true)
- String SQLFileSelect = "SELECT FileName FROM files WHERE OfferID = ? AND FileLocation = ?;";
- .
- .
- .
- }
- Duplicate annotation @File.DBAnnotation. Repeated annotations are allowed only at source level 1.8 or above
- public @interface DBAnnotation {
- String[] variable () default "";
- String table () default "";
- String[] column () default "";
- boolean[] isSource () default false;
- }
- .
- .
- .
- @DBAnnotation (
- variable = {"fileName","fileLocation"},
- table = "files",
- column = {"FileName","fileLocation"},
- isSource = true)
- variable = {"fileName","fileLocation"},
- table = "files",
- column = {"FileName","fileLocation"},
- isSource = true
- getAnnotation(DBAnnotation.class).variable(); // will return the String array with both values.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement