org.freecompany.infoset.dom
Class DomInfosetFactory

java.lang.Object
  extended by org.freecompany.infoset.dom.DomInfosetFactory
All Implemented Interfaces:
InfosetFactory<org.w3c.dom.Document>

public class DomInfosetFactory
extends java.lang.Object
implements InfosetFactory<org.w3c.dom.Document>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.freecompany.infoset.InfosetFactory
InfosetFactory.Registry
 
Field Summary
protected  javax.xml.parsers.DocumentBuilderFactory factory
           
 
Constructor Summary
protected DomInfosetFactory()
           
 
Method Summary
<V> Infoset<org.w3c.dom.Document>
adaptFrom(Infoset<V> infoset)
          Converts an instance of the provided Infoset type to the native type for this factory.
<V> Infoset<V>
adaptTo(java.lang.Class<V> clazz, Infoset<org.w3c.dom.Document> infoset)
          Converts an instance of the provided Infoset type to the native type for this factory.
 Infoset<org.w3c.dom.Document> create(java.io.InputStream input)
          Creates an infoset that will, when accessed, parse the content from the provided URL.
 Infoset<org.w3c.dom.Document> create(java.nio.channels.ReadableByteChannel channel)
          Creates an infoset that will, when accessed, parse the content from the provided URL.
 Infoset<org.w3c.dom.Document> create(java.net.URL url)
          Creates an infoset that will, when accessed, parse the content from the provided InputStream.
static DomInfosetFactory newInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected final javax.xml.parsers.DocumentBuilderFactory factory
Constructor Detail

DomInfosetFactory

protected DomInfosetFactory()
Method Detail

newInstance

public static DomInfosetFactory newInstance()

create

public Infoset<org.w3c.dom.Document> create(java.net.URL url)
                                     throws java.io.IOException
Description copied from interface: InfosetFactory
Creates an infoset that will, when accessed, parse the content from the provided InputStream. Once parsed, the content will be cached, so anything that wishes to modify the resulting Document must clone it first.

Specified by:
create in interface InfosetFactory<org.w3c.dom.Document>
Throws:
java.io.IOException

create

public Infoset<org.w3c.dom.Document> create(java.nio.channels.ReadableByteChannel channel)
                                     throws java.io.IOException
Description copied from interface: InfosetFactory
Creates an infoset that will, when accessed, parse the content from the provided URL. Once parsed, the content will be cached, so anything that wishes to modify the resulting Document must clone it first.

Specified by:
create in interface InfosetFactory<org.w3c.dom.Document>
Throws:
java.io.IOException

create

public Infoset<org.w3c.dom.Document> create(java.io.InputStream input)
Description copied from interface: InfosetFactory
Creates an infoset that will, when accessed, parse the content from the provided URL. Once parsed, the content will be cached, so anything that wishes to modify the resulting Document must clone it first.

Specified by:
create in interface InfosetFactory<org.w3c.dom.Document>

adaptTo

public <V> Infoset<V> adaptTo(java.lang.Class<V> clazz,
                              Infoset<org.w3c.dom.Document> infoset)
Description copied from interface: InfosetFactory
Converts an instance of the provided Infoset type to the native type for this factory. If the factory does not support the conversion, it should return null.

Specified by:
adaptTo in interface InfosetFactory<org.w3c.dom.Document>

adaptFrom

public <V> Infoset<org.w3c.dom.Document> adaptFrom(Infoset<V> infoset)
Description copied from interface: InfosetFactory
Converts an instance of the provided Infoset type to the native type for this factory. If the factory does not support the conversion, it should return null.

Specified by:
adaptFrom in interface InfosetFactory<org.w3c.dom.Document>