Skip to content

Instantly share code, notes, and snippets.

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Handler(MyAnnotationHandler.class) // ← link to the handler
public @interface MyAnnotation {
String foo();
String bar();
}
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Handler {
Class<? extends AnnotationHandler> value();
}
@Getter
@AllArgsConstructor
public class FrameworkAnnotationContext<T extends Annotation> {
private T annotation;
private Object instance;
private AnnotatedElement annotatedElement;
}
public interface AnnotationHandler<T extends Annotation> {
void handle(ScanContext scanContext, FrameworkAnnotationContext<T> annotationContext);
}
public ScanContext scan(Object instance, ScanOptions options) {
return scan(instance, options, new ScanContext(), new ArrayList<?>());
}
Map<String, Object> config = loadConfig();
MyFramework.Builder builder = MyFramework.builder();
config.forEach((key, value) -> builder.set(key,value));
MyFramework framework = builder.build();
MyFramework framework = MyFramework.builder()
.optionA(…)
.optionB(…)
.set("optionName", …)
.build();
framework.init(…);

How to not screw up IC

From the perspective of somebody who actually did

These days have drained us all:

  • Show you've got traction.
  • Build your narrative.
  • Practice your pyramids!

The reality is that you need to expect the unexpected, so here are my three top tips to not screw up IC (because in hindsight, everything is simpler!).