org.enhydra.xml.xmlc.metadata
Class MetaDataElement

java.lang.Object
  |
  +--org.enhydra.apache.xerces.dom.NodeImpl
        |
        +--org.enhydra.apache.xerces.dom.ChildNode
              |
              +--org.enhydra.apache.xerces.dom.ParentNode
                    |
                    +--org.enhydra.apache.xerces.dom.ElementImpl
                          |
                          +--org.enhydra.xml.xmlc.metadata.MetaDataElement
All Implemented Interfaces:
Cloneable, Element, EventTarget, Node, NodeList, Serializable
Direct Known Subclasses:
CompileOptions, DocumentClass, DocumentSection, DOMEdits, ElementDef, ElementEdit, HTMLAttr, HTMLCompatibility, HTMLSection, HTMLTag, HTMLTagSet, Implements, Include, JavaCompilerSection, JavacOption, MetaData, Parser, TagClass, XCatalog

public class MetaDataElement
extends org.enhydra.apache.xerces.dom.ElementImpl

Base DOM class for all XMLC metadata element classes. This provides methods to implement attribute and child lookup

See Also:
Serialized Form

Fields inherited from class org.enhydra.apache.xerces.dom.ElementImpl
attributes, name, serialVersionUID
 
Fields inherited from class org.enhydra.apache.xerces.dom.ParentNode
fCachedChild, fCachedChildIndex, fCachedLength, firstChild, ownerDocument
 
Fields inherited from class org.enhydra.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.enhydra.apache.xerces.dom.NodeImpl
ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, UNNORMALIZED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
protected MetaDataElement(Document ownerDoc, String name)
          Constructor.
 
Method Summary
protected  void addStringArrayAttribute(String attrName, String value)
          Add a addtribute to a String array attribute.
protected  void completeModifications()
          Complete modifications to DOM.
protected  void deleteChild(Class elementClass)
          Delete a child element given its class.
protected  String getAttributeNull(String attrName)
          Get the value of a string attribute, or null if its not defined.
protected  boolean getBooleanAttribute(String attrName)
          Get the value of a boolean primitive attribute, with the default being false.
protected  boolean getBooleanAttribute(String attrName, boolean defaultValue)
          Get the value of a boolean primitive attribute.
protected  Boolean getBooleanObjectAttribute(String attrName)
          Get the value of a boolean object attribute.
protected  MetaDataElement getChild(Class elementClass)
          Locate a child element given its class, creating if if it doesn't exist.
protected  Node[] getChildren(Class elementClass)
          Get all children of the specified class.
protected  MetaDataElement getCreateChild(Class elementClass)
          Locate a child element given its class.
 MetaDataDocument getDocument()
          Get the metadata document object.
 MetaData getMetaData()
          Get the metadata root element object.
protected  String[] getStringArrayAttribute(String attrName)
          Get the value of a String array attribute.
protected  boolean isAttributeSpecified(String attrName)
          Determine if an attribute is specified.
protected  void mergeAttributes(Element srcElement)
          Merge attributes from another element into this element, with the other element overriding current attributes.
protected  void mergeElement(MetaDataElement srcElement)
          Merge another element into this element.
protected  void mergeSingletonChild(Class childClass, MetaDataElement srcElement)
          Merge a specified singleton child node, if it exists, otherwise clone it (if it exists).
protected  void setBooleanAttribute(String attrName, boolean value)
          Set the value of a boolean primitive attribute, with a default of false.
protected  void setBooleanAttribute(String attrName, boolean value, boolean defaultValue)
          Set the value of a boolean primitive attribute.
protected  void setBooleanObjectAttribute(String attrName, Boolean value)
          Set or delete the value of a boolean object attribute.
protected  void setChild(MetaDataElement element)
          Add or replace a child element.
protected  void setRemoveAttribute(String attrName, String value)
          Set or remove a string attribute.
protected  void setRemoveStringArrayAttribute(String attrName, String[] values)
          Set or remove a String array attribute.
 
Methods inherited from class org.enhydra.apache.xerces.dom.ElementImpl
cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getDefaultAttributes, getElementsByTagName, getElementsByTagNameNS, getNodeName, getNodeType, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, hasAttributes, normalize, reconcileDefaultAttributes, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setOwnerDocument, setReadOnly, setupDefaultAttributes, synchronizeData
 
Methods inherited from class org.enhydra.apache.xerces.dom.ParentNode
checkNormalizationAfterInsert, checkNormalizationAfterRemove, getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, hasChildNodes, insertBefore, internalInsertBefore, internalRemoveChild, item, lastChild, lastChild, ownerDocument, removeChild, replaceChild, synchronizeChildren
 
Methods inherited from class org.enhydra.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling, parentNode, previousSibling
 
