You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/07/09 01:33:38 UTC

[juneau] branch master updated: Server API cleanup.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 9638af8  Server API cleanup.
9638af8 is described below

commit 9638af8477f269f3f74cf13f2922ace964ec79f6
Author: JamesBognar <ja...@apache.org>
AuthorDate: Sun Jul 8 21:33:24 2018 -0400

    Server API cleanup.
---
 .../java/org/apache/juneau/uon/UonSerializer.java  |  43 ++++++-
 .../apache/juneau/uon/UonSerializerSession.java    |  65 ++++++----
 .../juneau/urlencoding/UrlEncodingSerializer.java  |  18 ++-
 .../urlencoding/UrlEncodingSerializerSession.java  |  27 ++++-
 .../java/org/apache/juneau/xml/XmlSerializer.java  |  95 +++++++++++++--
 .../apache/juneau/xml/XmlSerializerSession.java    | 132 +++++++++++----------
 6 files changed, 278 insertions(+), 102 deletions(-)

diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java
index d7ffe7f..f64b254 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java
@@ -303,11 +303,11 @@ public class UonSerializer extends WriterSerializer {
 	// Instance
 	//-------------------------------------------------------------------------------------------------------------------
 
-	final boolean
+	private final boolean
 		encodeChars,
 		addBeanTypes;
 
-	final ParamFormat
+	private final ParamFormat
 		paramFormat;
 
 	/**
@@ -385,6 +385,45 @@ public class UonSerializer extends WriterSerializer {
 		return new UonSerializerSession(this, null, args);
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Encode non-valid URI characters.
+	 *
+	 * @see #UON_encoding
+	 * @return
+	 * 	<jk>true</jk> if non-valid URI characters should be encoded with <js>"%xx"</js> constructs.
+	 */
+	protected final boolean isEncodeChars() {
+		return encodeChars;
+	}
+
+	/**
+	 * Configuration property:  Add <js>"_type"</js> properties when needed.
+	 *
+	 * @see #UON_addBeanTypes
+	 * @return
+	 * 	<jk>true</jk> if <js>"_type"</js> properties will be added to beans if their type cannot be inferred
+	 * 	through reflection.
+	 */
+	@Override
+	protected final boolean isAddBeanTypes() {
+		return addBeanTypes;
+	}
+
+	/**
+	 * Configuration property:  Format to use for query/form-data/header values.
+	 *
+	 * @see #UON_paramFormat
+	 * @return
+	 * 	Specifies the format to use for URL GET parameter keys and values.
+	 */
+	protected final ParamFormat getParamFormat() {
+		return paramFormat;
+	}
+
 	@Override /* Context */
 	public ObjectMap asMap() {
 		return super.asMap()
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
index 30c191a..1674a70 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
@@ -30,10 +30,8 @@ import org.apache.juneau.transform.*;
  */
 public class UonSerializerSession extends WriterSerializerSession {
 
-	private final boolean
-		encodeChars,
-		addBeanTypes,
-		plainTextParams;
+	private final UonSerializer ctx;
+	private final boolean plainTextParams;
 
 	/**
 	 * @param ctx
@@ -48,32 +46,18 @@ public class UonSerializerSession extends WriterSerializerSession {
 	 */
 	public UonSerializerSession(UonSerializer ctx, Boolean encode, SerializerSessionArgs args) {
 		super(ctx, args);
-		encodeChars = encode == null ? getProperty(UON_encoding, boolean.class, ctx.encodeChars) : encode;
-		addBeanTypes = getProperty(UON_addBeanTypes, boolean.class, ctx.addBeanTypes);
-		plainTextParams = getProperty(UON_paramFormat, ParamFormat.class, ctx.paramFormat) == ParamFormat.PLAINTEXT;
+		this.ctx = ctx;
+		plainTextParams = getProperty(UON_paramFormat, ParamFormat.class, ctx.getParamFormat()) == ParamFormat.PLAINTEXT;
 	}
 
 	@Override /* Session */
 	public ObjectMap asMap() {
 		return super.asMap()
 			.append("UonSerializerSession", new ObjectMap()
-				.append("addBeanTypes", addBeanTypes)
-				.append("encodeChars", encodeChars)
-				.append("plainTextParams", plainTextParams)
 			);
 	}
 
 	/**
-	 * Returns the {@link UonSerializer#UON_addBeanTypes} setting value for this session.
-	 *
-	 * @return The {@link UonSerializer#UON_addBeanTypes} setting value for this session.
-	 */
-	@Override /* SerializerSession */
-	public final boolean isAddBeanTypes() {
-		return addBeanTypes;
-	}
-
-	/**
 	 * Converts the specified output target object to an {@link UonWriter}.
 	 *
 	 * @param out The output target object.
@@ -84,7 +68,7 @@ public class UonSerializerSession extends WriterSerializerSession {
 		Object output = out.getRawOutput();
 		if (output instanceof UonWriter)
 			return (UonWriter)output;
-		UonWriter w = new UonWriter(this, out.getWriter(), isUseWhitespace(), getMaxIndent(), encodeChars, isTrimStrings(), plainTextParams, getUriResolver());
+		UonWriter w = new UonWriter(this, out.getWriter(), isUseWhitespace(), getMaxIndent(), isEncodeChars(), isTrimStrings(), plainTextParams, getUriResolver());
 		out.setWriter(w);
 		return w;
 	}
@@ -276,4 +260,43 @@ public class UonSerializerSession extends WriterSerializerSession {
 
 		return out;
 	}
+
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Encode non-valid URI characters.
+	 *
+	 * @see #UON_encoding
+	 * @return
+	 * 	<jk>true</jk> if non-valid URI characters should be encoded with <js>"%xx"</js> constructs.
+	 */
+	protected final boolean isEncodeChars() {
+		return ctx.isEncodeChars();
+	}
+
+	/**
+	 * Configuration property:  Add <js>"_type"</js> properties when needed.
+	 *
+	 * @see #UON_addBeanTypes
+	 * @return
+	 * 	<jk>true</jk> if <js>"_type"</js> properties will be added to beans if their type cannot be inferred
+	 * 	through reflection.
+	 */
+	@Override
+	protected final boolean isAddBeanTypes() {
+		return ctx.isAddBeanTypes();
+	}
+
+	/**
+	 * Configuration property:  Format to use for query/form-data/header values.
+	 *
+	 * @see #UON_paramFormat
+	 * @return
+	 * 	Specifies the format to use for URL GET parameter keys and values.
+	 */
+	protected final ParamFormat getParamFormat() {
+		return ctx.getParamFormat();
+	}
 }
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
index 2d8f896..c18bcb7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
@@ -246,7 +246,7 @@ public class UrlEncodingSerializer extends UonSerializer {
 	// Instance
 	//-------------------------------------------------------------------------------------------------------------------
 
-	final boolean
+	private final boolean
 		expandedParams;
 
 	/**
@@ -328,6 +328,22 @@ public class UrlEncodingSerializer extends UonSerializer {
 		return new UrlEncodingSerializerSession(this, null, args);
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Serialize bean property collections/arrays as separate key/value pairs.
+	 *
+	 * @see #URLENC_expandedParams
+	 * @return
+	 * 	<jk>false</jk> if serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>.
+	 * 	<br><jk>true</jk> if serializing the same array results in <code>?key=1&amp;key=2&amp;key=3</code>.
+	 */
+	protected final boolean isExpandedParams() {
+		return expandedParams;
+	}
+
 	@Override /* Context */
 	public ObjectMap asMap() {
 		return super.asMap()
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
index 98e8427..1578b6a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
@@ -34,7 +34,7 @@ import org.apache.juneau.uon.*;
 @SuppressWarnings({ "rawtypes", "unchecked" })
 public class UrlEncodingSerializerSession extends UonSerializerSession {
 
-	private final boolean expandedParams;
+	private final UrlEncodingSerializer ctx;
 
 	/**
 	 * Constructor.
@@ -51,14 +51,13 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
 	 */
 	protected UrlEncodingSerializerSession(UrlEncodingSerializer ctx, Boolean encode, SerializerSessionArgs args) {
 		super(ctx, encode, args);
-		expandedParams = getProperty(URLENC_expandedParams, boolean.class, ctx.expandedParams);
+		this.ctx = ctx;
 	}
 
 	@Override /* Session */
 	public ObjectMap asMap() {
 		return super.asMap()
 			.append("UrlEncodingSerializerSession", new ObjectMap()
-				.append("expandedParams", expandedParams)
 			);
 	}
 
@@ -68,7 +67,7 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
 	private boolean shouldUseExpandedParams(BeanPropertyMeta pMeta) {
 		ClassMeta<?> cm = pMeta.getClassMeta().getSerializedClassMeta(this);
 		if (cm.isCollectionOrArray()) {
-			if (expandedParams)
+			if (isExpandedParams())
 				return true;
 			if (pMeta.getBeanMeta().getClassMeta().getExtendedMeta(UrlEncodingClassMeta.class).isExpandedParams())
 				return true;
@@ -80,11 +79,11 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
 	 * Returns <jk>true</jk> if the specified value should be represented as an expanded parameter list.
 	 */
 	private boolean shouldUseExpandedParams(Object value) {
-		if (value == null || ! expandedParams)
+		if (value == null || ! isExpandedParams())
 			return false;
 		ClassMeta<?> cm = getClassMetaForObject(value).getSerializedClassMeta(this);
 		if (cm.isCollectionOrArray()) {
-			if (expandedParams)
+			if (isExpandedParams())
 				return true;
 		}
 		return false;
@@ -265,4 +264,20 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
 		}
 		return out;
 	}
+
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Serialize bean property collections/arrays as separate key/value pairs.
+	 *
+	 * @see #URLENC_expandedParams
+	 * @return
+	 * 	<jk>false</jk> if serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>.
+	 * 	<br><jk>true</jk> if serializing the same array results in <code>?key=1&amp;key=2&amp;key=3</code>.
+	 */
+	protected final boolean isExpandedParams() {
+		return ctx.isExpandedParams();
+	}
 }
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
index 392f2a3..975fa9a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
@@ -450,18 +450,15 @@ public class XmlSerializer extends WriterSerializer {
 	// Instance
 	//-------------------------------------------------------------------------------------------------------------------
 
-	final boolean
+	private final boolean
 		autoDetectNamespaces,
 		enableNamespaces,
 		addNamespaceUrlsToRoot,
 		addBeanTypes;
-
-	final Namespace defaultNamespace;
-
-	final Namespace
+	private final Namespace defaultNamespace;
+	private final Namespace
 		xsNamespace;
-
-	final Namespace[] namespaces;
+	private final Namespace[] namespaces;
 
 	private volatile XmlSchemaSerializer schemaSerializer;
 
@@ -549,6 +546,90 @@ public class XmlSerializer extends WriterSerializer {
 		return new XmlSerializerSession(this, args);
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
+	/**
+	 * Configuration property:  Auto-detect namespace usage.
+	 *
+	 * @see #XML_autoDetectNamespaces
+	 * @return
+	 * 	<jk>true</jk> if namespace usage is detected before serialization.
+	 */
+	protected final boolean isAutoDetectNamespaces() {
+		return autoDetectNamespaces;
+	}
+
+	/**
+	 * Configuration property:  Enable support for XML namespaces.
+	 *
+	 * @see #XML_enableNamespaces
+	 * @return
+	 * 	<jk>false</jk> if XML output will not contain any namespaces regardless of any other settings.
+	 */
+	protected final boolean isEnableNamespaces() {
+		return enableNamespaces;
+	}
+
+	/**
+	 * Configuration property:  Add namespace URLs to the root element.
+	 *
+	 * @see #XML_addNamespaceUrisToRoot
+	 * @return
+	 * 	<jk>true</jk> if {@code xmlns:x} attributes are added to the root element for the default and all mapped namespaces.
+	 */
+	protected final boolean isAddNamespaceUrlsToRoot() {
+		return addNamespaceUrlsToRoot;
+	}
+
+	/**
+	 * Configuration property:  Add <js>"_type"</js> properties when needed.
+	 *
+	 * @see #XML_addBeanTypes
+	 * @return
+	 * 	<jk>true</jk> if<js>"_type"</js> properties will be added to beans if their type cannot be inferred
+	 * 	through reflection.
+	 */
+	@Override
+	protected final boolean isAddBeanTypes() {
+		return addBeanTypes;
+	}
+
+	/**
+	 * Configuration property:  Default namespace.
+	 *
+	 * @see #XML_defaultNamespace
+	 * @return
+	 * 	The default namespace URI for this document.
+	 */
+	protected final Namespace getDefaultNamespace() {
+		return defaultNamespace;
+	}
+
+	/**
+	 * Configuration property:  XMLSchema namespace.
+	 *
+	 * @see #XML_xsNamespace
+	 * @return
+	 * 	The namespace for the <code>XMLSchema</code> namespace, used by the schema generated by the
+	 * 	{@link XmlSchemaSerializer} class.
+	 */
+	protected final Namespace getXsNamespace() {
+		return xsNamespace;
+	}
+
+	/**
+	 * Configuration property:  Default namespaces.
+	 *
+	 * @see #XML_namespaces
+	 * @return
+	 * 	The default list of namespaces associated with this serializer.
+	 */
+	protected final Namespace[] getNamespaces() {
+		return namespaces;
+	}
+
 	@Override /* Context */
 	public ObjectMap asMap() {
 		return super.asMap()
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
index ea105eb..7d6f8af 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
@@ -26,6 +26,7 @@ import org.apache.juneau.internal.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.transform.*;
 import org.apache.juneau.xml.annotation.*;
+import org.apache.juneau.xmlschema.*;
 
 /**
  * Session object that lives for the duration of a single use of {@link XmlSerializer}.
@@ -37,17 +38,9 @@ import org.apache.juneau.xml.annotation.*;
 @SuppressWarnings({"unchecked","rawtypes"})
 public class XmlSerializerSession extends WriterSerializerSession {
 
-	private final boolean
-		autoDetectNamespaces,
-		enableNamespaces,
-		addNamespaceUrlsToRoot,
-		addBeanTypes;
-
+	private final XmlSerializer ctx;
 	private Namespace
 		defaultNamespace;
-	private final Namespace
-		xsNamespace;
-
 	private Namespace[] namespaces = new Namespace[0];
 
 	/**
@@ -64,13 +57,9 @@ public class XmlSerializerSession extends WriterSerializerSession {
 	 */
 	protected XmlSerializerSession(XmlSerializer ctx, SerializerSessionArgs args) {
 		super(ctx, args);
-		enableNamespaces = getProperty(XML_enableNamespaces, boolean.class, ctx.enableNamespaces);
-		autoDetectNamespaces = getProperty(XML_autoDetectNamespaces, boolean.class, ctx.autoDetectNamespaces);
-		addNamespaceUrlsToRoot = getProperty(XML_addNamespaceUrisToRoot, boolean.class, ctx.addNamespaceUrlsToRoot);
-		addBeanTypes = getProperty(XML_addBeanTypes, boolean.class, ctx.addBeanTypes);
-		namespaces = getInstanceArrayProperty(XML_namespaces, Namespace.class, ctx.namespaces);
-		defaultNamespace = findDefaultNamespace(getInstanceProperty(XML_defaultNamespace, Namespace.class, ctx.defaultNamespace));
-		xsNamespace = getInstanceProperty(XML_xsNamespace, Namespace.class, ctx.xsNamespace);
+		this.ctx = ctx;
+		namespaces = getInstanceArrayProperty(XML_namespaces, Namespace.class, ctx.getNamespaces());
+		defaultNamespace = findDefaultNamespace(getInstanceProperty(XML_defaultNamespace, Namespace.class, ctx.getDefaultNamespace()));
 	}
 
 	private Namespace findDefaultNamespace(Namespace n) {
@@ -79,12 +68,12 @@ public class XmlSerializerSession extends WriterSerializerSession {
 		if (n.name != null && n.uri != null)
 			return n;
 		if (n.uri == null) {
-			for (Namespace n2 : namespaces)
+			for (Namespace n2 : getNamespaces())
 				if (n2.name.equals(n.name))
 					return n2;
 		}
 		if (n.name == null) {
-			for (Namespace n2 : namespaces)
+			for (Namespace n2 : getNamespaces())
 				if (n2.uri.equals(n.uri))
 					return n2;
 		}
@@ -95,13 +84,6 @@ public class XmlSerializerSession extends WriterSerializerSession {
 	public ObjectMap asMap() {
 		return super.asMap()
 			.append("XmlSerializerSession", new ObjectMap()
-				.append("addBeanTypes", addBeanTypes)
-				.append("addNamespaceUrlsToRoot", addNamespaceUrlsToRoot)
-				.append("autoDetectNamespaces", autoDetectNamespaces)
-				.append("defaultNamespace", defaultNamespace)
-				.append("enableNamespaces", enableNamespaces)
-				.append("namespaces", namespaces)
-				.append("xsNamespace", xsNamespace)
 			);
 	}
 
@@ -125,16 +107,6 @@ public class XmlSerializerSession extends WriterSerializerSession {
 	}
 
 	/**
-	 * Returns the {@link XmlSerializer#XML_addBeanTypes} setting value for this session.
-	 *
-	 * @return The {@link XmlSerializer#XML_addBeanTypes} setting value for this session.
-	 */
-	@Override /* SerializerSession */
-	protected boolean isAddBeanTypes() {
-		return addBeanTypes;
-	}
-
-	/**
 	 * Returns <jk>true</jk> if we're serializing HTML.
 	 *
 	 * <p>
@@ -158,16 +130,16 @@ public class XmlSerializerSession extends WriterSerializerSession {
 		Object output = out.getRawOutput();
 		if (output instanceof XmlWriter)
 			return (XmlWriter)output;
-		XmlWriter w = new XmlWriter(out.getWriter(), isUseWhitespace(), getMaxIndent(), isTrimStrings(), getQuoteChar(), getUriResolver(), enableNamespaces, defaultNamespace);
+		XmlWriter w = new XmlWriter(out.getWriter(), isUseWhitespace(), getMaxIndent(), isTrimStrings(), getQuoteChar(), getUriResolver(), isEnableNamespaces(), defaultNamespace);
 		out.setWriter(w);
 		return w;
 	}
 
 	@Override /* Serializer */
 	protected void doSerialize(SerializerPipe out, Object o) throws Exception {
-		if (enableNamespaces && autoDetectNamespaces)
+		if (isEnableNamespaces() && isAutoDetectNamespaces())
 			findNsfMappings(o);
-		serializeAnything(getXmlWriter(out), o, getExpectedRootType(o), null, null, enableNamespaces && addNamespaceUrlsToRoot, XmlFormat.DEFAULT, false, false, null);
+		serializeAnything(getXmlWriter(out), o, getExpectedRootType(o), null, null, isEnableNamespaces() && isAddNamespaceUrlsToRoot(), XmlFormat.DEFAULT, false, false, null);
 	}
 
 	/**
@@ -380,7 +352,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
 			isExpectedType = true;
 		}
 
-		if (enableNamespaces) {
+		if (isEnableNamespaces()) {
 			if (elementNamespace == null)
 				elementNamespace = cXml(sType).getNamespace();
 			if (elementNamespace == null)
@@ -404,7 +376,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
 		boolean encodeEn = elementName != null;
 		String ns = (elementNamespace == null ? null : elementNamespace.name);
 		String dns = null, elementNs = null;
-		if (enableNamespaces) {
+		if (isEnableNamespaces()) {
 			dns = elementName == null && defaultNamespace != null ? defaultNamespace.name : null;
 			elementNs = elementName == null ? dns : ns;
 			if (elementName == null)
@@ -577,7 +549,7 @@ public class XmlSerializerSession extends WriterSerializerSession {
 						continue;
 
 					XmlBeanPropertyMeta bpXml = bpXml(pMeta);
-					Namespace ns = (enableNamespaces && bpXml.getNamespace() != elementNs ? bpXml.getNamespace() : null);
+					Namespace ns = (isEnableNamespaces() && bpXml.getNamespace() != elementNs ? bpXml.getNamespace() : null);
 
 					if (pMeta.isUri()  ) {
 						out.attrUri(ns, key, value);
@@ -754,57 +726,87 @@ public class XmlSerializerSession extends WriterSerializerSession {
 		CR_ELEMENTS   // Elements...use normal whitespace rules.
 	}
 
+	//-----------------------------------------------------------------------------------------------------------------
+	// Properties
+	//-----------------------------------------------------------------------------------------------------------------
+
 	/**
-	 * Bean property getter:  <property>defaultNamespace</property>.
+	 * Configuration property:  Auto-detect namespace usage.
 	 *
-	 * @return The value of the <property>defaultNamespace</property> property on this bean, or <jk>null</jk> if it is not set.
+	 * @see #XML_autoDetectNamespaces
+	 * @return
+	 * 	<jk>true</jk> if namespace usage is detected before serialization.
 	 */
-	protected Namespace getDefaultNamespace() {
-		return defaultNamespace;
+	protected final boolean isAutoDetectNamespaces() {
+		return ctx.isAutoDetectNamespaces();
 	}
 
 	/**
-	 * Bean property getter:  <property>namespaces</property>.
+	 * Configuration property:  Enable support for XML namespaces.
 	 *
-	 * @return The value of the <property>namespaces</property> property on this bean, or <jk>null</jk> if it is not set.
+	 * @see #XML_enableNamespaces
+	 * @return
+	 * 	<jk>false</jk> if XML output will not contain any namespaces regardless of any other settings.
 	 */
-	protected Namespace[] getNamespaces() {
-		return namespaces;
+	protected final boolean isEnableNamespaces() {
+		return ctx.isEnableNamespaces();
 	}
 
 	/**
-	 * Bean property getter:  <property>autoDetectNamespaces</property>.
+	 * Configuration property:  Add namespace URLs to the root element.
 	 *
-	 * @return The value of the <property>autoDetectNamespaces</property> property on this bean, or <jk>null</jk> if it is not set.
+	 * @see #XML_addNamespaceUrisToRoot
+	 * @return
+	 * 	<jk>true</jk> if {@code xmlns:x} attributes are added to the root element for the default and all mapped namespaces.
 	 */
-	protected boolean isAutoDetectNamespaces() {
-		return autoDetectNamespaces;
+	protected final boolean isAddNamespaceUrlsToRoot() {
+		return ctx.isAddNamespaceUrlsToRoot();
 	}
 
 	/**
-	 * Bean property getter:  <property>enableNamespaces</property>.
+	 * Configuration property:  Add <js>"_type"</js> properties when needed.
 	 *
-	 * @return The value of the <property>enableNamespaces</property> property on this bean, or <jk>null</jk> if it is not set.
+	 * @see #XML_addBeanTypes
+	 * @return
+	 * 	<jk>true</jk> if<js>"_type"</js> properties will be added to beans if their type cannot be inferred
+	 * 	through reflection.
 	 */
-	protected boolean isEnableNamespaces() {
-		return enableNamespaces;
+	@Override
+	protected boolean isAddBeanTypes() {
+		return ctx.isAddBeanTypes();
 	}
 
 	/**
-	 * Bean property getter:  <property>addNamespaceUrlsToRoot</property>.
+	 * Configuration property:  Default namespace.
 	 *
-	 * @return The value of the <property>addNamespaceUrlsToRoot</property> property on this bean, or <jk>null</jk> if it is not set.
+	 * @see #XML_defaultNamespace
+	 * @return
+	 * 	The default namespace URI for this document.
 	 */
-	protected boolean isAddNamespaceUrlsToRoot() {
-		return addNamespaceUrlsToRoot;
+	protected final Namespace getDefaultNamespace() {
+		return defaultNamespace;
 	}
 
 	/**
-	 * Bean property getter:  <property>xsNamespace</property>.
+	 * Configuration property:  XMLSchema namespace.
 	 *
-	 * @return The value of the <property>xsNamespace</property> property on this bean, or <jk>null</jk> if it is not set.
+	 * @see #XML_xsNamespace
+	 * @return
+	 * 	The namespace for the <code>XMLSchema</code> namespace, used by the schema generated by the
+	 * 	{@link XmlSchemaSerializer} class.
 	 */
-	protected Namespace getXsNamespace() {
-		return xsNamespace;
+	protected final Namespace getXsNamespace() {
+		return ctx.getXsNamespace();
+	}
+
+	/**
+	 * Configuration property:  Default namespaces.
+	 *
+	 * @see #XML_namespaces
+	 * @return
+	 * 	The default list of namespaces associated with this serializer.
+	 */
+	protected final Namespace[] getNamespaces() {
+		return namespaces;
 	}
 }