Classes | |
class | NilObject |
class | WrapperInfo |
Public Member Functions | |
Marshaller (DocumentHandler handler) | |
Marshaller (ContentHandler handler) throws IOException | |
Marshaller (Writer out) throws IOException | |
Marshaller (Node node) | |
void | addProcessingInstruction (String target, String data) |
void | setDoctype (String publicId, String systemId) |
void | setSupressXMLDeclaration (boolean supressXMLDeclaration) |
void | setMarshalAsDocument (boolean asDocument) |
void | setMapping (Mapping mapping) throws MappingException |
void | setMarshalListener (MarshalListener listener) |
void | setNamespaceMapping (String nsPrefix, String nsURI) |
void | setRootElement (String rootElement) |
String | getRootElement () |
void | setNSPrefixAtRoot (boolean nsPrefixAtRoot) |
boolean | getNSPrefixAtRoot () |
void | setResolver (ClassDescriptorResolver cdr) |
void | setValidation (boolean validate) |
void | setMarshalExtendedType (boolean marshalExtendedType) |
boolean | getMarshalExtendedType () |
void | marshal (Object object) throws MarshalException, ValidationException |
void | setDebug (boolean debug) |
void | setLogWriter (PrintWriter printWriter) |
void | setEncoding (String encoding) |
void | setNoNamespaceSchemaLocation (String schemaLocation) |
void | setSchemaLocation (String schemaLocation) |
void | setSuppressNamespaces (boolean suppressNamespaces) |
void | setSuppressXSIType (boolean suppressXSIType) |
Static Public Member Functions | |
static void | marshal (Object object, Writer out) throws MarshalException, ValidationException |
static void | marshal (Object object, DocumentHandler handler) throws MarshalException, ValidationException |
static void | marshal (Object object, ContentHandler handler) throws MarshalException, ValidationException, IOException |
static void | marshal (Object object, Node node) throws MarshalException, ValidationException |
Static Public Attributes | |
static boolean | enableDebug = false |
Package Attributes | |
int | depth = 0 |
A Marshaller to allow serializing Java Object's to XML
Note: This class is not thread safe, and not intended to be, so please create a new Marshaller for each thread if it is to be used in a multithreaded environment.
org.exolab.castor.xml.Marshaller.Marshaller | ( | DocumentHandler | handler | ) |
Creates a new Marshaller with the given DocumentHandler.
handler | the DocumentHandler to "marshal" to. |
Referenced by org.exolab.castor.xml.Marshaller.marshal().
org.exolab.castor.xml.Marshaller.Marshaller | ( | ContentHandler | handler | ) | throws IOException |
Creates a new Marshaller with the given SAX ContentHandler.
handler | the ContentHandler to "marshal" to. |
org.exolab.castor.xml.Marshaller.Marshaller | ( | Writer | out | ) | throws IOException |
Creates a new Marshaller with the given writer.
out | the Writer to serialize to |
References org.exolab.castor.util.Configuration.getSerializer().
org.exolab.castor.xml.Marshaller.Marshaller | ( | Node | node | ) |
Creates a new Marshaller for the given DOM Node.
node | the DOM node to marshal into. |
void org.exolab.castor.xml.Marshaller.addProcessingInstruction | ( | String | target, | |
String | data | |||
) |
Adds the given processing instruction data to the set of processing instructions to output during marshalling.
target | the processing instruction target | |
data | the processing instruction data |
References org.exolab.castor.util.List.add().
boolean org.exolab.castor.xml.Marshaller.getMarshalExtendedType | ( | ) |
If True the marshaller will use the 'xsi:type' attribute to marshall a field value that extended the defined field type. Default is True.
boolean org.exolab.castor.xml.Marshaller.getNSPrefixAtRoot | ( | ) |
Returns True if the given namespace mappings will be declared at the root node.
String org.exolab.castor.xml.Marshaller.getRootElement | ( | ) |
Returns the name of the root element to use
static void org.exolab.castor.xml.Marshaller.marshal | ( | Object | object, | |
Writer | out | |||
) | throws MarshalException, ValidationException [static] |
Marshals the given Object as XML using the given writer
obj | the Object to marshal | |
out | the writer to marshal to |
References org.exolab.castor.xml.Marshaller.enableDebug, org.exolab.castor.xml.Marshaller.marshal(), and org.exolab.castor.xml.Marshaller.Marshaller().
Referenced by cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl.addFaultFamily(), cl.utfsm.acs.acg.dao.ACSCategoryDAOImpl.flushCategories(), cl.utfsm.acs.acg.dao.ACSAlarmSystemDAOImpl.flushConfiguration(), cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl.flushReductionRules(), org.exolab.castor.util.ChangeLog2XML.main(), org.exolab.castor.xml.Marshaller.marshal(), alma.acs.entityutil.EntitySerializer.serializeEntityPart(), alma.acs.component.dynwrapper.CastorMarshalMapper.translate(), cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl.updateFaultFamily(), and org.exolab.castor.tools.MappingTool.write().
static void org.exolab.castor.xml.Marshaller.marshal | ( | Object | object, | |
DocumentHandler | handler | |||
) | throws MarshalException, ValidationException [static] |
Marshals the given Object as XML using the given DocumentHandler to send events to.
obj | the Object to marshal | |
handler | the DocumentHandler to marshal to |
References org.exolab.castor.xml.Marshaller.enableDebug, org.exolab.castor.xml.Marshaller.marshal(), and org.exolab.castor.xml.Marshaller.Marshaller().
static void org.exolab.castor.xml.Marshaller.marshal | ( | Object | object, | |
ContentHandler | handler | |||
) | throws MarshalException, ValidationException, IOException [static] |
Marshals the given Object as XML using the given ContentHandler to send events to.
obj | the Object to marshal | |
handler | the ContentHandler to marshal to |
References org.exolab.castor.xml.Marshaller.enableDebug, org.exolab.castor.xml.Marshaller.marshal(), and org.exolab.castor.xml.Marshaller.Marshaller().
static void org.exolab.castor.xml.Marshaller.marshal | ( | Object | object, | |
Node | node | |||
) | throws MarshalException, ValidationException [static] |
Marshals the given Object as XML using the given DOM Node to send events to.
obj | the Object to marshal | |
node | the DOM Node to marshal to |
References org.exolab.castor.xml.Marshaller.enableDebug, org.exolab.castor.xml.Marshaller.marshal(), and org.exolab.castor.xml.Marshaller.Marshaller().
void org.exolab.castor.xml.Marshaller.marshal | ( | Object | object | ) | throws MarshalException, ValidationException |
Marshals the given Object as XML using the DocumentHandler for this Marshaller.
obj | the Object to marshal |
References org.exolab.castor.util.List.get(), org.exolab.castor.xml.ProcessingInstruction.getData(), org.exolab.castor.xml.ProcessingInstruction.getTarget(), org.exolab.castor.xml.Marshaller.marshal(), and org.exolab.castor.util.List.size().
void org.exolab.castor.xml.Marshaller.setDebug | ( | boolean | debug | ) |
Sets the flag to turn on and off debugging
debug | the flag indicating whether or not debug information should be generated |
void org.exolab.castor.xml.Marshaller.setDoctype | ( | String | publicId, | |
String | systemId | |||
) |
Sets the document type definition for the serializer. Note that this method cannot be called if you've passed in your own DocumentHandler.
publicId | the public identifier | |
systemId | the system identifier |
References org.exolab.castor.util.Configuration.getOutputFormat().
void org.exolab.castor.xml.Marshaller.setEncoding | ( | String | encoding | ) |
Sets the encoding for the serializer. Note that this method cannot be called if you've passed in your own DocumentHandler.
encoding | the encoding to set |
References org.exolab.castor.util.Configuration.getOutputFormat().
void org.exolab.castor.xml.Marshaller.setLogWriter | ( | PrintWriter | printWriter | ) |
Sets the PrintWriter used for logging
printWriter | the PrintWriter to use for logging |
void org.exolab.castor.xml.Marshaller.setMapping | ( | Mapping | mapping | ) | throws MappingException |
Sets the given mapping to be used by the marshalling Framework. If a ClassDescriptorResolver exists This mapping will be added to the existing Resolver. Otherwise a new ClassDescriptorResolver will be created.
mapping | the mapping to using during marshalling |
References org.exolab.castor.xml.ClassDescriptorResolver.setMappingLoader().
void org.exolab.castor.xml.Marshaller.setMarshalAsDocument | ( | boolean | asDocument | ) |
Sets whether or not to marshal as a document which includes the XML declaration, and if necessary the DOCTYPE declaration. By default the Marshaller will marshal as a well formed XML document including the XML Declaration.
If the given boolean is false, the Marshaller will marshal as a well formed XML fragment (no XML declaration or DOCTYPE).
This method is basically the same as calling setSupressXMLDeclaration(true);
asDocument | a boolean, when true, indicating to marshal as a complete XML document. |
References org.exolab.castor.util.Configuration.getOutputFormat().
Referenced by org.exolab.castor.xml.Marshaller.setSupressXMLDeclaration().
void org.exolab.castor.xml.Marshaller.setMarshalExtendedType | ( | boolean | marshalExtendedType | ) |
If True the marshaller will use the 'xsi:type' attribute to marshall a field value that extended the defined field type. Default is True.
void org.exolab.castor.xml.Marshaller.setMarshalListener | ( | MarshalListener | listener | ) |
Sets an optional MarshalListener to recieve pre and post marshal notification for each Object in the tree. MarshalListener is only for complex objects that map into elements, simpleTypes and types that map into attributes do not cause any pre and post event notifications. Current only one (1) listener is allowed. If you need register multiple listeners, you will have to create your own master listener that will forward the event notifications and manage the multiple listeners.
listener | the MarshalListener to set. |
void org.exolab.castor.xml.Marshaller.setNamespaceMapping | ( | String | nsPrefix, | |
String | nsURI | |||
) |
Sets the mapping for the given Namespace prefix
nsPrefix | the namespace prefix | |
nsURI | the namespace that the prefix resolves to |
References org.exolab.castor.xml.Namespaces.addNamespace().
Referenced by org.exolab.castor.tools.MappingTool.write().
void org.exolab.castor.xml.Marshaller.setNoNamespaceSchemaLocation | ( | String | schemaLocation | ) |
Sets the value for the xsi:noNamespaceSchemaLocation attribute. When set, this attribute will appear on the root element of the marshalled document.
schemaLocation | the URI location of the schema to which the marshalled document is an instance of. |
References org.exolab.castor.xml.util.AttributeSetImpl.setAttribute(), org.exolab.castor.xml.MarshalFramework.XSI_NAMESPACE, and org.exolab.castor.xml.MarshalFramework.XSI_NO_NAMESPACE_SCHEMA_LOCATION.
void org.exolab.castor.xml.Marshaller.setNSPrefixAtRoot | ( | boolean | nsPrefixAtRoot | ) |
Set to True to declare the given namespace mappings at the root node. Default is False.
nsPrefixAtRoot |
void org.exolab.castor.xml.Marshaller.setResolver | ( | ClassDescriptorResolver | cdr | ) |
Sets the ClassDescriptorResolver to use during unmarshalling
cdr | the ClassDescriptorResolver to use |
void org.exolab.castor.xml.Marshaller.setRootElement | ( | String | rootElement | ) |
Sets the name of the root element to use
The | name of the root element to use |
Referenced by org.exolab.castor.util.ChangeLog2XML.main().
void org.exolab.castor.xml.Marshaller.setSchemaLocation | ( | String | schemaLocation | ) |
Sets the value for the xsi:schemaLocation attribute. When set, this attribute will appear on the root element of the marshalled document.
schemaLocation | the URI location of the schema to which the marshalled document is an instance of. |
References org.exolab.castor.xml.util.AttributeSetImpl.setAttribute(), org.exolab.castor.xml.MarshalFramework.XSI_NAMESPACE, and org.exolab.castor.xml.MarshalFramework.XSI_SCHEMA_LOCATION.
void org.exolab.castor.xml.Marshaller.setSuppressNamespaces | ( | boolean | suppressNamespaces | ) |
Sets whether or not namespaces are output. By default the Marshaller will output namespace declarations and prefix elements and attributes with their respective namespace prefix. This method can be used to prevent the usage of namespaces.
suppressNamespaces | a boolean that when true will prevent namespaces from being output. |
void org.exolab.castor.xml.Marshaller.setSuppressXSIType | ( | boolean | suppressXSIType | ) |
Sets whether or not the xsi:type attribute should appear on the marshalled document.
suppressXSIType | a boolean that when true will prevent xsi:type attribute from being used in the marshalling process. |
Referenced by org.exolab.castor.util.ChangeLog2XML.main().
void org.exolab.castor.xml.Marshaller.setSupressXMLDeclaration | ( | boolean | supressXMLDeclaration | ) |
Sets whether or not to marshal as a document which includes the XML declaration, and if necessary the DOCTYPE declaration. By default the Marshaller will marshal as a well formed XML document including the XML Declaration.
If the given boolean is true, the Marshaller will marshal as a well formed XML fragment (no XML declaration or DOCTYPE).
This method is basically the same as calling setMarshalAsDocument(false);
supressXMLDeclaration | a boolean that when true includes that generated XML should not contain the XML declaration. |
References org.exolab.castor.xml.Marshaller.setMarshalAsDocument().
void org.exolab.castor.xml.Marshaller.setValidation | ( | boolean | validate | ) |
Sets whether or not to validate the object model before marshalling. By default validation is enabled. This method is really for debugging. I do not recommend turning off validation, since you could marshal a document, which you can then not unmarshal. If you know the object model is guaranteed to be valid, disabling validation will improve performace.
validate | the boolean indicating whether or not to validate the object model before marshalling. |
Referenced by cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl.addFaultFamily(), cl.utfsm.acs.acg.dao.ACSCategoryDAOImpl.flushCategories(), cl.utfsm.acs.acg.dao.ACSAlarmSystemDAOImpl.flushConfiguration(), cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl.flushReductionRules(), alma.acs.entityutil.EntitySerializer.serializeEntityPart(), alma.acs.component.dynwrapper.CastorMarshalMapper.translate(), and cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl.updateFaultFamily().
int org.exolab.castor.xml.Marshaller.depth = 0 [package] |
The depth of the sub tree, 0 denotes document level
boolean org.exolab.castor.xml.Marshaller.enableDebug = false [static] |
A static flag used to enable debugging when using the static marshal methods.
Referenced by org.exolab.castor.xml.Marshaller.marshal().