net.beandocument
Class BeanElement

java.lang.Object
  extended bynet.beandocument.BeanBaseNode
      extended bynet.beandocument.BeanElement
All Implemented Interfaces:
org.w3c.dom.Element, org.w3c.dom.Node
Direct Known Subclasses:
BeanCollectionElement, BeanMapElement, BeanObjectElement, BeanSimpleTypeElement

public abstract class BeanElement
extends BeanBaseNode
implements org.w3c.dom.Element

Base implementation for bean document elements

Author:
Jens Scheffler

Field Summary
 
Fields inherited from class net.beandocument.BeanBaseNode
owner, parent
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
protected BeanElement(BeanDocument owner, BeanBaseNode parent, java.lang.String tagName, java.lang.Object bean)
          Constructor for a new Bean Element
 
Method Summary
protected  void addBeanSpecificAttribute(java.lang.String name, java.lang.String value)
          Adds an additional synthetic attribute to the element
 java.lang.String getAttribute(java.lang.String name)
          Retrieves the named attribute value
 org.w3c.dom.Attr getAttributeNode(java.lang.String name)
          Retrieves the named attribute object instance
 org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespace, java.lang.String name)
          Retrieves the named attribute object instance with the given namespace.
 java.lang.String getAttributeNS(java.lang.String namespace, java.lang.String name)
          Retrieves the named attribute value with the given namespace.
 org.w3c.dom.NamedNodeMap getAttributes()
          Retrieves all attributes of the element
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
          Retrieves all direct child nodes of this element.
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespace, java.lang.String name)
          Retrieves all direct child nodes of this element by given namespace.
 org.w3c.dom.Node getFirstChild()
          Retrieves the first child node from the element
 org.w3c.dom.Node getLastChild()
          Retrieves the last child node from the element
 java.lang.String getLocalName()
          Retrieves the local element name
 java.lang.String getNodeName()
          Gets the element tag name
 short getNodeType()
          Returns the node type value
 java.lang.String getNodeValue()
          Retrieves null value as node value like described in specification
 java.lang.String getTagName()
          Tag name of this element implementation
 boolean hasAttribute(java.lang.String name)
          Checks whether this element contains the attribute with the given name
 boolean hasAttributeNS(java.lang.String namespace, java.lang.String name)
          Checks whether this element contains the attribute with the given name
 boolean hasAttributes()
          Checks whether this element contains any attribute
 boolean hasChildNodes()
          Checks whether this element contains any child nodes
 void removeAttribute(java.lang.String name)
          NOTE: This function is not implemented and therefore will just throw an exception!
 org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr node)
          NOTE: This function is not implemented and therefore will just throw an exception!
 void removeAttributeNS(java.lang.String namespace, java.lang.String name)
          NOTE: This function is not implemented and therefore will just throw an exception!
 void setAttribute(java.lang.String name, java.lang.String value)
          NOTE: This function is not implemented and therefore will just throw an exception!
 org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr node)
          NOTE: This function is not implemented and therefore will just throw an exception!
 org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr node)
          NOTE: This function is not implemented and therefore will just throw an exception!
 void setAttributeNS(java.lang.String namespace, java.lang.String name, java.lang.String value)
          NOTE: This function is not implemented and therefore will just throw an exception!
 void setNodeValue(java.lang.String value)
          Sets the node value of this implementation.
 
Methods inherited from class net.beandocument.BeanBaseNode
appendChild, cloneNode, getElementFactory, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, insertBefore, isSupported, normalize, removeChild, replaceChild, setNextSibling, setPrefix, setPreviousSibling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getChildNodes, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, insertBefore, isSupported, normalize, removeChild, replaceChild, setPrefix
 

Constructor Detail

BeanElement

protected BeanElement(BeanDocument owner,
                      BeanBaseNode parent,
                      java.lang.String tagName,
                      java.lang.Object bean)
Constructor for a new Bean Element

Parameters:
owner - Owned document for the new Element
parent - Parent element of this element
tagName - Name of the new element
bean - Bean which is the base for the element
Method Detail

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Retrieves the named attribute value

Specified by:
getAttribute in interface org.w3c.dom.Element
Parameters:
name - Name of attribute to retrieve
Returns:
Value of the attribute or null if not set
See Also:
Element.getAttribute(java.lang.String)

getAttributeNode

public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
Retrieves the named attribute object instance

