public abstract class AbstractMarshaller extends Object implements Marshaller
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractMarshaller.ClassMapping |
class |
AbstractMarshaller.ContentHandlerAdaptor |
protected class |
AbstractMarshaller.FieldToWildcardMapping |
protected static interface |
AbstractMarshaller.Stack |
static class |
AbstractMarshaller.StackImpl |
Marshaller.FACTORY
Modifier and Type | Field and Description |
---|---|
protected Map<Class<?>,QName> |
cls2TypeMap |
protected Content |
content
Content the result is written to
|
protected String |
encoding |
protected Map<Class<?>,AbstractMarshaller.FieldToWildcardMapping> |
field2WildcardMap |
protected org.jboss.logging.Logger |
log |
protected NamespaceRegistry |
nsRegistry |
protected List<QName> |
rootQNames |
protected String |
version |
ENCODING, PROP_MARSHALLER, PROP_OUTPUT_INDENTATION, PROP_OUTPUT_XML_VERSION, VERSION
Constructor and Description |
---|
AbstractMarshaller() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addAttribute(String prefix,
String localName,
String type,
String value) |
void |
addRootElement(QName qName) |
void |
addRootElement(String namespaceUri,
String prefix,
String name) |
void |
declareNamespace(String prefix,
String uri)
Defines a namespace.
|
protected void |
declareNs(AttributesImpl attrs) |
protected static void |
declareNs(AttributesImpl attrs,
String prefix,
String ns) |
protected String |
declareXsiType(QName typeQName,
AttributesImpl attrs)
Adds xsi:type attribute and optionally declares namespaces for xsi and type's namespace.
|
protected AbstractMarshaller.ClassMapping |
getClassMapping(Class<?> cls) |
String |
getPrefix(String ns) |
String |
getProperty(String name) |
void |
mapClassToGlobalElement(Class<?> cls,
String localName,
String namespaceUri,
String schemaUrl,
ObjectModelProvider provider) |
void |
mapClassToGlobalType(Class<?> cls,
String localName,
String nsUri,
String schemaUrl,
ObjectModelProvider provider) |
void |
mapClassToXsiType(Class<?> cls,
String typeNs,
String typeLocalPart) |
void |
mapFieldToWildcard(Class<?> cls,
String field,
ObjectLocalMarshaller marshaller) |
void |
mapPublicIdToSystemId(String publicId,
String systemId) |
protected static String |
prefixLocalName(String prefix,
String local) |
protected boolean |
propertyIsTrueOrNotSet(String name) |
void |
removePrefixMapping(String prefix) |
void |
setEncoding(String encoding) |
void |
setProperty(String name,
String value) |
void |
setVersion(String version) |
protected void |
writeXmlVersion(Writer writer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
marshal, marshal
protected final org.jboss.logging.Logger log
protected String version
protected String encoding
protected NamespaceRegistry nsRegistry
protected Map<Class<?>,AbstractMarshaller.FieldToWildcardMapping> field2WildcardMap
protected Content content
public void mapClassToGlobalElement(Class<?> cls, String localName, String namespaceUri, String schemaUrl, ObjectModelProvider provider)
mapClassToGlobalElement
in interface Marshaller
public void mapClassToGlobalType(Class<?> cls, String localName, String nsUri, String schemaUrl, ObjectModelProvider provider)
mapClassToGlobalType
in interface Marshaller
public void mapFieldToWildcard(Class<?> cls, String field, ObjectLocalMarshaller marshaller)
public void setVersion(String version)
setVersion
in interface Marshaller
public void setEncoding(String encoding)
setEncoding
in interface Marshaller
public void mapPublicIdToSystemId(String publicId, String systemId)
mapPublicIdToSystemId
in interface Marshaller
public void addRootElement(String namespaceUri, String prefix, String name)
addRootElement
in interface Marshaller
public void addRootElement(QName qName)
public void setProperty(String name, String value)
setProperty
in interface Marshaller
public String getProperty(String name)
getProperty
in interface Marshaller
public void declareNamespace(String prefix, String uri)
If prefix
argument is null
or is an empty string then
the passed in URI will be used for the default namespace, i.e. xmlns
.
Otherwise, the declaration will follow the format xmlns:prefix=uri
.
If the namespace with the given prefix was already declared, its value is overwritten.
prefix
- the prefix for the namespace to declare (can be null or empty string)uri
- the URI of the namespace.public void removePrefixMapping(String prefix)
protected void declareNs(AttributesImpl attrs)
protected static void declareNs(AttributesImpl attrs, String prefix, String ns)
protected String declareXsiType(QName typeQName, AttributesImpl attrs)
typeQName
- the type to declare xsi:type attribute forattrs
- the attributes to add xsi:type attribute topublic abstract void addAttribute(String prefix, String localName, String type, String value)
protected boolean propertyIsTrueOrNotSet(String name)
protected void writeXmlVersion(Writer writer) throws IOException
IOException
protected AbstractMarshaller.ClassMapping getClassMapping(Class<?> cls)
Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.