Methods inherited from class org.enhydra.apache.xerces.dom.NodeImpl
addEventListener, appendChild, changed, changes, compareDocumentPosition, dispatchEvent, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getTextContent, getUserData, getUserData, hasStringValue, hasStringValue, internalIsIgnorableWhitespace, isDefaultNamespace, isEqualNode, isFirstChild, isFirstChild, isIgnorableWhitespace, isNormalized, isNormalized, isOwned, isOwned, isReadOnly, isReadOnly, isSameNode, isSpecified, isSpecified, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, needsSyncChildren, needsSyncData, needsSyncData, removeEventListener, setNodeValue, setPrefix, setTextContent, setUserData, setUserData, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Constructor Detail

MetaDataElement

protected MetaDataElement(Document ownerDoc,
                          String name)
Constructor.
Method Detail

getDocument

public MetaDataDocument getDocument()
Get the metadata document object.

getMetaData

public MetaData getMetaData()
Get the metadata root element object.

getCreateChild

protected MetaDataElement getCreateChild(Class elementClass)
Locate a child element given its class. This is used when only a single instance of an element can be a child.
Returns:
The first child elment of the specified class.

getChild

protected MetaDataElement getChild(Class elementClass)
Locate a child element given its class, creating if if it doesn't exist.
Returns:
The first child elment of the specified class or null in no child element implements the class.

setChild

protected void setChild(MetaDataElement element)
Add or replace a child element. This is used when only a single instance of an element can be a child.

deleteChild

protected void deleteChild(Class elementClass)
Delete a child element given its class. This is used when only a single instance of an element can be a child. If the element does not exist, the call is ignored.

getChildren

protected Node[] getChildren(Class elementClass)
Get all children of the specified class.

isAttributeSpecified

protected boolean isAttributeSpecified(String attrName)
Determine if an attribute is specified.

getBooleanObjectAttribute

protected Boolean getBooleanObjectAttribute(String attrName)
Get the value of a boolean object attribute. Boolean objects are used ot value that can be true, false, or unspecified.
Parameters:
attrName - The name of the attribute.
Returns:
The value of the object, or null if it doesn't exists.

setBooleanObjectAttribute

protected void setBooleanObjectAttribute(String attrName,
                                         Boolean value)
Set or delete the value of a boolean object attribute. Boolean objects are used for value that can be true, false, or unspecified.
Parameters:
attrName - The name of the attribute.
value - The value of the attribute, or null to delete.

getBooleanAttribute

protected boolean getBooleanAttribute(String attrName,
                                      boolean defaultValue)
Get the value of a boolean primitive attribute.
Parameters:
attrName - The name of the attribute.
defaultValue - Value to return if attribute doesn't exist.
Returns:
The value of the object.

getBooleanAttribute

protected boolean getBooleanAttribute(String attrName)
Get the value of a boolean primitive attribute, with the default being false.
Parameters:
attrName - The name of the attribute.
Returns:
The value of the object.

setBooleanAttribute

protected void setBooleanAttribute(String attrName,
                                   boolean value,
                                   boolean defaultValue)
Set the value of a boolean primitive attribute.
Parameters:
attrName - The name of the attribute.
value - The value of the attribute.
defaultValue - The default value for the attribute. If the value matches the default value, the attribute is removed rather than set. This must match the default passed to get.

setBooleanAttribute

protected void setBooleanAttribute(String attrName,
                                   boolean value)
Set the value of a boolean primitive attribute, with a default of false.
Parameters:
attrName - The name of the attribute.
value - The value of the attribute.

getAttributeNull

protected String getAttributeNull(String attrName)
Get the value of a string attribute, or null if its not defined.

setRemoveAttribute

protected void setRemoveAttribute(String attrName,
                                  String value)
Set or remove a string attribute. If the value is null, it is removed.

getStringArrayAttribute

protected String[] getStringArrayAttribute(String attrName)
Get the value of a String array attribute.

setRemoveStringArrayAttribute

protected void setRemoveStringArrayAttribute(String attrName,
                                             String[] values)
Set or remove a String array attribute. If the values is null, it is removed.

addStringArrayAttribute

protected void addStringArrayAttribute(String attrName,
                                       String value)
Add a addtribute to a String array attribute.

completeModifications

protected void completeModifications()
                              throws XMLCException
Complete modifications to DOM. This method is called on all elements in the DOM in a bottom-first manner once a read or set of modifications are complete. Elements should override this method if they need to do any processing. Normally, they will call super.completeModifications() first to traverse the subtree, then do their work. This is also useful in report errors upfront rather than at access time.

mergeAttributes

protected void mergeAttributes(Element srcElement)
Merge attributes from another element into this element, with the other element overriding current attributes.

mergeSingletonChild

protected void mergeSingletonChild(Class childClass,
                                   MetaDataElement srcElement)
Merge a specified singleton child node, if it exists, otherwise clone it (if it exists).

mergeElement

protected void mergeElement(MetaDataElement srcElement)
Merge another element into this element. This merges the attributes, the children and then appends clones the children. This maybe overriden. In particular, calling mergeElement to merge children is desired if there should only be one child of a particular type.


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.