Specified by:
getAttributeNode in interface org.w3c.dom.Element
Parameters:
name - Name of attribute to retrieve
Returns:
Attribute node or null if not set
See Also:
Element.getAttributeNode(java.lang.String)

getAttributeNodeNS

public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespace,
                                           java.lang.String name)
Retrieves the named attribute object instance with the given namespace. Since namespace functionality is not implemented, only when calling with namespace is null a value will be returned.

Specified by:
getAttributeNodeNS in interface org.w3c.dom.Element
Parameters:
namespace - Namespace to use for the retrieved node. must be null to retrieve a value.
name - Name of the attribute to retrieve
Returns:
Attribute node with the namespace of null or null if any namespace is given
See Also:
Element.getAttributeNodeNS(java.lang.String, java.lang.String)

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String namespace,
                                       java.lang.String name)
Retrieves the named attribute value with the given namespace. Since namespace functionality is not implemented, only when calling with namespace is null a value will be returned.

Specified by:
getAttributeNS in interface org.w3c.dom.Element
Parameters:
namespace - Namespace to use for the retrieved node. must be null to retrieve a value.
name - Name of the attribute to retrieve
Returns:
Attribute value with the namespace of null or null if any namespace is given
See Also:
Element.getAttributeNS(java.lang.String, java.lang.String)

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Retrieves all attributes of the element

Specified by:
getAttributes in interface org.w3c.dom.Node
Returns:
Attributes of this element
See Also:
Node.getAttributes()

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
Retrieves all direct child nodes of this element. NOTE: to prevent infinite recursion, only one level of elements is checked! This does not conform with DOM specification but is required to run stable

Specified by:
getElementsByTagName in interface org.w3c.dom.Element
Parameters:
name - Tag name to search for in the children, "*" means all child's
Returns:
List of child elements matching the given name
See Also:
Element.getElementsByTagName(java.lang.String)

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespace,
                                                   java.lang.String name)
Retrieves all direct child nodes of this element by given namespace. NOTE: to prevent infinite recursion, only one level of elements is checked! This does not conform with DOM specification but is required to run stable NOTE: since namespace support is not implemented, only calls with empty namespace will return a result

Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Element
Parameters:
namespace - Namespace to search child nodes for, need to be null or "*" to retrieve a result!
name - Tag name to search for in the children, "*" means all child's
Returns:
Empty list of child nodes
See Also:
Element.getElementsByTagNameNS(java.lang.String, java.lang.String)

getFirstChild

public org.w3c.dom.Node getFirstChild()
Retrieves the first child node from the element

Specified by:
getFirstChild in interface org.w3c.dom.Node
Returns:
First child node or null if no child nodes are present
See Also:
Node.getFirstChild()

getLastChild

public org.w3c.dom.Node getLastChild()
Retrieves the last child node from the element

Specified by:
getLastChild in interface org.w3c.dom.Node
Returns:
Last child node or null if no child nodes are present
See Also:
Node.getLastChild()

getLocalName

public java.lang.String getLocalName()
Retrieves the local element name

Specified by:
getLocalName in interface org.w3c.dom.Node
Returns:
Tag name of this element
See Also:
Node.getLocalName()

getNodeName

public java.lang.String getNodeName()
Gets the element tag name

Specified by:
getNodeName in interface org.w3c.dom.Node
Returns:
Element tag name
See Also:
Node.getNodeName()

getNodeType

public short getNodeType()
Returns the node type value

Specified by:
getNodeType in interface org.w3c.dom.Node
Returns:
Node.ELEMENT_NODE
See Also:
Node.getNodeType()

getNodeValue

public java.lang.String getNodeValue()
                              throws org.w3c.dom.DOMException
Retrieves null value as node value like described in specification

Specified by:
getNodeValue in interface org.w3c.dom.Node
Returns:
null value
Throws:
org.w3c.dom.DOMException - (never throws this exception)
See Also:
Node.getNodeValue()

getTagName

public java.lang.String getTagName()
Tag name of this element implementation

Specified by:
getTagName in interface org.w3c.dom.Element
Returns:
Tag name of this element
See Also:
Element.getTagName()

hasAttribute

public boolean hasAttribute(java.lang.String name)
Checks whether this element contains the attribute with the given name

Specified by:
hasAttribute in interface org.w3c.dom.Element
Parameters:
name - Attribute name to check for
Returns:
true if the given attribute exists, false if not
See Also:
Element.hasAttribute(java.lang.String)

hasAttributeNS

