Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Latest commit

 

History

History
34 lines (25 loc) · 1.03 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.03 KB

gwtjaxb

A GWT library that supports basic JAXB annotations to bind xml to a bean hierarchy.

Usage

Creating a jaxb parser is easy:

@JAXBBindings(value=RootBean.class, objects={NestedSubObjectOne.class, NestedSubObjectTwo.class})
public interface RootBeanParserFactory extends JAXBParserFactory<RootBean>{}

You create an interface that extends JAXBParserFactory<> with a generic that matches the @XMLRootEntity node.

Then you add a @JAXBBindings to the interface where value is the @XmlRootEntity and objects is an array of all other beans that the parser should use.

Using the jaxb parser is easy:

RootBeanParserFactory p = GWT.create(RootBeanParserFactory .class);
RootBean bean = p.create().parse("<RootBean />");

Create and instance of the parser using GWT.create() and pass an xml string in for parsing.

Supported Annotations

  • @XmlAccessorType(XmlAccessType.FIELD): Only the attributes on fields are supported
  • @XmlRootElement
  • @XmlAttribute
  • @XmlElement
  • @XmlTransient
  • @XmlValue Adding more support soon