open class CastorMarshaller : AbstractMarshaller, InitializingBean, BeanClassLoaderAware
Implementation of the Marshaller interface for Castor. By default, Castor does not require any further configuration, though setting target classes, target packages or providing a mapping file can be used to have more control over the behavior of Castor.
If a target class is specified using setTargetClass, the CastorMarshaller can only be used to unmarshal XML that represents that specific class. If you want to unmarshal multiple classes, you have to provide a mapping file using setMappingLocations.
Due to limitations of Castor's API, it is required to set the encoding used for writing to output streams. It defaults to UTF-8.
Author
Arjen Poutsma
Author
Jakub Narloch
Author
Juergen Hoeller
Since
3.0
See Also
#setEncoding(String)#setTargetClass(Class)#setTargetPackages(String[])#setMappingLocation(Resource)#setMappingLocations(Resource[])
CastorMarshaller()
Implementation of the If a target class is specified using Due to limitations of Castor's API, it is required to set the encoding used for writing to output streams. It defaults to |
static val DEFAULT_ENCODING: String
The default encoding used for stream access: UTF-8. |
open fun afterPropertiesSet(): Unit |
|
open fun setBeanClassLoader(classLoader: ClassLoader): Unit |
|
open fun setCastorProperties(castorProperties: MutableMap<String, String>): Unit
Set Castor-specific properties for marshalling and unmarshalling. Each entry key is considered the property name and each value the property value. |
|
open fun setClassDescriptorResolver(classDescriptorResolver: XMLClassDescriptorResolver): Unit
Set the XMLClassDescriptorResolver to be used during unmarshalling. This resolver will used to resolve class descriptors. |
|
open fun setClearCollections(clearCollections: Boolean): Unit
Sets whether this unmarshaller should clear collections upon the first use. The default is |
|
open fun setDoctypes(doctypes: MutableMap<String, String>): Unit
Set the map containing document type definition for the marshaller. Each entry has system id as key and public id as value. |
|
open fun setEncoding(encoding: String): Unit
Set the encoding to be used for stream access. |
|
open fun setEntityResolver(entityResolver: EntityResolver): Unit
Set the EntityResolver to be used during unmarshalling. This resolver will used to resolve system and public ids. |
|
open fun setIdResolver(idResolver: IDResolver): Unit
Set the Castor IDResolver to be used during unmarshalling. |
|
open fun setIgnoreExtraAttributes(ignoreExtraAttributes: Boolean): Unit
Set whether the Castor Unmarshaller should ignore attributes that do not match a specific field. Default is |
|
open fun setIgnoreExtraElements(ignoreExtraElements: Boolean): Unit
Set whether the Castor Unmarshaller should ignore elements that do not match a specific field. Default is |
|
open fun setMappingLocation(mappingLocation: Resource): Unit
Set the locations of the Castor XML mapping files. |
|
open fun setMappingLocations(vararg mappingLocations: Resource): Unit
Set the locations of the Castor XML mapping files. |
|
open fun setMarshalAsDocument(marshalAsDocument: Boolean): Unit
Set whether this marshaller should output the xml declaration. The default is |
|
open fun setMarshalExtendedType(marshalExtendedType: Boolean): Unit
Set whether this marshaller should output for given type the The default is |
|
open fun setNamespaceMappings(namespaceMappings: MutableMap<String, String>): Unit
Set the namespace mappings. Property names are interpreted as namespace prefixes; values are namespace URIs. |
|
open fun setNamespaceToPackageMapping(namespaceToPackageMapping: MutableMap<String, String>): Unit
Set the namespace to package mappings. Property names are represents the namespaces URI, values are packages. |
|
open fun setNoNamespaceSchemaLocation(noNamespaceSchemaLocation: String): Unit
Set the value of |
|
open fun setObjectFactory(objectFactory: ObjectFactory): Unit
Set the Castor ObjectFactory to be used during unmarshalling. |
|
open fun setProcessingInstructions(processingInstructions: MutableMap<String, String>): Unit
Sets the processing instructions that will be used by during marshalling. Keys are the processing targets and values contain the processing data. |
|
open fun setReuseObjects(reuseObjects: Boolean): Unit
Set whether this unmarshaller should re-use objects. This will be only used when unmarshalling to an existing object. The default is |
|
open fun setRootElement(rootElement: String): Unit
Set the name of the root element. |
|
open fun setRootObject(root: Any): Unit
Set the expected root object for the unmarshaller, into which the source will be unmarshalled. |
|
open fun setSchemaLocation(schemaLocation: String): Unit
Set the value of |
|
open fun setSuppressNamespaces(suppressNamespaces: Boolean): Unit
Sets whether this marshaller should output namespaces. The default is |
|
open fun setSuppressXsiType(suppressXsiType: Boolean): Unit
Set whether this marshaller should output the The default is |
|
open fun setTargetClass(targetClass: Class<*>): Unit
Set the Castor target class. |
|
open fun setTargetClasses(vararg targetClasses: Class<*>): Unit
Set the Castor target classes. |
|
open fun setTargetPackage(targetPackage: String): Unit
Set the name of a package with the Castor descriptor classes. |
|
open fun setTargetPackages(vararg targetPackages: String): Unit
Set the names of packages with the Castor descriptor classes. |
|
open fun setUseXSITypeAtRoot(useXSITypeAtRoot: Boolean): Unit
Sets whether this marshaller should output the The default is |
|
open fun setValidating(validating: Boolean): Unit
Set whether this marshaller should validate in- and outgoing documents. Default is |
|
open fun setWhitespacePreserve(whitespacePreserve: Boolean): Unit
Set whether the Castor Unmarshaller should preserve "ignorable" whitespace. Default is |
|
open fun supports(clazz: Class<*>): Boolean
Returns |
open fun isProcessExternalEntities(): Boolean
Returns the configured value for whether XML external entities are allowed. |
|
open fun isSupportDtd(): Boolean
Whether DTD parsing is supported. |
|
fun marshal(graph: Any, result: Result): Unit
Marshals the object graph with the given root into the provided This implementation inspects the given result, and calls |
|
open fun setProcessExternalEntities(processExternalEntities: Boolean): Unit
Indicates whether external XML entities are processed when unmarshalling. Default is Note: setting this option to |
|
open fun setSupportDtd(supportDtd: Boolean): Unit
Indicates whether DTD parsing should be supported. Default is |
|
fun unmarshal(source: Source): Any
Unmarshals the given provided This implementation inspects the given result, and calls |