This is kind of possible. When writing/annoating the "Person" class, you can
put the JAXB annotations on the getter methods you want exposed (and
XmlTransient on stuff you don't) and internally, the get method could do some
calculations.
For example:
Person {
List<Child> children....
@XmlElement(name = "children")
List<Integer> getChildrenIds() {
List<Integer> ids = new ArrayList();
...
return ids;
}
@XmlTransient //don't want this method exposed
public List<Child> getChildren() {
return children;
}
}
Dan
On Tue January 12 2010 11:55:57 am Laurent Michenaud wrote:
> Hi,
>
> I would like to know if it is possible to do a mapping by object graph.
> For a same class, the mapping is different depending on the object path.
>
> Example :
> A method with a return parameter of type Person.
> Person contains a list of childs (Child type is Person class too).
>
> What i want is :
> - All parameters of the returned parameter are mapped in WSDL ( id, first
> name, last name, childs).
> - But the child list, i only want a list of id (child ids).
>
> Is it possible ?
>
> Thanks
>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog