ocpsoft/rewrite — pull request #27 by chkal (2012-04-12 05:53:17+00:00)
Title: Created new FieldContext for annotation handlers processing fields

Hey Lincoln,

I'm currently finishing the implementation of some of the annotation handlers. During working on this I noticed that it would make sense to have some kind of field context object that is able to hold information that affects only the field currently processed by the handlers. IMHO this makes sense because the annotations placed on a single field typically process some "entity" (like a binding for example) and therefore need to share some information.

This pull request contains a new context called `FieldContext` which extends `ClassContext`. This context currently only provides the possibility to register a "current binding" (`@ParameterBinding` does this) and to retrieve it (which other handles could to to enrich the binding).

I already modified two of the annotation handlers to use this new field context. The `ParameterBindingHandler` registers the just created binding:

https://github.com/chkal/prettyfaces/blob/field-context/annotations/src/main/java/org/ocpsoft/prettyfaces/annotation/handlers/ParameterBindingHandler.java#L93

And the `JSFValidatorHandler` retrieves this binding to attach a validator:

https://github.com/chkal/prettyfaces/blob/field-context/annotations/src/main/java/org/ocpsoft/prettyfaces/annotation/handlers/JSFValidatorHandler.java#L44

Works fine! :)

What do you think?