javolution.xml
Class XMLFormat.OutputElement

Object
  extended by XMLFormat.OutputElement
Enclosing class:
XMLFormat<T>

public static final class XMLFormat.OutputElement
extends Object

This class represents an output XML element (marshalling).


Method Summary
 void add(Object obj)
          Adds the specified object or null as an anonymous nested element of unknown type.
 void add(Object obj, String name)
          Adds the specified object as a named nested element of unknown type (null objects are ignored).
 void add(Object obj, String localName, String uri)
          Adds the specified object as a fully qualified nested element of unknown type (null objects are ignored).
<T> void
add(T obj, String name, Class<T> cls)
          Adds the specified object as a named nested element of specified actual type (null objects are ignored).
<T> void
add(T obj, String localName, String uri, Class<T> cls)
          Adds the specified object as a fully qualified nested element of specified actual type (null objects are ignored).
 void addText(CharSequence text)
          Adds the content of a text-only element (equivalent to getStreamWriter().writeCharacters(text)).
 void addText(String text)
          Equivalent to addText(CharSequence) (for J2ME compatibility).
 XMLStreamWriter getStreamWriter()
          Returns the StAX-like stream writer (provides complete control over the marshalling process).
 void setAttribute(String name, boolean value)
          Sets the specified boolean attribute.
 void setAttribute(String name, byte value)
          Sets the specified byte attribute.
 void setAttribute(String name, char value)
          Sets the specified char attribute.
 void setAttribute(String name, CharSequence value)
          Sets the specified CharSequence attribute (null values are ignored).
 void setAttribute(String name, double value)
          Sets the specified double attribute.
 void setAttribute(String name, float value)
          Sets the specified float attribute.
 void setAttribute(String name, int value)
          Sets the specified int attribute.
 void setAttribute(String name, long value)
          Sets the specified long attribute.
 void setAttribute(String name, Object value)
          Sets the specified attribute using its associated TextFormat.
 void setAttribute(String name, short value)
          Sets the specified short attribute.
 void setAttribute(String name, String value)
          Sets the specified String attribute (null values are ignored).
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStreamWriter

public XMLStreamWriter getStreamWriter()
Returns the StAX-like stream writer (provides complete control over the marshalling process).

Returns:
the stream writer.

add

public void add(Object obj)
         throws XMLStreamException
Adds the specified object or null as an anonymous nested element of unknown type.

Parameters:
obj - the object added as nested element or null.
Throws:
XMLStreamException

add

public void add(Object obj,
                String name)
         throws XMLStreamException
Adds the specified object as a named nested element of unknown type (null objects are ignored). The nested XML element contains a class attribute identifying the object type.

Parameters:
obj - the object added as nested element or null.
name - the name of the nested element.
Throws:
XMLStreamException

add

public void add(Object obj,
                String localName,
                String uri)
         throws XMLStreamException
Adds the specified object as a fully qualified nested element of unknown type (null objects are ignored). The nested XML element contains a class attribute identifying the object type.

Parameters:
obj - the object added as nested element or null.
localName - the local name of the nested element.
uri - the namespace URI of the nested element.
Throws:
XMLStreamException

add

public <T> void add(T obj,
                    String name,
                    Class<T> cls)
         throws XMLStreamException
Adds the specified object as a named nested element of specified actual type (null objects are ignored). The nested XML element does not contain any class attribute.

Parameters:
obj - the object added as nested element or null.
name - the name of the nested element.
cls - the class identifying the format of the specified object.
Throws:
XMLStreamException

add

public <T> void add(T obj,
                    String localName,
                    String uri,
                    Class<T> cls)
         throws XMLStreamException
Adds the specified object as a fully qualified nested element of specified actual type (null objects are ignored). The nested XML element does not contain any class attribute.

Parameters:
obj - the object added as nested element or null.
localName - the local name of the nested element.
uri - the namespace URI of the nested element.
cls - the class identifying the format of the specified object.
Throws:
XMLStreamException

addText

public void addText(CharSequence text)
             throws XMLStreamException
Adds the content of a text-only element (equivalent to getStreamWriter().writeCharacters(text)).

Parameters:
text - the element text content or an empty sequence if none.
Throws:
XMLStreamException

addText

public void addText(String text)
             throws XMLStreamException
Equivalent to addText(CharSequence) (for J2ME compatibility).

Parameters:
text - the element text content or an empty sequence if none.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         CharSequence value)
                  throws XMLStreamException
Sets the specified CharSequence attribute (null values are ignored).

Parameters:
name - the attribute name.
value - the attribute value or null.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         String value)
                  throws XMLStreamException
Sets the specified String attribute (null values are ignored).

Parameters:
name - the attribute name.
value - the attribute value.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         boolean value)
                  throws XMLStreamException
Sets the specified boolean attribute.

Parameters:
name - the attribute name.
value - the boolean value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         char value)
                  throws XMLStreamException
Sets the specified char attribute.

Parameters:
name - the attribute name.
value - the char value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         byte value)
                  throws XMLStreamException
Sets the specified byte attribute.

Parameters:
name - the attribute name.
value - the byte value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         short value)
                  throws XMLStreamException
Sets the specified short attribute.

Parameters:
name - the attribute name.
value - the short value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         int value)
                  throws XMLStreamException
Sets the specified int attribute.

Parameters:
name - the attribute name.
value - the int value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         long value)
                  throws XMLStreamException
Sets the specified long attribute.

Parameters:
name - the attribute name.
value - the long value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         float value)
                  throws XMLStreamException
Sets the specified float attribute.

Parameters:
name - the attribute name.
value - the float value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         double value)
                  throws XMLStreamException
Sets the specified double attribute.

Parameters:
name - the attribute name.
value - the double value for the specified attribute.
Throws:
XMLStreamException

setAttribute

public void setAttribute(String name,
                         Object value)
                  throws XMLStreamException
Sets the specified attribute using its associated TextFormat.

Parameters:
name - the name of the attribute.
value - the Boolean value for the specified attribute or null in which case the attribute is not set.
Throws:
XMLStreamException


Copyright © 2005-2012 Javolution. All Rights Reserved.