RFC: Use @Path and @GET/@PUT/@POST for annotation router

This is an implementation based on our discussion.  It implements JAX-RS-style (don't cry) routing support for both the Controller and Controller Methods.  It removes the former `@Route` annotation.

This supports mode-limited routes.  Multiple modes can be specified for a route via the `@Dev`, `@Prod`, and `@Test` annotations.

This PR does NOT support route ordering - which I have decided may still be important for things like my Swagger module.  I still am thinking that RegEx routes do not belong here; those should be non-annotated only.

I also tweaked the  `AnnotationRouter` to implement the `ApplicationRoutes` interface - this is the same design seen in the `CasinoRouter`.

I think this moves the `AnnotationRouter` forward, but Darren should review.

You also have to remember that users can create their own modes, upon which this would fail.

I was going to change my annotation to have an exclude field, because when you think about it, this would normally be used to exclude from production.


On 9 Aug 2014, at 12:32, Raphael A. Bauer <notifications@github.com> wrote:

> In ninja-annotation-router-beta/src/main/java/router/AnnotationRouter.java:
> 
> > +	 * Determines if this method may be registered as a route for the current
> > +	 * runtime mode. A method may be annotated to run in multiple modes.
> > +	 *
> > +	 * @param method
> > +	 * @return true if the method can be registered as a route
> > +	 */
> > +	private boolean allowMethod(Method method) {
> > +
> > +		int mode = MODE_ALL;
> > +		if (method.isAnnotationPresent(Dev.class)) {
> > +			mode |= MODE_DEV;
> > +		}
> > +		if (method.isAnnotationPresent(Test.class)) {
> > +			mode |= MODE_TEST;
> > +		}
> > +		if (method.isAnnotationPresent(Prod.class)) {
> I somehow don't like binary comparisons on ints. If you like them we can leave them like that. On the other hand I'd really favor having 
> 1) private boolean allowMethod(Method method, NinjaProperies ninjaProperties) {...}
> 2) Doing away with the binary ints and using plain old comparisons via bools...
> 
> I can change that, too. It's really just a matter of taste...
> 
> —
> Reply to this email directly or view it on GitHub.
> 

Darren Hudson
Mobile: 07866 004000  Office: 01628 623367
www.docfacto.com