java - jersey rest: how to return interface instead of class -
i have rest webservice. reason don't want return class needed converted interface. want return interface , in json want see methods(which starts get) values. not attributes implemented class.
say example:
@path("getvalues/") @get @produces( mediatype.application_json) public detailinterface getclientdetail() { return new detailimpl(); } and consider interface:
public interface detailinterface { public string getname(); public string getage(); } and consider implementation
public class detailimpl implements detailinterface { public string getname() return "my name"; } public string getage(){ return "my age"; } public string idontwantthisinjson() { return "i don't want in json output"; } } when request rest service see idontwantthisinjson attribute comes in json response. don't want include in response.
how can fix this?
have tried @jsonignore annotation? marking field transient may helpful - i'm not sure if it's ok.
Comments
Post a Comment