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 2017/10/20 01:49:48 UTC
[3/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
index 5a1ff58..305847f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
@@ -14,7 +14,7 @@ package org.apache.juneau.serializer;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
-import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.serializer.Serializer.*;
import java.io.*;
import java.lang.reflect.*;
@@ -84,7 +84,7 @@ public abstract class SerializerSession extends BeanSession {
* @param ctx
* The context creating this session object.
* The context contains all the configuration settings for this object.
- * <br>If <jk>null</jk>, defaults to {@link SerializerContext#DEFAULT}.
+ * Can be <jk>null</jk>.
* @param args
* Runtime arguments.
* These specify session-level information such as locale and URI context.
@@ -286,126 +286,126 @@ public abstract class SerializerSession extends BeanSession {
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_maxDepth} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_maxDepth} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_maxDepth} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_maxDepth} setting value for this session.
*/
protected final int getMaxDepth() {
return maxDepth;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_initialDepth} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_initialDepth} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_initialDepth} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_initialDepth} setting value for this session.
*/
protected final int getInitialDepth() {
return initialDepth;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_detectRecursions} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_detectRecursions} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_detectRecursions} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_detectRecursions} setting value for this session.
*/
protected final boolean isDetectRecursions() {
return detectRecursions;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_ignoreRecursions} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_ignoreRecursions} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_ignoreRecursions} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_ignoreRecursions} setting value for this session.
*/
protected final boolean isIgnoreRecursions() {
return ignoreRecursions;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_useWhitespace} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_useWhitespace} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_useWhitespace} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_useWhitespace} setting value for this session.
*/
protected final boolean isUseWhitespace() {
return useWhitespace;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_maxIndent} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_maxIndent} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_maxIndent} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_maxIndent} setting value for this session.
*/
protected final int getMaxIndent() {
return maxIndent;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_addBeanTypeProperties} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_addBeanTypeProperties} setting value for this session.
*/
protected boolean isAddBeanTypeProperties() {
return addBeanTypeProperties;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_quoteChar} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_quoteChar} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_quoteChar} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_quoteChar} setting value for this session.
*/
protected final char getQuoteChar() {
return quoteChar;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_trimNullProperties} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_trimNullProperties} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_trimNullProperties} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_trimNullProperties} setting value for this session.
*/
protected final boolean isTrimNulls() {
return trimNulls;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_trimEmptyCollections} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_trimEmptyCollections} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_trimEmptyCollections} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_trimEmptyCollections} setting value for this session.
*/
protected final boolean isTrimEmptyCollections() {
return trimEmptyCollections;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_trimEmptyMaps} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_trimEmptyMaps} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_trimEmptyMaps} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_trimEmptyMaps} setting value for this session.
*/
protected final boolean isTrimEmptyMaps() {
return trimEmptyMaps;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_trimStrings} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_trimStrings} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_trimStrings} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_trimStrings} setting value for this session.
*/
protected final boolean isTrimStrings() {
return trimStrings;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_sortCollections} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_sortCollections} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_sortCollections} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_sortCollections} setting value for this session.
*/
protected final boolean isSortCollections() {
return sortCollections;
}
/**
- * Returns the {@link SerializerContext#SERIALIZER_sortMaps} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_sortMaps} setting value for this session.
*
- * @return The {@link SerializerContext#SERIALIZER_sortMaps} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_sortMaps} setting value for this session.
*/
protected final boolean isSortMaps() {
return sortMaps;
@@ -446,7 +446,7 @@ public abstract class SerializerSession extends BeanSession {
}
/**
- * Returns <jk>true</jk> if {@link SerializerContext#SERIALIZER_detectRecursions} is enabled, and the specified
+ * Returns <jk>true</jk> if {@link Serializer#SERIALIZER_detectRecursions} is enabled, and the specified
* object is already higher up in the serialization chain.
*
* @param attrName The bean property attribute name, or some other identifier.
@@ -852,7 +852,7 @@ public abstract class SerializerSession extends BeanSession {
* Returns the parser-side expected type for the object.
*
* <p>
- * The return value depends on the {@link SerializerContext#SERIALIZER_abridged} setting.
+ * The return value depends on the {@link Serializer#SERIALIZER_abridged} setting.
* When enabled, the parser already knows the Java POJO type being parsed, so there is
* no reason to add <js>"_type"</js> attributes to the root-level object.
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
index 8595fe8..3cfef13 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerWriter.java
@@ -161,7 +161,7 @@ public class SerializerWriter extends Writer {
* @return This object (for method chaining).
*/
private SerializerWriter append(int indent, boolean newline, String text) throws IOException {
-
+
// If text contains newlines, we break it up into lines and indent them separately.
if (text.indexOf('\n') != -1 && useWhitespace && indent <= maxIndent) {
for (StringTokenizer st = new StringTokenizer(text, "\n"); st.hasMoreTokens();) {
@@ -186,8 +186,8 @@ public class SerializerWriter extends Writer {
* {@link URI} objects, or any other type that returns a URI via it's <code>toString()</code> method.
*
* <p>
- * The URI is resolved based on the {@link SerializerContext#SERIALIZER_uriRelativity} and
- * {@link SerializerContext#SERIALIZER_uriResolution} settings and the {@link UriContext} that's part of the
+ * The URI is resolved based on the {@link Serializer#SERIALIZER_uriRelativity} and
+ * {@link Serializer#SERIALIZER_uriResolution} settings and the {@link UriContext} that's part of the
* session.
*
* @param uri The URI to serialize.
@@ -278,7 +278,7 @@ public class SerializerWriter extends Writer {
/**
* Writes a space if the boolean expression is <jk>true</jk> and {@code useWhitespace} is false.
- *
+ *
* <p>
* Intended for cases in XML where text should be separated by either a space or newline.
* This ensures the text is separated by a space if whitespace is disabled.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java
index 1c58cb9..6ccd335 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java
@@ -29,17 +29,31 @@ import org.apache.juneau.xml.*;
* <h5 class='section'>Description:</h5>
*
* Essentially the same output as {@link XmlDocSerializer}, except wrapped in a standard SOAP envelope.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link SoapXmlSerializerContext}
- * <li>{@link BeanContext}
- * </ul>
*/
public final class SoapXmlSerializer extends XmlSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "SoapXmlSerializer.";
+
+ /**
+ * <b>Configuration property:</b> The <code>SOAPAction</code> HTTP header value to set on responses.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"SoapXmlSerializer.SOAPAction"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"http://www.w3.org/2003/05/soap-envelope"</js>
+ * </ul>
+ */
+ public static final String SOAPXML_SOAPAction = PREFIX + "SOAPAction";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final SoapXmlSerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
index f3810fc..9ce0574 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.soap;
-import static org.apache.juneau.soap.SoapXmlSerializerContext.*;
+import static org.apache.juneau.soap.SoapXmlSerializer.*;
import java.util.*;
@@ -69,7 +69,7 @@ public class SoapXmlSerializerBuilder extends XmlSerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SoapXmlSerializerContext#SOAPXML_SOAPAction
+ * @see SoapXmlSerializer#SOAPXML_SOAPAction
*/
public SoapXmlSerializerBuilder uriAnchorText(String value) {
return property(SOAPXML_SOAPAction, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java
index 6b2f4a2..e33e334 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java
@@ -16,36 +16,10 @@ import org.apache.juneau.*;
import org.apache.juneau.xml.*;
/**
- * Properties associated with the {@link SoapXmlSerializer} class.
- *
- * <h6 class='topic' id='ConfigProperties'>Configurable properties on the SOAP/XML serializer</h6>
- * <table class='styled' style='border-collapse: collapse;'>
- * <tr><th>Setting name</th><th>Description</th><th>Data type</th><th>Default value</th></tr>
- * <tr>
- * <td>{@link #SOAPXML_SOAPAction}</td>
- * <td>The <code>SOAPAction</code> HTTP header value to set on responses.</td>
- * <td><code>String</code></td>
- * <td><js>"http://www.w3.org/2003/05/soap-envelope"</js></td>
- * </tr>
- * </table>
- *
- * <h6 class='topic'>Inherited configurable properties</h6>
- * <ul class='doctree'>
- * <li class='jc'>
- * <a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a>
- * - Properties associated with handling beans on serializers and parsers.
- * <ul>
- * <li class='jc'>
- * <a class="doclink" href="../serializer/SerializerContext.html#ConfigProperties">SerializerContext</a>
- * - Configurable properties common to all serializers.
- * </ul>
- * </li>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link SoapXmlSerializer} class.
*/
public final class SoapXmlSerializerContext extends XmlSerializerContext {
- static final String PREFIX = "SoapXmlSerializer.";
-
/**
* Constructor
*
@@ -57,15 +31,4 @@ public final class SoapXmlSerializerContext extends XmlSerializerContext {
public SoapXmlSerializerContext(PropertyStore ps) {
super(ps);
}
-
- /**
- * <b>Configuration property:</b> The <code>SOAPAction</code> HTTP header value to set on responses.
- *
- * <ul>
- * <li><b>Name:</b> <js>"SoapXmlSerializer.SOAPAction"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"http://www.w3.org/2003/05/soap-envelope"</js>
- * </ul>
- */
- public static final String SOAPXML_SOAPAction = PREFIX + "SOAPAction";
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java
index 39857b2..e14d1c3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerSession.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.soap;
-import static org.apache.juneau.soap.SoapXmlSerializerContext.*;
+import static org.apache.juneau.soap.SoapXmlSerializer.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/ParamFormat.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/ParamFormat.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/ParamFormat.java
index 7c6e3a7..271d802 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/ParamFormat.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/ParamFormat.java
@@ -13,7 +13,7 @@
package org.apache.juneau.uon;
/**
- * Identifies the possible values for the {@link UonSerializerContext#UON_paramFormat} setting.
+ * Identifies the possible values for the {@link UonSerializer#UON_paramFormat} setting.
*/
public enum ParamFormat {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java
index ffc8a6b..228d9f4 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java
@@ -12,10 +12,9 @@
// ***************************************************************************************************************************
package org.apache.juneau.uon;
-import static org.apache.juneau.uon.UonParserContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
+import org.apache.juneau.urlencoding.*;
/**
* Parses UON (a notation for URL-encoded query parameter values) text into POJO models.
@@ -27,18 +26,36 @@ import org.apache.juneau.parser.*;
* <h5 class='section'>Description:</h5>
*
* This parser uses a state machine, which makes it very fast and efficient.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link UonParserContext}
- * <li>{@link ParserContext}
- * <li>{@link BeanContext}
- * </ul>
*/
public class UonParser extends ReaderParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "UonParser.";
+
+ /**
+ * <b>Configuration property:</b> Decode <js>"%xx"</js> sequences.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"UonParser.decodeChars"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk> for {@link UonParser}, <jk>true</jk> for {@link UrlEncodingParser}
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Specify <jk>true</jk> if URI encoded characters should be decoded, <jk>false</jk> if they've already been decoded
+ * before being passed to this parser.
+ */
+ public static final String UON_decodeChars = PREFIX + "decodeChars";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Reusable instance of {@link UonParser}, all default settings. */
public static final UonParser DEFAULT = new UonParser(PropertyStore.create());
@@ -46,6 +63,10 @@ public class UonParser extends ReaderParser {
public static final UonParser DEFAULT_DECODING = new UonParser.Decoding(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, decoding. */
public static class Decoding extends UonParser {
@@ -60,6 +81,10 @@ public class UonParser extends ReaderParser {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final UonParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
index 168c539..d2f58ed 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.uon;
-import static org.apache.juneau.uon.UonParserContext.*;
+import static org.apache.juneau.uon.UonParser.*;
import java.util.*;
@@ -73,7 +73,7 @@ public class UonParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see UonParserContext#UON_decodeChars
+ * @see UonParser#UON_decodeChars
*/
public UonParserBuilder decodeChars(boolean value) {
return property(UON_decodeChars, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserContext.java
index bbc5509..d0b64aa 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserContext.java
@@ -12,53 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.uon;
+import static org.apache.juneau.uon.UonParser.*;
+
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
-import org.apache.juneau.urlencoding.*;
/**
- * Configurable properties on the {@link UonParser} class.
- *
- * <p>
- * Context properties are set by calling {@link PropertyStore#setProperty(String, Object)} on the property store
- * passed into the constructor.
- *
- * <p>
- * See {@link PropertyStore} for more information about context properties.
- *
- * <h6 class='topic'>Inherited configurable properties</h6>
- * <ul class='doctree'>
- * <li class='jc'>
- * <a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a>
- * - Properties associated with handling beans on serializers and parsers.
- * <ul>
- * <li class='jc'>
- * <a class="doclink" href="../parser/ParserContext.html#ConfigProperties">ParserContext</a>
- * - Configurable properties common to all parsers.
- * </ul>
- * </li>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link UonParser} class.
*/
public class UonParserContext extends ParserContext {
- static final String PREFIX = "UonParser.";
-
- /**
- * <b>Configuration property:</b> Decode <js>"%xx"</js> sequences.
- *
- * <ul>
- * <li><b>Name:</b> <js>"UonParser.decodeChars"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk> for {@link UonParser}, <jk>true</jk> for {@link UrlEncodingParser}
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Specify <jk>true</jk> if URI encoded characters should be decoded, <jk>false</jk> if they've already been decoded
- * before being passed to this parser.
- */
- public static final String UON_decodeChars = PREFIX + "decodeChars";
-
final boolean
decodeChars;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
index c24385a..89f6f4e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
@@ -13,7 +13,7 @@
package org.apache.juneau.uon;
import static org.apache.juneau.internal.StringUtils.*;
-import static org.apache.juneau.uon.UonParserContext.*;
+import static org.apache.juneau.uon.UonParser.*;
import java.io.*;
import java.lang.reflect.*;
@@ -69,7 +69,7 @@ public class UonParserSession extends ReaderParserSession {
* Create a specialized parser session for parsing URL parameters.
*
* <p>
- * The main difference is that characters are never decoded, and the {@link UonParserContext#UON_decodeChars}
+ * The main difference is that characters are never decoded, and the {@link UonParser#UON_decodeChars}
* property is always ignored.
*
* @param ctx
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java
----------------------------------------------------------------------
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 bb99e3c..a5d4d3f 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
@@ -12,11 +12,9 @@
// ***************************************************************************************************************************
package org.apache.juneau.uon;
-import static org.apache.juneau.serializer.SerializerContext.*;
-import static org.apache.juneau.uon.UonSerializerContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.urlencoding.*;
/**
* Serializes POJO models to UON (a notation for URL-encoded query parameter values).
@@ -34,14 +32,6 @@ import org.apache.juneau.serializer.*;
* Typically, one of the predefined DEFAULT serializers will be sufficient.
* However, custom serializers can be constructed to fine-tune behavior.
*
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link UonSerializerContext}
- * <li>{@link BeanContext}
- * </ul>
- *
* <p>
* The following shows a sample object defined in Javascript:
* <p class='bcode'>
@@ -126,6 +116,75 @@ import org.apache.juneau.serializer.*;
*/
public class UonSerializer extends WriterSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "UonSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Encode non-valid URI characters.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"UonSerializer.encodeChars"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk> for {@link UonSerializer}, <jk>true</jk> for {@link UrlEncodingSerializer}
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Encode non-valid URI characters with <js>"%xx"</js> constructs.
+ *
+ * <p>
+ * If <jk>true</jk>, non-valid URI characters will be converted to <js>"%xx"</js> sequences.
+ * Set to <jk>false</jk> if parameter value is being passed to some other code that will already perform
+ * URL-encoding of non-valid URI characters.
+ */
+ public static final String UON_encodeChars = PREFIX + "encodeChars";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"UonSerializer.addBeanTypeProperties"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred
+ * through reflection.
+ * This is used to recreate the correct objects during parsing if the object types cannot be inferred.
+ * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from
+ * the value type.
+ *
+ * <p>
+ * When present, this value overrides the {@link #SERIALIZER_addBeanTypeProperties} setting and is
+ * provided to customize the behavior of specific serializers in a {@link SerializerGroup}.
+ */
+ public static final String UON_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+ /**
+ * <b>Configuration property:</b> Format to use for query/form-data/header values.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"UrlEncodingSerializer.paramFormat"</js>
+ * <li><b>Data type:</b> <code>ParamFormat</code>
+ * <li><b>Default:</b> <jsf>UON</jsf>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Specifies the format to use for URL GET parameter keys and values.
+ */
+ public static final String UON_paramFormat = PREFIX + "paramFormat";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Reusable instance of {@link UonSerializer}, all default settings. */
public static final UonSerializer DEFAULT = new UonSerializer(PropertyStore.create());
@@ -135,6 +194,11 @@ public class UonSerializer extends WriterSerializer {
/** Reusable instance of {@link UonSerializer.Encoding}. */
public static final UonSerializer DEFAULT_ENCODING = new Encoding(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/**
* Equivalent to <code><jk>new</jk> UonSerializerBuilder().ws().build();</code>.
*/
@@ -166,6 +230,10 @@ public class UonSerializer extends WriterSerializer {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final UonSerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
index dd1d92c..53482c2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.uon;
-import static org.apache.juneau.uon.UonSerializerContext.*;
+import static org.apache.juneau.uon.UonSerializer.*;
import java.util.*;
@@ -78,7 +78,7 @@ public class UonSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see UonSerializerContext#UON_encodeChars
+ * @see UonSerializer#UON_encodeChars
*/
public UonSerializerBuilder encodeChars(boolean value) {
return property(UON_encodeChars, value);
@@ -113,7 +113,7 @@ public class UonSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see UonSerializerContext#UON_paramFormat
+ * @see UonSerializer#UON_paramFormat
*/
public UonSerializerBuilder paramFormat(ParamFormat value) {
return property(UON_paramFormat, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerContext.java
index 612802b..7f3abaf 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerContext.java
@@ -12,96 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.uon;
+import static org.apache.juneau.uon.UonSerializer.*;
+
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
-import org.apache.juneau.urlencoding.*;
/**
- * Configurable properties on the {@link UonSerializer} class.
- *
- * <p>
- * Context properties are set by calling {@link PropertyStore#setProperty(String, Object)} on the property store
- * passed into the constructor.
- *
- * <p>
- * See {@link PropertyStore} for more information about context properties.
- *
- * <h6 class='topic'>Inherited configurable properties</h6>
- * <ul class='doctree'>
- * <li class='jc'>
- * <a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a>
- * - Properties associated with handling beans on serializers and parsers.
- * <ul>
- * <li class='jc'>
- * <a class="doclink" href="../serializer/SerializerContext.html#ConfigProperties">SerializerContext</a>
- * - Configurable properties common to all serializers.
- * </ul>
- * </li>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link UonSerializer} class.
*/
public class UonSerializerContext extends SerializerContext {
- static final String PREFIX = "UonSerializer.";
-
- /**
- * <b>Configuration property:</b> Encode non-valid URI characters.
- *
- * <ul>
- * <li><b>Name:</b> <js>"UonSerializer.encodeChars"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk> for {@link UonSerializer}, <jk>true</jk> for {@link UrlEncodingSerializer}
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Encode non-valid URI characters with <js>"%xx"</js> constructs.
- *
- * <p>
- * If <jk>true</jk>, non-valid URI characters will be converted to <js>"%xx"</js> sequences.
- * Set to <jk>false</jk> if parameter value is being passed to some other code that will already perform
- * URL-encoding of non-valid URI characters.
- */
- public static final String UON_encodeChars = PREFIX + "encodeChars";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"UonSerializer.addBeanTypeProperties"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred
- * through reflection.
- * This is used to recreate the correct objects during parsing if the object types cannot be inferred.
- * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from
- * the value type.
- *
- * <p>
- * When present, this value overrides the {@link SerializerContext#SERIALIZER_addBeanTypeProperties} setting and is
- * provided to customize the behavior of specific serializers in a {@link SerializerGroup}.
- */
- public static final String UON_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
- /**
- * <b>Configuration property:</b> Format to use for query/form-data/header values.
- *
- * <ul>
- * <li><b>Name:</b> <js>"UrlEncodingSerializer.paramFormat"</js>
- * <li><b>Data type:</b> <code>ParamFormat</code>
- * <li><b>Default:</b> <jsf>UON</jsf>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Specifies the format to use for URL GET parameter keys and values.
- */
- public static final String UON_paramFormat = PREFIX + "paramFormat";
-
-
final boolean
encodeChars,
addBeanTypeProperties;
@@ -136,9 +56,9 @@ public class UonSerializerContext extends SerializerContext {
}
/**
- * Returns the value of the {@link UonSerializerContext#UON_paramFormat} setting.
+ * Returns the value of the {@link UonSerializer#UON_paramFormat} setting.
*
- * @return The value of the {@link UonSerializerContext#UON_paramFormat} setting.
+ * @return The value of the {@link UonSerializer#UON_paramFormat} setting.
*/
public ParamFormat getParamFormat() {
return paramFormat;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerSession.java
----------------------------------------------------------------------
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 db6eea2..b57352b 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
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.uon;
-import static org.apache.juneau.uon.UonSerializerContext.*;
+import static org.apache.juneau.uon.UonSerializer.*;
import java.util.*;
@@ -39,7 +39,7 @@ public class UonSerializerSession extends WriterSerializerSession {
* @param ctx
* The context creating this session object.
* The context contains all the configuration settings for this object.
- * @param encode Override the {@link UonSerializerContext#UON_encodeChars} setting.
+ * @param encode Override the {@link UonSerializer#UON_encodeChars} setting.
* @param args
* Runtime arguments.
* These specify session-level information such as locale and URI context.
@@ -51,7 +51,7 @@ public class UonSerializerSession extends WriterSerializerSession {
ObjectMap p = getProperties();
encodeChars = encode == null ? p.getBoolean(UON_encodeChars, ctx.encodeChars) : encode;
addBeanTypeProperties = p.getBoolean(UON_addBeanTypeProperties, ctx.addBeanTypeProperties);
- plainTextParams = p.getWithDefault(UonSerializerContext.UON_paramFormat, ctx.paramFormat, ParamFormat.class) == ParamFormat.PLAINTEXT;
+ plainTextParams = p.getWithDefault(UON_paramFormat, ctx.paramFormat, ParamFormat.class) == ParamFormat.PLAINTEXT;
}
@Override /* Session */
@@ -65,9 +65,9 @@ public class UonSerializerSession extends WriterSerializerSession {
}
/**
- * Returns the {@link UonSerializerContext#UON_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link UonSerializer#UON_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link UonSerializerContext#UON_addBeanTypeProperties} setting value for this session.
+ * @return The {@link UonSerializer#UON_addBeanTypeProperties} setting value for this session.
*/
@Override /* SerializerSession */
public final boolean isAddBeanTypeProperties() {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/package.html b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/package.html
index 8f5652f..f95b4eb 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/package.html
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/package.html
@@ -638,12 +638,12 @@
The URL-encoding serializer is designed to be used against POJO tree structures.
It expects that there not be loops in the POJO model (e.g. children with references to parents, etc...).
<br>If you try to serialize models with loops, you will usually cause a <code>StackOverflowError</code> to
- be thrown (if {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_maxDepth} is not reached
+ be thrown (if {@link org.apache.juneau.serializer.Serializer#SERIALIZER_maxDepth} is not reached
first).
</p>
<p>
If you still want to use the URL-encoding serializer on such models, Juneau provides the
- {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_detectRecursions} setting.
+ {@link org.apache.juneau.serializer.Serializer#SERIALIZER_detectRecursions} setting.
<br>It tells the serializer to look for instances of an object in the current branch of the tree and skip
serialization when a duplicate is encountered.
</p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
index 3c2d729..7bb2606 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
@@ -12,7 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
-import static org.apache.juneau.uon.UonParserContext.*;
import static org.apache.juneau.internal.ArrayUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
@@ -38,22 +37,47 @@ import org.apache.juneau.uon.*;
*
* <p>
* This parser uses a state machine, which makes it very fast and efficient.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link UonParserContext}
- * <li>{@link BeanContext}
- * </ul>
*/
@SuppressWarnings({ "unchecked", "hiding" })
public class UrlEncodingParser extends UonParser implements PartParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "UrlEncodingParser.";
+
+ /**
+ * Parser bean property collections/arrays as separate key/value pairs ({@link Boolean}, default=<jk>false</jk>).
+ *
+ * <p>
+ * This is the parser-side equivalent of the {@link #URLENC_expandedParams} setting.
+ *
+ * <p>
+ * This option only applies to beans.
+ *
+ * <h5 class='section'>Notes:</h5>
+ * <ul>
+ * <li>If parsing multi-part parameters, it's highly recommended to use <code>Collections</code> or <code>Lists</code>
+ * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value
+ * is added to it.
+ * </ul>
+ */
+ public static final String URLENC_expandedParams = PREFIX + "expandedParams";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Reusable instance of {@link UrlEncodingParser}. */
public static final UrlEncodingParser DEFAULT = new UrlEncodingParser(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final UrlEncodingParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
index 72abc1e..e24aeb2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
@@ -12,7 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
-import static org.apache.juneau.uon.UonParserContext.*;
+import static org.apache.juneau.uon.UonParser.*;
+import static org.apache.juneau.urlencoding.UrlEncodingParser.*;
import java.util.*;
@@ -97,10 +98,10 @@ public class UrlEncodingParserBuilder extends UonParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see UrlEncodingParserContext#URLENC_expandedParams
+ * @see UrlEncodingParser#URLENC_expandedParams
*/
public UrlEncodingParserBuilder expandedParams(boolean value) {
- return property(UrlEncodingParserContext.URLENC_expandedParams, value);
+ return property(URLENC_expandedParams, value);
}
@Override /* UonParser */
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
index 426dbc0..816a458 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserContext.java
@@ -12,41 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
+import static org.apache.juneau.urlencoding.UrlEncodingParser.*;
+
import org.apache.juneau.*;
import org.apache.juneau.uon.*;
/**
- * Configurable properties on the {@link UrlEncodingParser} class.
- *
- * <p>
- * Context properties are set by calling {@link PropertyStore#setProperty(String, Object)} on the property store
- * passed into the constructor.
- *
- * <p>
- * See {@link PropertyStore} for more information about context properties.
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link UrlEncodingParser} class.
*/
public class UrlEncodingParserContext extends UonParserContext {
- static final String PREFIX = "UrlEncodingParser.";
-
- /**
- * Parser bean property collections/arrays as separate key/value pairs ({@link Boolean}, default=<jk>false</jk>).
- *
- * <p>
- * This is the parser-side equivalent of the {@link UrlEncodingSerializerContext#URLENC_expandedParams} setting.
- *
- * <p>
- * This option only applies to beans.
- *
- * <h5 class='section'>Notes:</h5>
- * <ul>
- * <li>If parsing multi-part parameters, it's highly recommended to use <code>Collections</code> or <code>Lists</code>
- * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value
- * is added to it.
- * </ul>
- */
- public static final String URLENC_expandedParams = PREFIX + "expandedParams";
-
final boolean
expandedParams;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
index 90c71f6..0fcc315 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
+import static org.apache.juneau.urlencoding.UrlEncodingParser.*;
+
import java.lang.reflect.*;
import java.util.*;
@@ -45,7 +47,7 @@ public class UrlEncodingParserSession extends UonParserSession {
protected UrlEncodingParserSession(UrlEncodingParserContext ctx, ParserSessionArgs args) {
super(ctx, args);
ObjectMap p = getProperties();
- expandedParams = p.getBoolean(UrlEncodingParserContext.URLENC_expandedParams, ctx.expandedParams);
+ expandedParams = p.getBoolean(URLENC_expandedParams, ctx.expandedParams);
}
@Override /* Session */
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
----------------------------------------------------------------------
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 9889644..738aa9e 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
@@ -12,9 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
-import static org.apache.juneau.serializer.SerializerContext.*;
-import static org.apache.juneau.uon.UonSerializerContext.*;
-import static org.apache.juneau.urlencoding.UrlEncodingSerializerContext.*;
import static org.apache.juneau.internal.StringUtils.*;
import java.io.*;
@@ -38,14 +35,6 @@ import org.apache.juneau.uon.*;
* This serializer provides several serialization options. Typically, one of the predefined DEFAULT serializers will be sufficient.
* However, custom serializers can be constructed to fine-tune behavior.
*
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link UonSerializerContext}
- * <li>{@link BeanContext}
- * </ul>
- *
* <p>
* The following shows a sample object defined in Javascript:
* <p class='bcode'>
@@ -128,6 +117,51 @@ import org.apache.juneau.uon.*;
@SuppressWarnings("hiding")
public class UrlEncodingSerializer extends UonSerializer implements PartSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "UrlEncodingSerializer.";
+
+ /**
+ * Serialize bean property collections/arrays as separate key/value pairs ({@link Boolean}, default=<jk>false</jk>).
+ *
+ * <p>
+ * If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>.
+ * If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>.
+ *
+ * <p>
+ * Example:
+ * <p class='bcode'>
+ * <jk>public class</jk> A {
+ * <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>};
+ * <jk>public</jk> List<String> f2 = <jk>new</jk> LinkedList<String>(Arrays.<jsm>asList</jsm>(<jk>new</jk> String[]{<js>"c"</js>,<js>"d"</js>}));
+ * }
+ *
+ * UrlEncodingSerializer s1 = UrlEncodingSerializer.<jsf>DEFAULT</jsf>;
+ * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingSerializerBuilder().expandedParams(<jk>true</jk>).build();
+ *
+ * String ss1 = s1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc>
+ * String ss2 = s2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc>
+ * </p>
+ *
+ * <p>
+ * This option only applies to beans.
+ *
+ * <h5 class='section'>Notes:</h5>
+ * <ul>
+ * <li>If parsing multi-part parameters, it's highly recommended to use <code>Collections</code> or <code>Lists</code>
+ * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value
+ * is added to it.
+ * </ul>
+ */
+ public static final String URLENC_expandedParams = PREFIX + "expandedParams";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Reusable instance of {@link UrlEncodingSerializer}, all default settings. */
public static final UrlEncodingSerializer DEFAULT = new UrlEncodingSerializer(PropertyStore.create());
@@ -140,6 +174,11 @@ public class UrlEncodingSerializer extends UonSerializer implements PartSerializ
/** Reusable instance of {@link UrlEncodingSerializer.Readable}. */
public static final UrlEncodingSerializer DEFAULT_READABLE = new Readable(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/**
* Equivalent to <code><jk>new</jk> UrlEncodingSerializerBuilder().expandedParams(<jk>true</jk>).build();</code>.
*/
@@ -185,6 +224,11 @@ public class UrlEncodingSerializer extends UonSerializer implements PartSerializ
}
}
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final UrlEncodingSerializerContext ctx;
/**
@@ -259,7 +303,7 @@ public class UrlEncodingSerializer extends UonSerializer implements PartSerializ
return o.toString();
if (cm.isCharSequence()) {
String s = o.toString();
- boolean ptt = (plainTextParams != null ? plainTextParams : ctx.getParamFormat().equals("PLAINTEXT"));
+ boolean ptt = (plainTextParams != null ? plainTextParams : ctx.getParamFormat() == ParamFormat.PLAINTEXT);
if (ptt || s.isEmpty() || ! UonUtils.needsQuotes(s))
return (urlEncode ? urlEncode(s) : s);
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
index 89532e0..17d1cb5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
+import static org.apache.juneau.urlencoding.UrlEncodingSerializer.*;
+
import java.util.*;
import org.apache.juneau.*;
@@ -96,10 +98,10 @@ public class UrlEncodingSerializerBuilder extends UonSerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see UrlEncodingSerializerContext#URLENC_expandedParams
+ * @see UrlEncodingSerializer#URLENC_expandedParams
*/
public UrlEncodingSerializerBuilder expandedParams(boolean value) {
- return property(UrlEncodingSerializerContext.URLENC_expandedParams, value);
+ return property(URLENC_expandedParams, value);
}
/**
@@ -132,17 +134,17 @@ public class UrlEncodingSerializerBuilder extends UonSerializerBuilder {
*
* @param paramFormat The new value for this property.
* @return This object (for method chaining).
- * @see UonSerializerContext#UON_paramFormat
+ * @see UonSerializer#UON_paramFormat
*/
public UrlEncodingSerializerBuilder paramFormat(String paramFormat) {
- return property(UonSerializerContext.UON_paramFormat, paramFormat);
+ return property(UON_paramFormat, paramFormat);
}
/**
* Shortcut for calling <code>paramFormat(<js>"PLAINTEXT"</js>)</code>.
*
* @return This object (for method chaining).
- * @see UonSerializerContext#UON_paramFormat
+ * @see UonSerializer#UON_paramFormat
*/
public UrlEncodingSerializerBuilder plainTextParams() {
return paramFormat("PLAINTEXT");
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
index 04166a1..61d543a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerContext.java
@@ -12,57 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding;
+import static org.apache.juneau.urlencoding.UrlEncodingSerializer.*;
+
import org.apache.juneau.*;
import org.apache.juneau.uon.*;
/**
- * Configurable properties on the {@link UrlEncodingSerializer} class.
- *
- * <p>
- * Context properties are set by calling {@link PropertyStore#setProperty(String, Object)} on the property store
- * passed into the constructor.
- *
- * <p>
- * See {@link PropertyStore} for more information about context properties.
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link UrlEncodingSerializer} class.
*/
public class UrlEncodingSerializerContext extends UonSerializerContext {
- static final String PREFIX = "UrlEncodingSerializer.";
-
- /**
- * Serialize bean property collections/arrays as separate key/value pairs ({@link Boolean}, default=<jk>false</jk>).
- *
- * <p>
- * If <jk>false</jk>, serializing the array <code>[1,2,3]</code> results in <code>?key=$a(1,2,3)</code>.
- * If <jk>true</jk>, serializing the same array results in <code>?key=1&key=2&key=3</code>.
- *
- * <p>
- * Example:
- * <p class='bcode'>
- * <jk>public class</jk> A {
- * <jk>public</jk> String[] f1 = {<js>"a"</js>,<js>"b"</js>};
- * <jk>public</jk> List<String> f2 = <jk>new</jk> LinkedList<String>(Arrays.<jsm>asList</jsm>(<jk>new</jk> String[]{<js>"c"</js>,<js>"d"</js>}));
- * }
- *
- * UrlEncodingSerializer s1 = UrlEncodingSerializer.<jsf>DEFAULT</jsf>;
- * UrlEncodingSerializer s2 = <jk>new</jk> UrlEncodingSerializerBuilder().expandedParams(<jk>true</jk>).build();
- *
- * String ss1 = s1.serialize(<jk>new</jk> A()); <jc>// Produces "f1=(a,b)&f2=(c,d)"</jc>
- * String ss2 = s2.serialize(<jk>new</jk> A()); <jc>// Produces "f1=a&f1=b&f2=c&f2=d"</jc>
- * </p>
- *
- * <p>
- * This option only applies to beans.
- *
- * <h5 class='section'>Notes:</h5>
- * <ul>
- * <li>If parsing multi-part parameters, it's highly recommended to use <code>Collections</code> or <code>Lists</code>
- * as bean property types instead of arrays since arrays have to be recreated from scratch every time a value
- * is added to it.
- * </ul>
- */
- public static final String URLENC_expandedParams = PREFIX + "expandedParams";
-
final boolean
expandedParams;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerSession.java
----------------------------------------------------------------------
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 ccc2798..0e300ca 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
@@ -13,6 +13,7 @@
package org.apache.juneau.urlencoding;
import static org.apache.juneau.internal.ArrayUtils.*;
+import static org.apache.juneau.urlencoding.UrlEncodingSerializer.*;
import java.lang.reflect.*;
import java.util.*;
@@ -41,7 +42,7 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
* @param ctx
* The context creating this session object.
* The context contains all the configuration settings for this object.
- * @param encode Override the {@link UonSerializerContext#UON_encodeChars} setting.
+ * @param encode Override the {@link UonSerializer#UON_encodeChars} setting.
* @param args
* Runtime arguments.
* These specify session-level information such as locale and URI context.
@@ -51,7 +52,7 @@ public class UrlEncodingSerializerSession extends UonSerializerSession {
protected UrlEncodingSerializerSession(UrlEncodingSerializerContext ctx, Boolean encode, SerializerSessionArgs args) {
super(ctx, encode, args);
ObjectMap p = getProperties();
- expandedParams = p.getBoolean(UrlEncodingSerializerContext.URLENC_expandedParams, ctx.expandedParams);
+ expandedParams = p.getBoolean(URLENC_expandedParams, ctx.expandedParams);
}
@Override /* Session */
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java
index 1326589..d8b9d2d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java
@@ -33,8 +33,8 @@ public @interface UrlEncoding {
* When true, bean properties of type array or Collection will be expanded into multiple key/value pairings.
*
* <p>
- * This annotation is identical in behavior to using the {@link UrlEncodingSerializerContext#URLENC_expandedParams}
- * and {@link UrlEncodingParserContext#URLENC_expandedParams} properties, but applies to only instances of this bean.
+ * This annotation is identical in behavior to using the {@link UrlEncodingSerializer#URLENC_expandedParams}
+ * and {@link UrlEncodingParser#URLENC_expandedParams} properties, but applies to only instances of this bean.
*/
boolean expandedParams() default false;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/package.html b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/package.html
index 0a3d6ea..7fa6bed 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/package.html
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/package.html
@@ -639,11 +639,11 @@
The URL-encoding serializer is designed to be used against POJO tree structures.
<br>It expects that there not be loops in the POJO model (e.g. children with references to parents, etc...).
<br>If you try to serialize models with loops, you will usually cause a <code>StackOverflowError</code> to
- be thrown (if {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_maxDepth} is not reached first).
+ be thrown (if {@link org.apache.juneau.serializer.Serializer#SERIALIZER_maxDepth} is not reached first).
</p>
<p>
If you still want to use the URL-encoding serializer on such models, Juneau provides the
- {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_detectRecursions} setting.
+ {@link org.apache.juneau.serializer.Serializer#SERIALIZER_detectRecursions} setting.
<br>It tells the serializer to look for instances of an object in the current branch of the tree and
skip serialization when a duplicate is encountered.
</p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializer.java
index f04c2d4..9d3934d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlDocSerializer.java
@@ -12,8 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
-import static org.apache.juneau.xml.XmlSerializerContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
@@ -35,6 +33,10 @@ import org.apache.juneau.serializer.*;
*/
public class XmlDocSerializer extends XmlSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer without namespaces. */
public static class Ns extends XmlDocSerializer {
@@ -48,6 +50,11 @@ public class XmlDocSerializer extends XmlSerializer {
}
}
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
/**
* Constructor.
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
index fbc6ae2..6b559bf 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
@@ -12,6 +12,9 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
+import javax.xml.stream.*;
+import javax.xml.stream.util.*;
+
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
@@ -25,21 +28,125 @@ import org.apache.juneau.parser.*;
* <h5 class='section'>Description:</h5>
*
* See the {@link XmlSerializer} class for a description of Juneau-generated XML.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link XmlParserContext}
- * <li>{@link BeanContext}
- * </ul>
*/
public class XmlParser extends ReaderParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "XmlParser.";
+
+ /**
+ * <b>Configuration property:</b> Enable validation.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlParser.validating"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * If <jk>true</jk>, XML document will be validated.
+ * See {@link XMLInputFactory#IS_VALIDATING} for more info.
+ */
+ public static final String XML_validating = PREFIX + "validating";
+
+ /**
+ * <b>Configuration property:</b> XML reporter.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlParser.reporter"</js>
+ * <li><b>Data type:</b> {@link XMLReporter}
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Associates an {@link XMLReporter} with this parser.
+ *
+ * <h5 class='section'>Notes:</h5>
+ * <ul>
+ * <li>Reporters are not copied to new parsers during a clone.
+ * </ul>
+ */
+ public static final String XML_reporter = PREFIX + "reporter";
+
+ /**
+ * <b>Configuration property:</b> XML resolver.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlParser.resolver"</js>
+ * <li><b>Data type:</b> {@link XMLResolver}
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Associates an {@link XMLResolver} with this parser.
+ */
+ public static final String XML_resolver = PREFIX + "resolver";
+
+ /**
+ * <b>Configuration property:</b> XML event allocator.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlParser.eventAllocator"</js>
+ * <li><b>Data type:</b> {@link XMLEventAllocator}
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Associates an {@link XMLEventAllocator} with this parser.
+ */
+ public static final String XML_eventAllocator = PREFIX + "eventAllocator";
+
+ /**
+ * <b>Configuration property:</b> Preserve root element during generalized parsing.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlParser.preserveRootElement"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * If <jk>true</jk>, when parsing into a generic {@link ObjectMap}, the map will contain a single entry whose key
+ * is the root element name.
+ *
+ * <p>
+ * Example:
+ * <table class='styled'>
+ * <tr>
+ * <td>XML</td>
+ * <td>ObjectMap.toString(), preserveRootElement==false</td>
+ * <td>ObjectMap.toString(), preserveRootElement==true</td>
+ * </tr>
+ * <tr>
+ * <td><code><xt><root><a></xt>foobar<xt></a></root></xt></code></td>
+ * <td><code>{ a:<js>'foobar'</js> }</code></td>
+ * <td><code>{ root: { a:<js>'foobar'</js> }}</code></td>
+ * </tr>
+ * </table>
+ */
+ public static final String XML_preserveRootElement = PREFIX + "preserveRootElement";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final XmlParser DEFAULT = new XmlParser(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final XmlParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
index b27de19..ebbfedc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
-import static org.apache.juneau.xml.XmlParserContext.*;
+import static org.apache.juneau.xml.XmlParser.*;
import java.util.*;
@@ -79,7 +79,7 @@ public class XmlParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlParserContext#XML_validating
+ * @see XmlParser#XML_validating
*/
public XmlParserBuilder validating(boolean value) {
return property(XML_validating, value);
@@ -114,7 +114,7 @@ public class XmlParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlParserContext#XML_reporter
+ * @see XmlParser#XML_reporter
*/
public XmlParserBuilder reporter(XMLReporter value) {
return property(XML_reporter, value);
@@ -144,7 +144,7 @@ public class XmlParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlParserContext#XML_resolver
+ * @see XmlParser#XML_resolver
*/
public XmlParserBuilder resolver(XMLResolver value) {
return property(XML_resolver, value);
@@ -174,7 +174,7 @@ public class XmlParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlParserContext#XML_eventAllocator
+ * @see XmlParser#XML_eventAllocator
*/
public XmlParserBuilder eventAllocator(XMLEventAllocator value) {
return property(XML_eventAllocator, value);
@@ -215,7 +215,7 @@ public class XmlParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlParserContext#XML_preserveRootElement
+ * @see XmlParser#XML_preserveRootElement
*/
public XmlParserBuilder preserveRootElement(boolean value) {
return property(XML_preserveRootElement, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserContext.java
index 55cf882..f89c49b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserContext.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
+import static org.apache.juneau.xml.XmlParser.*;
+
import javax.xml.stream.*;
import javax.xml.stream.util.*;
@@ -19,129 +21,10 @@ import org.apache.juneau.*;
import org.apache.juneau.parser.*;
/**
- * Configurable properties on the {@link XmlParser} class.
- *
- * <p>
- * Context properties are set by calling {@link PropertyStore#setProperty(String, Object)} on the property store
- * passed into the constructor.
- *
- * <p>
- * See {@link PropertyStore} for more information about context properties.
- *
- * <h6 class='topic'>Inherited configurable properties</h6>
- * <ul class='doctree'>
- * <li class='jc'>
- * <a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a>
- * - Properties associated with handling beans on serializers and parsers.
- * <ul>
- * <li class='jc'>
- * <a class="doclink" href="../parser/ParserContext.html#ConfigProperties">ParserContext</a>
- * - Configurable properties common to all parsers.
- * </ul>
- * </li>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link XmlParser} class.
*/
public class XmlParserContext extends ParserContext {
- static final String PREFIX = "XmlParser.";
-
- /**
- * <b>Configuration property:</b> Enable validation.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlParser.validating"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * If <jk>true</jk>, XML document will be validated.
- * See {@link XMLInputFactory#IS_VALIDATING} for more info.
- */
- public static final String XML_validating = PREFIX + "validating";
-
- /**
- * <b>Configuration property:</b> XML reporter.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlParser.reporter"</js>
- * <li><b>Data type:</b> {@link XMLReporter}
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Associates an {@link XMLReporter} with this parser.
- *
- * <h5 class='section'>Notes:</h5>
- * <ul>
- * <li>Reporters are not copied to new parsers during a clone.
- * </ul>
- */
- public static final String XML_reporter = PREFIX + "reporter";
-
- /**
- * <b>Configuration property:</b> XML resolver.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlParser.resolver"</js>
- * <li><b>Data type:</b> {@link XMLResolver}
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Associates an {@link XMLResolver} with this parser.
- */
- public static final String XML_resolver = PREFIX + "resolver";
-
- /**
- * <b>Configuration property:</b> XML event allocator.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlParser.eventAllocator"</js>
- * <li><b>Data type:</b> {@link XMLEventAllocator}
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Associates an {@link XMLEventAllocator} with this parser.
- */
- public static final String XML_eventAllocator = PREFIX + "eventAllocator";
-
- /**
- * <b>Configuration property:</b> Preserve root element during generalized parsing.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlParser.preserveRootElement"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * If <jk>true</jk>, when parsing into a generic {@link ObjectMap}, the map will contain a single entry whose key
- * is the root element name.
- *
- * <p>
- * Example:
- * <table class='styled'>
- * <tr>
- * <td>XML</td>
- * <td>ObjectMap.toString(), preserveRootElement==false</td>
- * <td>ObjectMap.toString(), preserveRootElement==true</td>
- * </tr>
- * <tr>
- * <td><code><xt><root><a></xt>foobar<xt></a></root></xt></code></td>
- * <td><code>{ a:<js>'foobar'</js> }</code></td>
- * <td><code>{ root: { a:<js>'foobar'</js> }}</code></td>
- * </tr>
- * </table>
- */
- public static final String XML_preserveRootElement = PREFIX + "preserveRootElement";
-
final boolean
validating,
preserveRootElement;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
index 5041848..1e83010 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
@@ -13,7 +13,7 @@
package org.apache.juneau.xml;
import static javax.xml.stream.XMLStreamConstants.*;
-import static org.apache.juneau.xml.XmlParserContext.*;
+import static org.apache.juneau.xml.XmlParser.*;
import static org.apache.juneau.xml.annotation.XmlFormat.*;
import static org.apache.juneau.internal.StringUtils.*;
@@ -40,7 +40,6 @@ public class XmlParserSession extends ReaderParserSession {
private static final int UNKNOWN=0, OBJECT=1, ARRAY=2, STRING=3, NUMBER=4, BOOLEAN=5, NULL=6;
-
private final boolean
validating,
preserveRootElement;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
index aba1879..38d953d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
@@ -28,14 +28,6 @@ import org.apache.juneau.serializer.*;
* <h5 class='section'>Description:</h5>
*
* Produces the XML-schema representation of the XML produced by the {@link XmlSerializer} class with the same properties.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link XmlSerializerContext}
- * <li>{@link BeanContext}
- * </ul>
*/
public class XmlSchemaSerializer extends XmlSerializer {
@@ -45,7 +37,7 @@ public class XmlSchemaSerializer extends XmlSerializer {
* @param propertyStore Initialize with the specified config property store.
*/
public XmlSchemaSerializer(PropertyStore propertyStore) {
- super(propertyStore.copy().append(XmlSerializerContext.XML_enableNamespaces, true), "text/xml", "text/xml+schema");
+ super(propertyStore.copy().append(XML_enableNamespaces, true), "text/xml", "text/xml+schema");
}
@Override /* Serializer */