A subelement represents a containment or ownership relationship. For example, Enterprise Server defines the network-listeners element to contain the configuration data for individual network listeners. The configuration data for an individual network listener is represented by the network-listener element, which is a subelement of network-listeners element.
Define an interface to represent the subelement.
For more information, see Defining an Element.
The interface that represents the subelement must extend the org.jvnet.hk2.config.ConfigBeanProxy interface.
In the interface that defines the parent element, identify the subelement to its parent element.
This example shows the declaration of the WombatElement interface to represent the wombat-element element.
... import org.jvnet.hk2.config.ConfigBeanProxy; import org.jvnet.hk2.config.Configured; ... @Configured public interface WombatElement extends ConfigBeanProxy { ... } ...
This example identifies the wombat-element element as a subelement.
... import org.jvnet.hk2.config.Element; ... import java.beans.PropertyVetoException; ... @Element public WombatElement getElement(); public void setElement(WombatElement element) throws PropertyVetoException; ...