Oracle GlassFish Server 3.0.1 Add-On Component Development Guide

ProcedureTo Define a Subelement

  1. 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.

  2. In the interface that defines the parent element, identify the subelement to its parent element.

    1. Represent the subelement as the property of a JavaBeans specification getter or setter method.

    2. Annotate the declaration of the getter or setter method that is associated with the subelement with the org.jvnet.hk2.config.Element annotation.

Example 6–3 Declaring an Interface to Represent a Subelement

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;
public interface WombatElement extends ConfigBeanProxy {

Example 6–4 Identifying a Subelement to its Parent Element

This example identifies the wombat-element element as a subelement.

import org.jvnet.hk2.config.Element;
import java.beans.PropertyVetoException;
    public WombatElement getElement();
    public void setElement(WombatElement element) throws PropertyVetoException;