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

Convertor (NetBeans Settings API) - NetBeans API Javadoc 5.0.0

 

org.netbeans.spi.settings
Class Convertor

java.lang.Object
  extended byorg.netbeans.spi.settings.Convertor
Direct Known Subclasses:
DOMConvertor

public abstract class Convertor
extends Object

Convertor allows to read/write objects in own format and notify about object changes.


Constructor Summary
Convertor()
           
 
Method Summary
protected static Lookup findContext(Reader r)
          get a context associated with the reader r.
protected static Lookup findContext(Writer w)
          get a context associated with the writer w.
abstract  Object read(Reader r)
          Subclasses have to be able to read format implemented by write(java.io.Writer, java.lang.Object).
abstract  void registerSaver(Object inst, Saver s)
          register saver; convertor can provide own policy notifing the saver about changes of setting object.
abstract  void unregisterSaver(Object inst, Saver s)
          unregister saver
abstract  void write(Writer w, Object inst)
          Subclasses can implement own storing format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Convertor

public Convertor()
Method Detail

write

public abstract void write(Writer w,
                           Object inst)
                    throws IOException
Subclasses can implement own storing format.

Parameters:
w - stream into which inst is written
inst - the setting object to be written
Throws:
IOException - if the object cannot be written

read

public abstract Object read(Reader r)
                     throws IOException,
                            ClassNotFoundException
Subclasses have to be able to read format implemented by write(java.io.Writer, java.lang.Object).

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

registerSaver

public abstract void registerSaver(Object inst,
                                   Saver s)
register saver; convertor can provide own policy notifing the saver about changes of setting object. (e.g. register property change listener)

Parameters:
inst - setting object
s - saver implementation

unregisterSaver

public abstract void unregisterSaver(Object inst,
                                     Saver s)
unregister saver

Parameters:
inst - setting object
s - saver implementation
See Also:
registerSaver(java.lang.Object, org.netbeans.spi.settings.Saver)

findContext

protected static Lookup findContext(Reader r)
get a context associated with the reader r. It can contain various info like a file location of the read object etc.

Parameters:
r - stream containing stored object
Returns:
a context associated with the reader
Since:
1.2

findContext

protected static Lookup findContext(Writer w)
get a context associated with the writer w. It can contain various info like a file location of the written object etc.

Parameters:
w - stream into which inst is written
Returns:
a context associated with the reader
Since:
1.2

 

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