Skip to content

Instantly share code, notes, and snippets.

View peter-lawrey's full-sized avatar

Peter Lawrey peter-lawrey

View GitHub Profile
@peter-lawrey
peter-lawrey / A.B.C.D.E.java
Created March 14, 2012 08:42
Nested types
public class A {
public interface B {
public enum C {;
public @interface D {
public class E {
// etc etc
}
}
}
}
@peter-lawrey
peter-lawrey / AnnotationHandler.java
Created March 14, 2012 08:34
Interface for adding functionality to an annotation
import java.lang.reflect.Member;
/**
* @author peter.lawrey
*/
public interface AnnotationHandler<A> {
void process(Model model, Member member, A annotation);
}
@peter-lawrey
peter-lawrey / AnnotationsWithCode.java
Created March 14, 2012 08:31
A way to associate code with an annotation
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Member;
/**
* @author peter.lawrey
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CustomAnnotation {
public int value() default 0;