Codehaus XFire
DocumentationQuicklinksDevelopers
Sponsors |
Working in Java 5Everything mentioned above will still work in Java 5.0 but you will get several additional features:
Of the above generics and enums should work out of the box. Just declare and use. Aegis AnnotationsLets say we would like to control the naming of our elements again. Via annotations it would look like so: import org.codehaus.xfire.aegis.type.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.type.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> You can also prevent a property from appearing in the WSDL by using the IgnoreProperty: import org.codehaus.xfire.aegis.type.java5.IgnoreProperty; .. public class Employee { private String password; @IgnoreProperty public String getPassword() {return password;} ... } |