|
org.netbeans.modules.convertor/1 1.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.convertor.Convertors
public final class Convertors
Main API class with methods allowing conversion of object to namespace aware XML fragment and recreation of object from that fragment. Apart from methods doing the conversions there is couple of other helper methods, for example for listing all currently supported conversions that is listing of available convertor descriptors; listening on changes of available convertors; methods for testing convertibility of the XML fragment or object, etc.
Field Summary | |
---|---|
static String |
CONVERTOR_DESCRIPTORS
Property name of the list of convertor descriptors |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds listener on changes of this object. |
static boolean |
canRead(Element element)
Is there a convertor for the given XML element? |
static boolean |
canRead(String namespace,
String element)
Is there a convertor for the given XML namespace and element name? |
static boolean |
canWrite(Object o)
Is there a convertor for the given object? |
Set |
getConvertorDescriptors()
Gets set of all available convertors. |
static Convertors |
getDefault()
Get default instance of Convertors class. |
static Object |
read(Element element)
Creates instance from the given XML namespace aware fragment. |
static Object |
read(InputStream is)
Creates instance from the given input stream. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes listener on changes of this object. |
static Element |
write(Document doc,
Object o)
Converts the object to XML namespace aware fragment. |
static void |
write(OutputStream os,
Object o)
Converts the object to XML document and writes it into given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CONVERTOR_DESCRIPTORS
Method Detail |
---|
public static Convertors getDefault()
public static boolean canRead(Element element)
element
- XML element to convertor; cannot be null
public static boolean canRead(String namespace, String element)
namespace
- XML namespace; cannot be nullelement
- element name; cannot be null
public static boolean canWrite(Object o)
o
- an object; cannot be null
public static Object read(Element element)
canRead(org.w3c.dom.Element)
for how to test whether the element
is convertible or not.
element
- XML namespace aware element which will be converted to
an object; cannot be null
ConvertorException
- thrown when there is no convertor for the
passed element or when there was a runtime error during conversion.
Client should call canRead(org.w3c.dom.Element)
to prevent this exception.public static Object read(InputStream is) throws SAXException, IOException
read(Element)
.
is
- input stream containing XML namespace aware document
SAXException
- thrown when input stream does not contain valid XML document
IOException
- thrown when XML document cannot be read from input
stream or when convertor does not exist for root element of XML document.
ConvertorException
- thrown when there was a runtime error
during conversion.public static Element write(Document doc, Object o)
doc
- document to which the returned element should belongo
- object to convert
ConvertorException
- thrown when there is no convertor for the
passed object or when there was a runtime error during conversion.
Client should call canWrite(java.lang.Object)
to prevent this exception.public static void write(OutputStream os, Object o) throws IOException
os
- output stream to which the XML document will be writteno
- object to convert
ConvertorException
- thrown when there is no convertor for the
passed object or when there was a runtime error during conversion.
Client should call canWrite(java.lang.Object)
to prevent this exception.
IOException
- thrown when XML document cannot be written to output streampublic Set getConvertorDescriptors()
ConvertorDescriptor
instances. Method always
returns new instance of set.public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- property change listenerpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- property change listener
|
org.netbeans.modules.convertor/1 1.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |