net.sf.jaxme.impl
Class JMMarshallerImpl

java.lang.Object
  extended bynet.sf.jaxme.impl.JMControllerImpl
      extended bynet.sf.jaxme.impl.JMMarshallerImpl
All Implemented Interfaces:
JMMarshaller, Marshaller

public class JMMarshallerImpl
extends JMControllerImpl
implements JMMarshaller

Version:
$Id: JMMarshallerImpl.java,v 1.3 2003/09/03 19:53:59 joe Exp $
Author:
Jochen Wiedmann

Field Summary
static java.lang.String DEFAULT_JAXB_ENCODING
          Default value for Marshaller.JAXB_ENCODING: UTF-8.
static java.lang.String DEFAULT_JAXME_INDENTATION_SEPARATOR
          Default value for JAXME_INDENTATION_SEPARATOR: "\n" (Line Feed)
static java.lang.String DEFAULT_JAXME_INDENTATION_STRING
          Default value for JAXME_INDENTATION_STRING: " " (two blanks)
static java.lang.String JAXME_INDENTATION_SEPARATOR
          Property name for setting the String used as a line separator in the formatted output.
static java.lang.String JAXME_INDENTATION_STRING
          Property name for setting the String used to indent the formatted output by one level: "jaxme.indentation.string".
static java.lang.String JAXME_XML_DECLARATION
          Property name for choosing whether the marshalled output should contain an XML declaration.
static java.lang.String JAXME_XML_WRITER
          Property name for a SAX ContentHandler which is able to marshal a SAX stream into a character stream.
 
Fields inherited from class net.sf.jaxme.impl.JMControllerImpl
eventHandler, JAXME_DATATYPE_CONVERTER, JAXME_PRIVATE
 
Fields inherited from interface javax.xml.bind.Marshaller
JAXB_ENCODING, JAXB_FORMATTED_OUTPUT, JAXB_NO_NAMESPACE_SCHEMA_LOCATION, JAXB_SCHEMA_LOCATION
 
Constructor Summary
JMMarshallerImpl()
           
 
Method Summary
 java.lang.String getEncoding()
          Returns the controllers encoding; to be used in marshalling.
 boolean getIndentation()
          Returns whether XML documents generated by the controller ought to be formatted.
 java.lang.String getIndentationSeparator()
          Returns the string used as a line separator.
 java.lang.String getIndentationString()
          Returns the string used to indent one level.
 Node getNode(java.lang.Object contentTree)
           
 java.lang.Object getProperty(java.lang.String pProperty)
           
 boolean getXmlDeclaration()
          Returns whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.
 java.lang.Class getXMLWriterClass()
          Returns the controllers class implementing XMLWriter.
 void marshal(java.lang.Object pObject, ContentHandler pHandler)
           
 void marshal(java.lang.Object pObject, Node pNode)
           
 void marshal(java.lang.Object pObject, java.io.OutputStream pStream)
           
 void marshal(java.lang.Object pObject, Result pResult)
           
 void marshal(java.lang.Object pObject, java.io.Writer pWriter)
           
 void setEncoding(java.lang.String pEncoding)
          Sets the controllers encoding; to be used in marshalling.
 void setIndentation(boolean pIndentation)
          Sets whether XML documents generated by the controller ought to be formatted.
 void setIndentationSeparator(java.lang.String pStr)
          Sets the string used as a line separator.
 void setIndentationString(java.lang.String pStr)
          Sets the string used to indent one level.
 void setProperty(java.lang.String pProperty, java.lang.Object pValue)
           
 void setXmlDeclaration(boolean pDeclaration)
          Sets whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.
 void setXMLWriterClass(java.lang.Class pClass)
          Sets the controllers class implementing XMLWriter.
 
Methods inherited from class net.sf.jaxme.impl.JMControllerImpl
getDatatypeConverter, getEventHandler, getJAXBContextImpl, setDatatypeConverter, setEventHandler, setJAXBContextImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jaxme.JMMarshaller
getDatatypeConverter, getJAXBContextImpl, setJAXBContextImpl
 
Methods inherited from interface javax.xml.bind.Marshaller
getEventHandler, setEventHandler
 

Field Detail

DEFAULT_JAXB_ENCODING

public static final java.lang.String DEFAULT_JAXB_ENCODING

Default value for Marshaller.JAXB_ENCODING: UTF-8.

See Also:
Constant Field Values

DEFAULT_JAXME_INDENTATION_STRING

public static final java.lang.String DEFAULT_JAXME_INDENTATION_STRING

Default value for JAXME_INDENTATION_STRING: " " (two blanks)

See Also:
Constant Field Values

DEFAULT_JAXME_INDENTATION_SEPARATOR

public static final java.lang.String DEFAULT_JAXME_INDENTATION_SEPARATOR

Default value for JAXME_INDENTATION_SEPARATOR: "\n" (Line Feed)

See Also:
Constant Field Values

JAXME_INDENTATION_STRING

public static final java.lang.String JAXME_INDENTATION_STRING

Property name for setting the String used to indent the formatted output by one level: "jaxme.indentation.string". Defaults to DEFAULT_JAXME_INDENTATION_STRING.

See Also:
setIndentationString(java.lang.String), getIndentationString(), Constant Field Values

JAXME_INDENTATION_SEPARATOR

public static final java.lang.String JAXME_INDENTATION_SEPARATOR

Property name for setting the String used as a line separator in the formatted output. "jaxme.indentation.separator"

See Also:
setIndentationSeparator(java.lang.String), getIndentationSeparator(), Constant Field Values

JAXME_XML_DECLARATION

public static final java.lang.String JAXME_XML_DECLARATION

Property name for choosing whether the marshalled output should contain an XML declaration. The methods marshal(Object, OutputStream) and marshal(Object, Writer) recognize requests for XML declarations.

*

See Also:
setXmlDeclaration(boolean), getXmlDeclaration(), Constant Field Values

JAXME_XML_WRITER

public static final java.lang.String JAXME_XML_WRITER

Property name for a SAX ContentHandler which is able to marshal a SAX stream into a character stream. The property value is an instance of Class implementing XMLWriter.

See Also:
Constant Field Values
Constructor Detail

JMMarshallerImpl

public JMMarshallerImpl()
Method Detail

setEncoding

public void setEncoding(java.lang.String pEncoding)
                 throws PropertyException

Sets the controllers encoding; to be used in marshalling. Defaults to DEFAULT_JAXB_ENCODING.

Parameters:
pEncoding - Suggested encoding or null to restore the default
Throws:
PropertyException

getEncoding

public java.lang.String getEncoding()

Returns the controllers encoding; to be used in marshalling. Defaults to DEFAULT_JAXB_ENCODING.


setXMLWriterClass

public void setXMLWriterClass(java.lang.Class pClass)
                       throws PropertyException

Sets the controllers class implementing XMLWriter. Defaults to XMLWriterImpl.

Parameters:
pClass - A class implementing XMLWriterImpl or null to restore the default.
Throws:
PropertyException

getXMLWriterClass

public java.lang.Class getXMLWriterClass()

Returns the controllers class implementing XMLWriter. Defaults to XMLWriterImpl.


setIndentation

public void setIndentation(boolean pIndentation)

Sets whether XML documents generated by the controller ought to be formatted. Defaults to true.


getIndentation

public boolean getIndentation()

Returns whether XML documents generated by the controller ought to be formatted. Defaults to true.


setXmlDeclaration

public void setXmlDeclaration(boolean pDeclaration)

Sets whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.


getXmlDeclaration

public boolean getXmlDeclaration()

Returns whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.


setIndentationString

public void setIndentationString(java.lang.String pStr)

Sets the string used to indent one level. Defaults to DEFAULT_JAXME_INDENTATION_STRING. Equivalent to setProperty(JAXME_INDENTATION_STRING, pStr).

See Also:
DEFAULT_JAXME_INDENTATION_STRING, setProperty(java.lang.String, java.lang.Object), getProperty(java.lang.String)

getIndentationString

public java.lang.String getIndentationString()

Returns the string used to indent one level. Defaults to DEFAULT_JAXME_INDENTATION_STRING. Equivalent to getProperty(JAXME_INDENTATION_STRING).

See Also:
DEFAULT_JAXME_INDENTATION_STRING, setProperty(java.lang.String, java.lang.Object), getProperty(java.lang.String)

setIndentationSeparator

public void setIndentationSeparator(java.lang.String pStr)

Sets the string used as a line separator. Defaults to DEFAULT_JAXME_INDENTATION_SEPARATOR. Equivalent to setProperty(JAXME_INDENTATION_SEPARATOR, pStr).

See Also:
DEFAULT_JAXME_INDENTATION_SEPARATOR, setProperty(java.lang.String, java.lang.Object), getProperty(java.lang.String)

getIndentationSeparator

public java.lang.String getIndentationSeparator()

Returns the string used as a line separator. Defaults to DEFAULT_JAXME_INDENTATION_SEPARATOR. Equivalent to getProperty(JAXME_INDENTATION_SEPARATOR).

See Also:
DEFAULT_JAXME_INDENTATION_SEPARATOR, setProperty(java.lang.String, java.lang.Object), getProperty(java.lang.String)

setProperty

public void setProperty(java.lang.String pProperty,
                        java.lang.Object pValue)
                 throws PropertyException
Specified by:
setProperty in interface Marshaller
Overrides:
setProperty in class JMControllerImpl
Throws:
PropertyException

getProperty

public java.lang.Object getProperty(java.lang.String pProperty)
                             throws PropertyException
Specified by:
getProperty in interface Marshaller
Overrides:
getProperty in class JMControllerImpl
Throws:
PropertyException

marshal

public void marshal(java.lang.Object pObject,
                    java.io.OutputStream pStream)
             throws JAXBException
Specified by:
marshal in interface Marshaller
Throws:
JAXBException

marshal

public void marshal(java.lang.Object pObject,
                    ContentHandler pHandler)
             throws JAXBException
Specified by:
marshal in interface Marshaller
Throws:
JAXBException

marshal

public void marshal(java.lang.Object pObject,
                    java.io.Writer pWriter)
             throws JAXBException
Specified by:
marshal in interface Marshaller
Throws:
JAXBException

marshal

public void marshal(java.lang.Object pObject,
                    Node pNode)
             throws JAXBException
Specified by:
marshal in interface Marshaller
Throws:
JAXBException

marshal

public void marshal(java.lang.Object pObject,
                    Result pResult)
             throws JAXBException
Specified by:
marshal in interface Marshaller
Throws:
JAXBException

getNode

public Node getNode(java.lang.Object contentTree)
             throws JAXBException
Specified by:
getNode in interface Marshaller
Throws:
JAXBException