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

Sebastien Blanc scm.blanc at gmail.com
Tue Mar 12 16:33:19 EDT 2013


Just an additional info : this PR doesn't imply any breaking changes, AG
controller demo, TODO app will continue to work without any code change !
Seb


On Tue, Mar 12, 2013 at 3:14 PM, 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20130312/ed2a2169/attachment.html 


More information about the aerogear-dev mailing list