XFire

Home
Bug/Issue Reporting
Download
FAQ
Get Involved
License
News
Performance
Stack Comparison
Support
Who uses XFire\?
XFire Team

Documentation

Javadocs
Reports
User's Guide
Release Notes

Quicklinks

Aegis Binding
Client
JAXB 2.0
JSR 181 Annotations
Spring

Developers

Developer Space
CVS
Building
Architecture
Interesting Projects
Roadmap
Release Process
JAX\-WS

Working in Java 5

Everything mentioned above will still work in Java 5.0 but you will get several additional features:

  1. Support for Generics and Collections
  2. Enum Support
  3. Ability to use Attributes to control naming
  4. Nice integration with XFire's JSR 181 support

Of the above generics and enums should work out of the box. Just declare and use.

Aegis Annotations

Lets say we would like to control the naming of our elements again. Via annotations it would look like so:

import org.codehaus.xfire.aegis.java5.XmlElement;

@XmlType(namespace="urn:north-pole:operations")
public class Employee
{
  private String name;
  private String title;

  @XmlElement(name="Name", namespace="urn:north-pole:operations")
  public String getName() { return name; }
  public void setName(String name) { this.name = name; }

  @XmlElement(name="Title", namespace="urn:north-pole:operations")
  public String getTitle() { return title; }
  public void setTitle(String title) { this.title = title; }
}

Notice, annotations are declared on the read method of a property.

Voila, this should serialize as:

<np:Employee xmlns:np="urn:north-pole:operations">
  <np:Name>Santa Claus</np:Name>
  <np:Title>Chief Present Officer (CPO)</np:Title>
</np:Employee>

You could of course use the XmlAttribute type as well:

import org.codehaus.xfire.aegis.java5.XmlElement;
...
public class Employee
{
  private String name;
  private String title;

  @XmlAttribute(name="Name", namespace="urn:north-pole:operations")
  public String getName() { return name; }
  public void setName(String name) { this.name = name; }

....
}

This would serialize as:

<np:Employee np:Name="Santa Claus" xmlns:np="urn:north-pole:operations">
  <np:Title>Chief Present Officer (CPO)</np:Title>
</np:Employee>