站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

DOMConvertor (NetBeans Settings API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.spi.settings
Class DOMConvertor

java.lang.Object
  extended byorg.netbeans.spi.settings.Convertor
      extended byorg.netbeans.spi.settings.DOMConvertor

public abstract class DOMConvertor
extends Convertor

DOMConvertor extends the Convertor to allow to compose output of several convertors into one xml document. For more info see Composed Content.

Since:
1.1

Constructor Summary
protected DOMConvertor(String publicID, String systemID, String rootElement)
          Creat a DOMConvertor
 
Method Summary
protected static Object delegateRead(Element element)
          delegate the read operation to a convertor referenced by dtd_public_id
protected static Element delegateWrite(Document doc, Object obj)
          delegate the write operation to a convertor able to write obj.
protected static Lookup findContext(Document doc)
          get a context associated with the document doc.
 Object read(Reader r)
          Read content from r and delegate to readElement(org.w3c.dom.Element) passing parsed content as a root element of DOM document
protected abstract  Object readElement(Element element)
          Provide an object constructed from the element.
 void write(Writer w, Object inst)
          Write object described by DOM document filled by writeElement(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.Object)
protected abstract  void writeElement(Document doc, Element element, Object obj)
          Fill a DOM element describing obj with attributes or subelements.
 
Methods inherited from class org.netbeans.spi.settings.Convertor
findContext, findContext, registerSaver, unregisterSaver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMConvertor

protected DOMConvertor(String publicID,
                       String systemID,
                       String rootElement)
Creat a DOMConvertor

Parameters:
publicID - public ID of DOCTYPE
systemID - system ID of DOCTYPE
rootElement - qualified name of root element
Method Detail

read

public final Object read(Reader r)
                  throws IOException,
                         ClassNotFoundException
Read content from r and delegate to readElement(org.w3c.dom.Element) passing parsed content as a root element of DOM document

Specified by:
read in class Convertor
Parameters:
r - stream containing stored object
Returns:
the read setting object
Throws:
IOException - if the object cannot be read
ClassNotFoundException - if the object class cannot be resolved
Since:
1.1

write

public final void write(Writer w,
                        Object inst)
                 throws IOException
Write object described by DOM document filled by writeElement(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.Object)

Specified by:
write in class Convertor
Parameters:
w - stream into which inst is written
inst - the setting object to be written
Throws:
IOException - if the object cannot be written
Since:
1.1

readElement

protected abstract Object readElement(Element element)
                               throws IOException,
                                      ClassNotFoundException
Provide an object constructed from the element.

Parameters:
element - represents a read object in a DOM document
Returns:
an setting object
Throws:
IOException - if the object cannot be read
ClassNotFoundException - if the object class cannot be resolved
Since:
1.1

writeElement

protected abstract void writeElement(Document doc,
                                     Element element,
                                     Object obj)
                              throws IOException,
                                     DOMException
Fill a DOM element describing obj with attributes or subelements.

Parameters:
doc - a DOM document allowing to create elements describing passed object
element - represents a written object in a DOM document
obj - an object to convert
Throws:
IOException - if the object cannot be written
DOMException - if an element construction failed
Since:
1.1

delegateRead

protected static final Object delegateRead(Element element)
                                    throws IOException,
                                           ClassNotFoundException
delegate the read operation to a convertor referenced by dtd_public_id

Parameters:
element - DOM element that should be read
Returns:
an setting object
Throws:
IOException - if the object cannot be read
ClassNotFoundException - if the object class cannot be resolved
Since:
1.1
See Also:
readElement(org.w3c.dom.Element)

delegateWrite

protected static final Element delegateWrite(Document doc,
                                             Object obj)
                                      throws IOException,
                                             DOMException
delegate the write operation to a convertor able to write obj.

Parameters:
doc - a DOM document allowing to create elements describing passed object
obj - an object to convert
Returns:
a DOM element representation
Throws:
IOException - if the object cannot be written
DOMException - if an element construction failed
Since:
1.1
See Also:
writeElement(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.Object)

findContext

protected static Lookup findContext(Document doc)
get a context associated with the document doc. It can contain various info like a file location of the read document etc.

Parameters:
doc - a DOM document containing stored object
Returns:
a context associated with the document
Since:
1.2

 

Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.