[aerogear-dev] [Aeorgear Controller] Additional type support on endpoints methods

Daniel Bevenius daniel.bevenius at gmail.com
Wed Mar 13 04:02:36 EDT 2013


Hey Seb,

Support for types other than String were actually implemented in the past
but, it was decided to not add such support in favour of promoting the
usage of Java types (excluding the primitive wrappers). But requirements
can change, and perhaps this should be discussed again.
The motivation for adding before was the same as your second argument, that
it would be easier to use existing classes with aerogear controller. I'd
like to see this feature added for this reason.

/Dan



On 12 March 2013 15:14, Sebastien Blanc <scm.blanc at gmail.com> wrote:

> Hi,
> I'm currently working on scaffolding AG-controller stuff and for that I'm
> relying on the REST endpoints generated by the forge REST plugin. A typical
> method's signature of a generated endpoint looks like that :
>
> *public Response findById(Long id)*
>
> But an AG Controller route definition can't point to such a target method
> since it only support Strings as parameters :
>
> *
> route().from("/customers/{id}").on(RequestMethod.GET).consumes(JSON).produces(JSON).to(CustomerEndpoint.class).findById(param("id"));
> *
> *
> *
> Of course, the quick workaround would be to change the signature of the
> endpoint to :
>
> *public Response findById(String id)*
> *
> *
> But, in my particular case, after the scaffolding happens I can't really
> tell the developers : "Well, now you have to change manually all the
> signature of your endpoints and convert your Strings to Longs".
> Another use case could be an application having existing endpoints used by
> a Application A and we introduce Application B using AG controller. More
> generally, I think it would be a nice addition to AG controller.
>
> I've already proposed a pull request[1]  that can't handle all the types
> which have a constructor with a single String parameter : Long, Integer,
> BigDecimal, etc ... And also added unit tests to be sure I doesn't break
>
> Feedback is more than welcome !
>
> Seb
> [1] https://github.com/aerogear/aerogear-controller/pull/55
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20130313/086577e1/attachment-0001.html 


More information about the aerogear-dev mailing list