Polymorphic sub-resource locators (perfectly useful and legitimate in JAX/RS) are not handled by client proxy generators - likely because there isn't enough information in the standard JAX/RS annotations.
Consider this situation:
In a client, if you are working with RootResource and know that the subresource with id = "Fred" is a SubresourceB, it would be nice if you could do something analogous to:
The generated RootResource proxy has no way to know what type of Subresource is going to be returned. Only the user of the client interface (and the server implementation) has enough context to understand that the result of root.get("Fred") is going to be a SubresourceB.
Because this isn't covered in JAX/RS, how about an extension to the ResteasyClientProxy interface with this method:
With that addition, clients that are Resteasy aware could do this:
Additionally, suppose the ProxyBuilder ignores the method "as" with a single Class<?> parameter and no annotations, so interfaces could optionally declare:
Thus exposing the "as" method in the interface and allowing this: