Created
June 14, 2011 14:19
-
-
Save karanmalhi/1024990 to your computer and use it in GitHub Desktop.
Contains all annotations used on Person
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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