net.charlesames.utility.entity
Class XmlChoice

java.lang.Object
  extended by net.charlesames.utility.entity.XmlNode
      extended by net.charlesames.utility.entity.XmlElement
          extended by net.charlesames.utility.entity.XmlChoice

public abstract class XmlChoice
extends XmlElement

An XmlChoice instance is a component of an XmlSpec that offers a choice between XmlComplexElement instances.

Author:
Charles Ames

Nested Class Summary
 class XmlChoice.Variation
          Each XmlChoice.Variation instance identifies a choice option for a XmlChoice instance.
 
Constructor Summary
XmlChoice(XmlSpec xmlSpec, java.lang.Class<? extends WriteableEntity> baseEntityClass)
          Constructor for XmlChoice instances.
 
Method Summary
 void addElement(XmlComplexElement element)
          Add an element to this choice.
 void getData(WriteableEntity entity, org.w3c.dom.Element element)
          Reads data from an XML Element into an WriteableEntity instance.
 java.lang.String getXsdTag()
          Get the tag identifying this node in an XML schema document.
abstract  void putData(WriteableEntity entity, org.w3c.dom.Element element)
          Writes data from an WriteableEntity instance into an XML Element.
 org.w3c.dom.Element toXsdElement(org.w3c.dom.Node parent)
          Convert the XML specification node to a node description in an XML schema document
 
Methods inherited from class net.charlesames.utility.entity.XmlElement
getMaxOccurs, getMinOccurs, isIncludedInSchema, setMaxOccurs, setMinOccurs
 
Methods inherited from class net.charlesames.utility.entity.XmlNode
getDescription, getTag, getXmlSpec, setDescription, setIncludedInSchema
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlChoice

public XmlChoice(XmlSpec xmlSpec,
                 java.lang.Class<? extends WriteableEntity> baseEntityClass)
Constructor for XmlChoice instances.

Parameters:
xmlSpec - The parent XML specification.
baseEntityClass - The base entity class.
Method Detail

addElement

public void addElement(XmlComplexElement element)
Add an element to this choice.

Parameters:
element - The element.

getData

public void getData(WriteableEntity entity,
                    org.w3c.dom.Element element)
Description copied from class: XmlElement
Reads data from an XML Element into an WriteableEntity instance.

Specified by:
getData in class XmlElement
Parameters:
entity - The target WriteableEntity instance.
element - The source Element.

getXsdTag

public java.lang.String getXsdTag()
Description copied from class: XmlNode
Get the tag identifying this node in an XML schema document.

Overrides:
getXsdTag in class XmlElement
Returns:
The tag identifying this node in an XML schema document.

putData

public abstract void putData(WriteableEntity entity,
                             org.w3c.dom.Element element)
Description copied from class: XmlNode
Writes data from an WriteableEntity instance into an XML Element.

Specified by:
putData in class XmlNode
Parameters:
entity - The source WriteableEntity.
element - The target Element.

toXsdElement

public org.w3c.dom.Element toXsdElement(org.w3c.dom.Node parent)
Description copied from class: XmlNode
Convert the XML specification node to a node description in an XML schema document

Overrides:
toXsdElement in class XmlElement
Parameters:
parent - The parent node.
Returns:
THe newly created node.