[aerogear-dev] [Aeorgear Controller] Additional type support on endpoints methods
Sebastien Blanc
scm.blanc at gmail.com
Tue Mar 12 10:14:37 EDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20130312/5486b82c/attachment.html
More information about the aerogear-dev
mailing list