cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: databinding: mapping by object graph
Date Wed, 13 Jan 2010 21:11:44 GMT

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
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message