JAXB group of elements.
A convenient utility class that enables on-fly creation of JAXB annotated
collections of elements, for example:
@XmlRootElement
public class Page {
@XmlElement
public Object getEmployees() {
Collection<Employee> employees = this.retrieve();
return JaxbGroup.build(employees, "employee");
}
}
It's even more convenient in combination with
JaxbBundle, for
example:
@XmlRootElement
public class Page {
@XmlElement
public Object getEmployee() {
return new JaxbBundle("employee")
.attr("age", "45")
.add("depts", JaxbGroup.build(this.depts(), "dept"))
.up()
.element();
}
}
The class is immutable and thread-safe.