public boolean hasAttributeNS(java.lang.String namespace,
                              java.lang.String name)
Checks whether this element contains the attribute with the given name

Specified by:
hasAttributeNS in interface org.w3c.dom.Element
Parameters:
namespace - Namespace to look for
name - Attribute name to check for
Returns:
true if the given attribute exists, false if not
See Also:
Element.hasAttributeNS(java.lang.String, java.lang.String)

hasAttributes

public boolean hasAttributes()
Checks whether this element contains any attribute

Specified by:
hasAttributes in interface org.w3c.dom.Node
Returns:
true if any attribute exists, false if not
See Also:
Node.hasAttributes()

hasChildNodes

public boolean hasChildNodes()
Checks whether this element contains any child nodes

Specified by:
hasChildNodes in interface org.w3c.dom.Node
Returns:
true if any child node exists, false if not
See Also:
Node.hasChildNodes()

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws org.w3c.dom.DOMException
NOTE: This function is not implemented and therefore will just throw an exception!

Specified by:
removeAttribute in interface org.w3c.dom.Element
Parameters:
name - Attribute name to remove - ignored by this implementation
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
Element.removeAttribute(java.lang.String)

removeAttributeNode

public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr node)
                                     throws org.w3c.dom.DOMException
NOTE: This function is not implemented and therefore will just throw an exception!

Specified by:
removeAttributeNode in interface org.w3c.dom.Element
Parameters:
node - Attribute to remove - ignored by this implementation
Returns:
(This function will never return normally)
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
Element.removeAttributeNode(org.w3c.dom.Attr)

removeAttributeNS

public void removeAttributeNS(java.lang.String namespace,
                              java.lang.String name)
                       throws org.w3c.dom.DOMException
NOTE: This function is not implemented and therefore will just throw an exception!

Specified by:
removeAttributeNS in interface org.w3c.dom.Element
Parameters:
namespace - Namespace of the attribute - ignored by this implementation
name - Attribute name to remove - ignored by this implementation
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
Element.removeAttributeNS(java.lang.String, java.lang.String)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws org.w3c.dom.DOMException
NOTE: This function is not implemented and therefore will just throw an exception!

Specified by:
setAttribute in interface org.w3c.dom.Element
Parameters:
name - Attribute to modify - ignored by this implementation
value - Attribute value to set - ignored by this implementation
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
Element.setAttribute(java.lang.String, java.lang.String)

setAttributeNode

public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr node)
                                  throws org.w3c.dom.DOMException
NOTE: This function is not implemented and therefore will just throw an exception!

Specified by:
setAttributeNode in interface org.w3c.dom.Element
Parameters:
node - Node to set - ignored by this implementation
Returns:
(This function will never return normally)
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
Element.setAttributeNode(org.w3c.dom.Attr)

setAttributeNodeNS

public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr node)
                                    throws org.w3c.dom.DOMException
NOTE: This function is not implemented and therefore will just throw an exception!

Specified by:
setAttributeNodeNS in interface org.w3c.dom.Element
Parameters:
node - Node to set - ignored by this implementation
Returns:
(This function will never return normally)
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
Element.setAttributeNodeNS(org.w3c.dom.Attr)

setAttributeNS

public void setAttributeNS(java.lang.String namespace,
                           java.lang.String name,
                           java.lang.String value)
                    throws org.w3c.dom.DOMException
NOTE: This function is not implemented and therefore will just throw an exception!

Specified by:
setAttributeNS in interface org.w3c.dom.Element
Parameters:
namespace - Attribute namespace to modify - ignored by this implementation
name - Attribute to modify - ignored by this implementation
value - Attribute value to set - ignored by this implementation
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
Element.setAttributeNS(java.lang.String, java.lang.String, java.lang.String)

setNodeValue

public void setNodeValue(java.lang.String value)
                  throws org.w3c.dom.DOMException
Sets the node value of this implementation. Since this is defined to be null, calls will be just ignored

Specified by:
setNodeValue in interface org.w3c.dom.Node
Overrides:
setNodeValue in class BeanBaseNode
Parameters:
value - Value to set
Throws:
org.w3c.dom.DOMException - (never throws this exception)
See Also:
Node.setNodeValue(java.lang.String)

addBeanSpecificAttribute

protected void addBeanSpecificAttribute(java.lang.String name,
                                        java.lang.String value)
Adds an additional synthetic attribute to the element

Parameters:
name - Name of the attribute to add
value - Value to set to the attribute