Thursday, 31 May 2012

Jersey 2.0 Custom Java Objects

I'm really upset how Jersey 2.0 is handling custom java objects for query parameters.  The Jersey query types can have a constructor that accepts a single String argument, a static method named 'valueOf' or 'fromString' that accepts a single String argument, or a read only List<T>, Set<T> or SortedSet<T>.

It assumes that objects are created from a single parameter.  Most of my parameters are created from multiple parameters combined together.  For example, a location object is usually sent like "?x=0&y=0&z=0".  Why not match these parameters to a type's constructor like Vector3d(int x, int y, int z) assuming the application is compiled in debug or allowing param annotations on constructors and/or getter/setter methods would be a giant step in the right direction.

No comments:

Post a Comment