com.gridsystems.nextgrid.api.pom.ref
Class DomReference

java.lang.Object
  extended by com.gridsystems.nextgrid.api.pom.ref.ReferenceSupport<org.w3c.dom.Document>
      extended by com.gridsystems.nextgrid.api.pom.ref.DomReference
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, nextgrid.api.pom.Reference<org.w3c.dom.Document>

public class DomReference
extends ReferenceSupport<org.w3c.dom.Document>

A DomReference instance wraps an XML DOM document.

There are mainly two use cases where a DomReference makes sense:

Author:
Rodrigo Ruiz
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.gridsystems.nextgrid.api.pom.ref.ReferenceSupport
LOG
 
Constructor Summary
DomReference()
          Creates a new empty instance.
DomReference(org.w3c.dom.Document doc)
          Creates a new instance.
DomReference(java.lang.String xml)
          Creates a new instance.
 
Method Summary
 boolean canCastFrom(java.lang.Class<?> type)
          
 boolean canCastTo(java.lang.Class<?> type)
          
 java.lang.Object castTo(java.lang.Class<?> type)
          
 org.w3c.dom.Document getValue()
          
 java.lang.Class<org.w3c.dom.Document> getValueType()
          
protected static org.w3c.dom.Document newDocument()
          Creates a new XML document instance.
protected static org.w3c.dom.Document parseDoc(java.lang.String xml)
          Parses a string into a DOM document.
 void setValue(java.lang.Object value)
          
protected static java.lang.String xmlToString(org.w3c.dom.Node node)
          Gets a string representation of the given XML node.
 
Methods inherited from class com.gridsystems.nextgrid.api.pom.ref.ReferenceSupport
addReader, addWriter, clearLinks, copy, dispose, getReaders, getWriters, isAvailable, readLock, removeReader, removeWriter, reset, setAvailable, waitAvailable, writeLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomReference

public DomReference()
Creates a new empty instance.


DomReference

public DomReference(org.w3c.dom.Document doc)
Creates a new instance.

Parameters:
doc - XML document to wrap

DomReference

public DomReference(java.lang.String xml)
             throws org.xml.sax.SAXException,
                    javax.xml.parsers.ParserConfigurationException
Creates a new instance.

Parameters:
xml - A string containing an XML document
Throws:
org.xml.sax.SAXException - Parse error
javax.xml.parsers.ParserConfigurationException - Factory configuration error
Method Detail

getValue

public final org.w3c.dom.Document getValue()


setValue

public final void setValue(java.lang.Object value)


getValueType

public java.lang.Class<org.w3c.dom.Document> getValueType()


canCastTo

public boolean canCastTo(java.lang.Class<?> type)


canCastFrom

public boolean canCastFrom(java.lang.Class<?> type)


castTo

public java.lang.Object castTo(java.lang.Class<?> type)


parseDoc

protected static org.w3c.dom.Document parseDoc(java.lang.String xml)
                                        throws org.xml.sax.SAXException,
                                               javax.xml.parsers.ParserConfigurationException
Parses a string into a DOM document.

Parameters:
xml - The string containing the XML document to parse
Returns:
The obtained document
Throws:
javax.xml.parsers.ParserConfigurationException - Factory configuration error
org.xml.sax.SAXException - Parse error

newDocument

protected static org.w3c.dom.Document newDocument()
                                           throws javax.xml.parsers.ParserConfigurationException
Creates a new XML document instance.

Returns:
An XML document instance
Throws:
javax.xml.parsers.ParserConfigurationException - Factory configuration error

xmlToString

protected static java.lang.String xmlToString(org.w3c.dom.Node node)
Gets a string representation of the given XML node.

Parameters:
node - A node
Returns:
A String


Copyright © 2006-2008 Grid Systems, S.A.. All Rights Reserved.