Reply To: Rewrite Annotations

Splash Forums Rewrite Users Rewrite Annotations Reply To: Rewrite Annotations

#24220

So.. the way combining annotations works is this (as far as I know… Christian did most of the work on annotations; I just refined the API:)

Order of annotation processing:

  1. Class
  2. Method
  3. Parameter

Each handler is provided a Context variable:

public void process(ClassContext context, Join annotation, HandlerChain chain)
public void process(MethodContext context, URLAction annotation, HandlerChain chain)
public void process(ParameterContext context, Param annotation, HandlerChain chain)

As you can see here, each sub-context also has access to the parent contexts:

https://github.com/ocpsoft/rewrite/blob/master/annotations-api/src/main/java/org/ocpsoft/rewrite/annotation/api/ParameterContext.java

Additionally, you can store variables in the contexts for use in sub-parameter handlers:

https://github.com/ocpsoft/rewrite/blob/master/config-annotations/src/main/java/org/ocpsoft/rewrite/annotation/handler/ParameterHandler.java#L88

This is how we implemented Join with Parameter and URLAction.