Skip to content

Instantly share code, notes, and snippets.

@karanmalhi
Created June 14, 2011 14:19
Show Gist options
  • Save karanmalhi/1024990 to your computer and use it in GitHub Desktop.
Save karanmalhi/1024990 to your computer and use it in GitHub Desktop.
Contains all annotations used on Person
package learnquest;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Info(authors = @Author(fn = "Karan", ln = "Malhi"), version = 1.1)
public class Person {
@Info(authors = { @Author(fn = "Karan", ln = "Malhi"),
@Author(fn = "Alice", ln = "Sidorski"),
@Author(fn = "Sarah", ln = "Garwood") })
@Inject("Alice")
private String firstName;
public String getFirstName() {
return firstName;
}
}
@Target({ ElementType.TYPE, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@interface Info {
Author[] authors();
double version() default 1.0;
}
@Retention(RetentionPolicy.RUNTIME)
@interface Author {
String fn();
String ln() default "";
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface Inject {
String value();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment