public class XmlSerializerSession extends WriterSerializerSession
XmlSerializer.
This class is NOT thread safe. It is typically discarded after one-time use although it can be reused within the same thread.
| Modifier and Type | Class and Description |
|---|---|
static class |
XmlSerializerSession.ContentResult
Identifies what the contents were of a serialized bean.
|
indent| Modifier | Constructor and Description |
|---|---|
protected |
XmlSerializerSession(XmlSerializer ctx,
SerializerSessionArgs args)
Create a new session using properties specified in the context.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doSerialize(SerializerPipe out,
Object o)
Serializes a POJO to the specified output stream or writer.
|
protected void |
findNsfMappings(Object o)
Recursively searches for the XML namespaces on the specified POJO and adds them to the serializer context object.
|
protected Namespace |
getDefaultNamespace()
Configuration property: Default namespace.
|
protected Namespace[] |
getNamespaces()
Configuration property: Default namespaces.
|
XmlWriter |
getXmlWriter(SerializerPipe out)
Converts the specified output target object to an
XmlWriter. |
protected Namespace |
getXsNamespace()
Configuration property: XMLSchema namespace.
|
protected boolean |
isAddBeanTypes()
Configuration property: Add
|
protected boolean |
isAddNamespaceUrisToRoot()
Configuration property: Add namespace URLs to the root element.
|
protected boolean |
isAutoDetectNamespaces()
Configuration property: Auto-detect namespace usage.
|
protected boolean |
isEnableNamespaces()
Configuration property: Enable support for XML namespaces.
|
protected boolean |
isHtmlMode()
Returns
|
protected XmlSerializerSession.ContentResult |
serializeAnything(XmlWriter out,
Object o,
ClassMeta<?> eType,
String elementName,
Namespace elementNamespace,
boolean addNamespaceUris,
XmlFormat format,
boolean isMixed,
boolean preserveWhitespace,
BeanPropertyMeta pMeta)
Workhorse method.
|
ObjectMap |
toMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
createPipe, getMaxIndent, getQuoteChar, isUseWhitespace, isWriterSerializer, serialize, serializeToStringcanIgnoreValue, createBeanTypeNameProperty, createDefaultVarResolverSession, generalize, getBeanTypeName, getExpectedRootType, getJavaMethod, getListener, getListener, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, getUriResolver, getVarResolver, isAddRootType, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimNullProperties, isTrimStrings, onBeanGetterException, onError, push2, relativizeUri, resolve, resolveUri, serialize, sort, sort, swap, toList, toString, trim, varSessionObjectgetInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, pop, push, setCurrentClass, setCurrentProperty, willRecurse_class, checkForWarnings, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getBpi, getBpro, getBpwo, getBpx, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getExamples, getImplClasses, getLocale, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPojoSwaps, getPropertyNamer, getSchema, getStringBuilder, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isDebug, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, object, returnStringBuilder, string, toArray, toBeanMap, toBeanMapaddToCache, addToCache, addWarning, getClassProperty, getFromCache, getInstanceArrayProperty, getInstanceProperty, getLogger, getProperties, getProperty, getProperty, getProperty, getPropertyKeys, getWarnings, hasProperty, hasWarnings, toStringprotected XmlSerializerSession(XmlSerializer ctx, SerializerSessionArgs args)
ctx - The context creating this session object.
The context contains all the configuration settings for this object.args - Runtime arguments.
These specify session-level information such as locale and URI context.
It also include session-level properties that override the properties defined on the bean and
serializer contexts.protected boolean isHtmlMode()
The difference in behavior is how empty non-void elements are handled. The XML serializer will produce a collapsed tag, whereas the HTML serializer will produce a start and end tag.
public final XmlWriter getXmlWriter(SerializerPipe out) throws IOException
XmlWriter.out - The output target object.XmlWriter.IOException - Thrown by underlying stream.protected void doSerialize(SerializerPipe out, Object o) throws IOException, SerializeException
SerializerSessionThis method should NOT close the context object.
doSerialize in class SerializerSessionout - Where to send the output from the serializer.o - The object to serialize.IOException - Thrown by underlying stream.SerializeException - Problem occurred trying to serialize object.protected final void findNsfMappings(Object o) throws SerializeException
o - The POJO to check.SerializeException - Thrown if bean recursion occurred.protected XmlSerializerSession.ContentResult serializeAnything(XmlWriter out, Object o, ClassMeta<?> eType, String elementName, Namespace elementNamespace, boolean addNamespaceUris, XmlFormat format, boolean isMixed, boolean preserveWhitespace, BeanPropertyMeta pMeta) throws IOException, SerializeException
out - The writer to send the output to.o - The object to serialize.eType - The expected type if this is a bean property value being serialized.elementName - The root element name.elementNamespace - The namespace of the element.addNamespaceUris - Flag indicating that namespace URIs need to be added.format - The format to serialize the output to.isMixed - We're serializing mixed content, so don't use whitespace.preserveWhitespace - XmlFormat.MIXED_PWS or XmlFormat.TEXT_PWS.pMeta - The bean property metadata if this is a bean property being serialized.IOException - Thrown by underlying stream.SerializeException - General serialization error occurred.protected boolean isAddBeanTypes()
isAddBeanTypes in class SerializerSessionXmlSerializer.XML_addBeanTypesprotected final boolean isAddNamespaceUrisToRoot()
xmlns:x attributes are added to the root element for the default and all mapped namespaces.XmlSerializer.XML_addNamespaceUrisToRootprotected final boolean isAutoDetectNamespaces()
XmlSerializer.XML_autoDetectNamespacesprotected final Namespace getDefaultNamespace()
XmlSerializer.XML_defaultNamespaceprotected final boolean isEnableNamespaces()
XmlSerializer.XML_enableNamespacesprotected final Namespace[] getNamespaces()
XmlSerializer.XML_namespacesprotected final Namespace getXsNamespace()
XmlSchemaSerializer class.XmlSerializer.XML_xsNamespacepublic ObjectMap toMap()
SessiontoMap in class WriterSerializerSessionCopyright © 2016–2019 The Apache Software Foundation. All rights reserved.