Skip to content

Instantly share code, notes, and snippets.

@dylanz
Created May 26, 2011 23:44
Show Gist options
  • Save dylanz/994371 to your computer and use it in GitHub Desktop.
Save dylanz/994371 to your computer and use it in GitHub Desktop.
TortugaParsing
####### Annotation
[sun-2:Tortuga] cat src/TortugaTable.java
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface TortugaTable {
String tableName();
}
####### Class
[sun-2:Tortuga] cat src/User.java
@TortugaTable(tableName = "users")
public class User {
public static void main(String[] args) {
TortugaTable table = User.class.getAnnotation(TortugaTable.class);
System.out.println(table.tableName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment