Dear all, I have an interface to create a object, like the followings. My question is: *how to annotate the Animal and Dog/Cat to make sure the input "animal" can be the instance of Dog/Cat after de-serialization?*
My expectation is that the service createAnimal can be used for all the sub-classes of Animal. public class Animal { // All animals have names, for our demo purposes... public String name; protected Animal() { } } public class Dog extends Animal { public double barkVolume; // in decibels public Dog() { } } public class Cat extends Animal { boolean likesCream; public int lives; public Cat() { } } @Path("/zoo") public interface ZooService{ @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @CSDNSecure Response createAnimal(Animal animal); } Thanks, Wenxing
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev