xml - Java Extending an Object Except for Some Attributes of Parents -
i have class c extends b. , b extends a. has attribute name. don't want see name attribute @ c class.
how can ignore?
ps: if not possible @ java: working on spring project uses apache cxf , has web service capability. want b type object client , send c type object client. because of design issues don't want change inheritance mechanism. if there way can ignore name field @ c class? implementing first-code style.
i have class c extends b. , b extends a. has attribute name. don't want see name attribute @ c class.
based on edit, trying hide attribute superclass (a) in serialized representation of 1 of it's subclasses (c). assuming using jax-ws/jax-rs, can overriding property in subclass , applying annotations mark not eligible serialization. primary annotation apply jaxb annotation @xmltransient. can @jsonignore property, if providing option serialize objects json. pseudo code shown below:
@xmlrootelement public class implements serializable { private string name; // ... } @xmlrootelement public class c extends { @override @xmltransient public string getname() { return super.getname(); } }
Comments
Post a Comment