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 06b6b13  Parser API cleanup.
06b6b13 is described below

commit 06b6b1350b35c241c1d7b53c743026e9b01a7124
Author: JamesBognar <jamesbog...@apache.org>
AuthorDate: Sun Jul 8 18:12:28 2018 -0400

    Parser API cleanup.
---
 .../java/org/apache/juneau/jena/RdfParser.java     | 12 ++--
 .../org/apache/juneau/jena/RdfParserSession.java   | 82 ++++++++++++++++++++--
 .../java/org/apache/juneau/json/JsonParser.java    |  2 +-
 .../org/apache/juneau/json/JsonParserSession.java  | 19 ++++-
 .../apache/juneau/parser/InputStreamParser.java    |  2 +-
 .../juneau/parser/InputStreamParserSession.java    | 17 +++++
 .../main/java/org/apache/juneau/parser/Parser.java | 12 ++--
 .../org/apache/juneau/parser/ParserSession.java    | 81 +++++++++++++++------
 .../org/apache/juneau/parser/ReaderParser.java     |  4 +-
 .../apache/juneau/parser/ReaderParserSession.java  | 30 +++++++-
 .../main/java/org/apache/juneau/uon/UonParser.java |  4 +-
 .../org/apache/juneau/uon/UonParserSession.java    | 30 +++++++-
 .../juneau/urlencoding/UrlEncodingParser.java      |  2 +-
 .../urlencoding/UrlEncodingParserSession.java      | 20 +++++-
 .../main/java/org/apache/juneau/xml/XmlParser.java | 10 +--
 .../org/apache/juneau/xml/XmlParserSession.java    | 65 ++++++++++++++++-
 16 files changed, 336 insertions(+), 56 deletions(-)

diff --git 
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
 
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
index 221bfe9..ca28206 100644
--- 
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
+++ 
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
@@ -260,7 +260,7 @@ public class RdfParser extends ReaderParser implements 
RdfCommon {
         * @return
         *      <jk>true</jk> if whitespace in text elements will be 
automatically trimmed.
         */
-       public final boolean isTrimWhitespace() {
+       protected final boolean isTrimWhitespace() {
                return trimWhitespace;
        }
 
@@ -272,7 +272,7 @@ public class RdfParser extends ReaderParser implements 
RdfCommon {
         *      <jk>true</jk> if collections of resources are handled as loose 
collections of resources in RDF instead of
         *      resources that are children of an RDF collection (e.g. 
Sequence, Bag).
         */
-       public final boolean isLooseCollections() {
+       protected final boolean isLooseCollections() {
                return looseCollections;
        }
 
@@ -283,7 +283,7 @@ public class RdfParser extends ReaderParser implements 
RdfCommon {
         * @return
         *      The RDF language to use.
         */
-       public final String getRdfLanguage() {
+       protected final String getRdfLanguage() {
                return rdfLanguage;
        }
 
@@ -294,7 +294,7 @@ public class RdfParser extends ReaderParser implements 
RdfCommon {
         * @return
         *      XML namespace for Juneau properties.
         */
-       public final Namespace getJuneauNs() {
+       protected final Namespace getJuneauNs() {
                return juneauNs;
        }
 
@@ -305,7 +305,7 @@ public class RdfParser extends ReaderParser implements 
RdfCommon {
         * @return
         *      Default XML namespace for bean properties.
         */
-       public final Namespace getJuneauBpNs() {
+       protected final Namespace getJuneauBpNs() {
                return juneauBpNs;
        }
 
@@ -316,7 +316,7 @@ public class RdfParser extends ReaderParser implements 
RdfCommon {
         * @return
         *      RDF format for representing collections and arrays.
         */
-       public final RdfCollectionFormat getCollectionFormat() {
+       protected final RdfCollectionFormat getCollectionFormat() {
                return collectionFormat;
        }
 
diff --git 
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
 
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
index b845f84..7f97878 100644
--- 
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
+++ 
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
@@ -12,6 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.jena;
 
+import static org.apache.juneau.jena.RdfParser.*;
 import static org.apache.juneau.internal.StringUtils.*;
 import static org.apache.juneau.jena.Constants.*;
 
@@ -85,7 +86,7 @@ public class RdfParserSession extends ReaderParserSession {
                List<Resource> roots = getRoots(model);
 
                // Special case where we're parsing a loose collection of 
resources.
-               if (ctx.isLooseCollections() && type.isCollectionOrArray()) {
+               if (isLooseCollections() && type.isCollectionOrArray()) {
                        Collection c = null;
                        if (type.isArray() || type.isArgs())
                                c = new ArrayList();
@@ -130,7 +131,7 @@ public class RdfParserSession extends ReaderParserSession {
                String s = o.toString();
                if (s.isEmpty())
                        return s;
-               if (ctx.isTrimWhitespace())
+               if (isTrimWhitespace())
                        s = s.trim();
                s = XmlUtils.decode(s, null);
                if (isTrimStrings())
@@ -146,7 +147,7 @@ public class RdfParserSession extends ReaderParserSession {
                List<Resource> l = new LinkedList<>();
 
                // First try to find the root using the 
"http://www.apache.org/juneau/root"; property.
-               Property root = m.createProperty(ctx.getJuneauNs().getUri(), 
RDF_juneauNs_ROOT);
+               Property root = m.createProperty(getJuneauNs().getUri(), 
RDF_juneauNs_ROOT);
                for (ResIterator i  = m.listResourcesWithProperty(root); 
i.hasNext();)
                        l.add(i.next());
 
@@ -210,7 +211,7 @@ public class RdfParserSession extends ReaderParserSession {
                if (bpRdf.getCollectionFormat() != RdfCollectionFormat.DEFAULT)
                        return bpRdf.getCollectionFormat() == 
RdfCollectionFormat.MULTI_VALUED;
 
-               return ctx.getCollectionFormat() == 
RdfCollectionFormat.MULTI_VALUED;
+               return getCollectionFormat() == 
RdfCollectionFormat.MULTI_VALUED;
        }
 
        private <T> T parseAnything(ClassMeta<?> eType, RDFNode n, Object 
outer, BeanPropertyMeta pMeta) throws Exception {
@@ -397,7 +398,7 @@ public class RdfParserSession extends ReaderParserSession {
                        Statement st = i.next();
                        Property p = st.getPredicate();
                        String key = p.getLocalName();
-                       if (! (key.equals("root") && 
p.getURI().equals(ctx.getJuneauNs().getUri()))) {
+                       if (! (key.equals("root") && 
p.getURI().equals(getJuneauNs().getUri()))) {
                                key = decodeString(key);
                                RDFNode o = st.getObject();
                                K key2 = convertAttrToType(m, key, keyType);
@@ -429,4 +430,75 @@ public class RdfParserSession extends ReaderParserSession {
                }
                return l;
        }
+
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Properties
+       
//-----------------------------------------------------------------------------------------------------------------
+
+       /**
+        * Configuration property:  Trim whitespace from text elements.
+        *
+        * @see #RDF_trimWhitespace
+        * @return
+        *      <jk>true</jk> if whitespace in text elements will be 
automatically trimmed.
+        */
+       protected final boolean isTrimWhitespace() {
+               return ctx.isTrimWhitespace();
+       }
+
+       /**
+        * Configuration property:  Collections should be serialized and parsed 
as loose collections.
+        *
+        * @see #RDF_looseCollections
+        * @return
+        *      <jk>true</jk> if collections of resources are handled as loose 
collections of resources in RDF instead of
+        *      resources that are children of an RDF collection (e.g. 
Sequence, Bag).
+        */
+       protected final boolean isLooseCollections() {
+               return ctx.isLooseCollections();
+       }
+
+       /**
+        * Configuration property:  RDF language.
+        *
+        * @see #RDF_language
+        * @return
+        *      The RDF language to use.
+        */
+       protected final String getRdfLanguage() {
+               return ctx.getRdfLanguage();
+       }
+
+       /**
+        * Configuration property:  XML namespace for Juneau properties.
+        *
+        * @see #RDF_juneauNs
+        * @return
+        *      XML namespace for Juneau properties.
+        */
+       protected final Namespace getJuneauNs() {
+               return ctx.getJuneauNs();
+       }
+
+       /**
+        * Configuration property:  Default XML namespace for bean properties.
+        *
+        * @see #RDF_juneauBpNs
+        * @return
+        *      Default XML namespace for bean properties.
+        */
+       protected final Namespace getJuneauBpNs() {
+               return ctx.getJuneauBpNs();
+       }
+
+       /**
+        * Configuration property:  RDF format for representing collections and 
arrays.
+        *
+        * @see #RDF_collectionFormat
+        * @return
+        *      RDF format for representing collections and arrays.
+        */
+       protected final RdfCollectionFormat getCollectionFormat() {
+               return ctx.getCollectionFormat();
+       }
 }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
index 067cb9b..1cf7228 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
@@ -253,7 +253,7 @@ public class JsonParser extends ReaderParser {
         *      <jk>true</jk> if after parsing a POJO from the input, verifies 
that the remaining input in
         *      the stream consists of only comments or whitespace.
         */
-       public final boolean isValidateEnd() {
+       protected final boolean isValidateEnd() {
                return validateEnd;
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
index f9ec8a6..fe8a720 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
@@ -12,6 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.json;
 
+import static org.apache.juneau.json.JsonParser.*;
 import static org.apache.juneau.internal.StringUtils.*;
 
 import java.io.*;
@@ -774,11 +775,27 @@ public final class JsonParserSession extends 
ReaderParserSession {
         * remainder in the input, that it consists only of whitespace and 
comments.
         */
        private void validateEnd(ParserReader r) throws Exception {
-               if (! ctx.isValidateEnd())
+               if (! isValidateEnd())
                        return;
                skipCommentsAndSpace(r);
                int c = r.read();
                if (c != -1 && c != ';')  // var x = {...}; expressions can end 
with a semicolon.
                        throw new ParseException(this, "Remainder after parse: 
''{0}''.", (char)c);
        }
+
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Properties
+       
//-----------------------------------------------------------------------------------------------------------------
+
+       /**
+        * Configuration property:  Validate end.
+        *
+        * @see #JSON_validateEnd
+        * @return
+        *      <jk>true</jk> if after parsing a POJO from the input, verifies 
that the remaining input in
+        *      the stream consists of only comments or whitespace.
+        */
+       protected final boolean isValidateEnd() {
+               return ctx.isValidateEnd();
+       }
 }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java
index 23bd2f4..7aa6183 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParser.java
@@ -112,7 +112,7 @@ public abstract class InputStreamParser extends Parser {
         * @return
         *      The format to use when converting strings to byte arrays.
         */
-       public final BinaryFormat getBinaryFormat() {
+       protected final BinaryFormat getBinaryFormat() {
                return binaryFormat;
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java
index 922a120..40950a2 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserSession.java
@@ -12,6 +12,8 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.parser;
 
+import static org.apache.juneau.parser.InputStreamParser.*;
+
 import java.io.*;
 
 import org.apache.juneau.*;
@@ -79,6 +81,21 @@ public abstract class InputStreamParserSession extends 
ParserSession {
                return setPipe(new ParserPipe(input, isDebug(), 
ctx.isAutoCloseStreams(), ctx.isUnbuffered(), ctx.getBinaryFormat()));
        }
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Properties
+       
//-----------------------------------------------------------------------------------------------------------------
+
+       /**
+        * Configuration property:  Binary input format.
+        *
+        * @see #ISPARSER_binaryFormat
+        * @return
+        *      The format to use when converting strings to byte arrays.
+        */
+       protected final BinaryFormat getBinaryFormat() {
+               return ctx.getBinaryFormat();
+       }
+
        @Override /* Session */
        public ObjectMap asMap() {
                return super.asMap()
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
index 9a4875b..8aa2016 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
@@ -844,7 +844,7 @@ public abstract class Parser extends BeanContext {
         *      <jk>true</jk> if string values will be trimmed of whitespace 
using {@link String#trim()} before being added to
         *      the POJO.
         */
-       public final boolean isTrimStrings() {
+       protected final boolean isTrimStrings() {
                return trimStrings;
        }
 
@@ -855,7 +855,7 @@ public abstract class Parser extends BeanContext {
         * @return
         *      <jk>true</jk> if strict mode for the parser is enabled.
         */
-       public final boolean isStrict() {
+       protected final boolean isStrict() {
                return strict;
        }
 
@@ -867,7 +867,7 @@ public abstract class Parser extends BeanContext {
         *      <jk>true</jk> if <l>InputStreams</l> and <l>Readers</l> passed 
into parsers will be closed
         *      after parsing is complete.
         */
-       public final boolean isAutoCloseStreams() {
+       protected final boolean isAutoCloseStreams() {
                return autoCloseStreams;
        }
 
@@ -878,7 +878,7 @@ public abstract class Parser extends BeanContext {
         * @return
         *      <jk>true</jk> if parsers don't use internal buffering during 
parsing.
         */
-       public final boolean isUnbuffered() {
+       protected final boolean isUnbuffered() {
                return unbuffered;
        }
 
@@ -889,7 +889,7 @@ public abstract class Parser extends BeanContext {
         * @return
         *      The number of lines of input before and after the error 
location to be printed as part of the exception message.
         */
-       public final int isDebugOutputLines() {
+       protected final int getDebugOutputLines() {
                return debugOutputLines;
        }
 
@@ -900,7 +900,7 @@ public abstract class Parser extends BeanContext {
         * @return
         *      Class used to listen for errors and warnings that occur during 
parsing.
         */
-       public final Class<? extends ParserListener> getListenerClass() {
+       protected final Class<? extends ParserListener> getListenerClass() {
                return listener;
        }
 }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
index 42765fe..190db6d 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
@@ -203,24 +203,6 @@ public abstract class ParserSession extends BeanSession {
        }
 
        /**
-        * Returns the {@link Parser#PARSER_trimStrings} setting value for this 
session.
-        *
-        * @return The {@link Parser#PARSER_trimStrings} setting value for this 
session.
-        */
-       protected final boolean isTrimStrings() {
-               return ctx.isTrimStrings();
-       }
-
-       /**
-        * Returns the {@link Parser#PARSER_strict} setting value for this 
session.
-        *
-        * @return The {@link Parser#PARSER_strict} setting value for this 
session.
-        */
-       protected final boolean isStrict() {
-               return ctx.isStrict();
-       }
-
-       /**
         * Trims the specified object if it's a <code>String</code> and {@link 
#isTrimStrings()} returns <jk>true</jk>.
         *
         * @param o The object to trim.
@@ -228,7 +210,7 @@ public abstract class ParserSession extends BeanSession {
         */
        @SuppressWarnings("unchecked")
        protected final <K> K trim(K o) {
-               if (ctx.isTrimStrings() && o instanceof String)
+               if (isTrimStrings() && o instanceof String)
                        return (K)o.toString().trim();
                return o;
 
@@ -824,13 +806,70 @@ public abstract class ParserSession extends BeanSession {
        
//-----------------------------------------------------------------------------------------------------------------
 
        /**
+        * Configuration property:  Trim parsed strings.
+        *
+        * @see #PARSER_trimStrings
+        * @return
+        *      <jk>true</jk> if string values will be trimmed of whitespace 
using {@link String#trim()} before being added to
+        *      the POJO.
+        */
+       protected final boolean isTrimStrings() {
+               return ctx.isTrimStrings();
+       }
+
+       /**
+        * Configuration property:  Strict mode.
+        *
+        * @see #PARSER_strict
+        * @return
+        *      <jk>true</jk> if strict mode for the parser is enabled.
+        */
+       protected final boolean isStrict() {
+               return ctx.isStrict();
+       }
+
+       /**
+        * Configuration property:  Auto-close streams.
+        *
+        * @see #PARSER_autoCloseStreams
+        * @return
+        *      <jk>true</jk> if <l>InputStreams</l> and <l>Readers</l> passed 
into parsers will be closed
+        *      after parsing is complete.
+        */
+       protected final boolean isAutoCloseStreams() {
+               return ctx.isAutoCloseStreams();
+       }
+
+       /**
+        * Configuration property:  Unbuffered.
+        *
+        * @see #PARSER_unbuffered
+        * @return
+        *      <jk>true</jk> if parsers don't use internal buffering during 
parsing.
+        */
+       protected final boolean isUnbuffered() {
+               return ctx.isUnbuffered();
+       }
+
+       /**
         * Configuration property:  Debug output lines.
         *
         * @see #PARSER_debugOutputLines
         * @return
         *      The number of lines of input before and after the error 
location to be printed as part of the exception message.
         */
-       public final int getDebugOutputLines() {
-               return ctx.isDebugOutputLines();
+       protected final int getDebugOutputLines() {
+               return ctx.getDebugOutputLines();
+       }
+
+       /**
+        * Configuration property:  Parser listener.
+        *
+        * @see #PARSER_listener
+        * @return
+        *      Class used to listen for errors and warnings that occur during 
parsing.
+        */
+       protected final Class<? extends ParserListener> getListenerClass() {
+               return ctx.getListenerClass();
        }
 }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java
index 46ba236..d7bfff6 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParser.java
@@ -166,7 +166,7 @@ public abstract class ReaderParser extends Parser {
         * @return
         *      The character set to use for converting 
<code>InputStreams</code> and byte arrays to readers.
         */
-       public final String getInputStreamCharset() {
+       protected final String getInputStreamCharset() {
                return inputStreamCharset;
        }
 
@@ -177,7 +177,7 @@ public abstract class ReaderParser extends Parser {
         * @return
         *      The character set to use for reading <code>Files</code> from 
the file system.
         */
-       public final String getFileCharset() {
+       protected final String getFileCharset() {
                return fileCharset;
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java
index 810139c..7b543c5 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserSession.java
@@ -12,6 +12,8 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.parser;
 
+import static org.apache.juneau.parser.ReaderParser.*;
+
 import java.io.*;
 
 import org.apache.juneau.*;
@@ -80,7 +82,33 @@ public abstract class ReaderParserSession extends 
ParserSession {
        @SuppressWarnings("resource")
        @Override /* ParserSesson */
        public final ParserPipe createPipe(Object input) {
-               return setPipe(new ParserPipe(input, isDebug(), ctx.isStrict(), 
ctx.isAutoCloseStreams(), ctx.isUnbuffered(), ctx.getFileCharset(), 
ctx.getInputStreamCharset()));
+               return setPipe(new ParserPipe(input, isDebug(), ctx.isStrict(), 
ctx.isAutoCloseStreams(), ctx.isUnbuffered(), getFileCharset(), 
getInputStreamCharset()));
+       }
+
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Properties
+       
//-----------------------------------------------------------------------------------------------------------------
+
+       /**
+        * Configuration property:  Input stream charset.
+        *
+        * @see #RPARSER_inputStreamCharset
+        * @return
+        *      The character set to use for converting 
<code>InputStreams</code> and byte arrays to readers.
+        */
+       protected final String getInputStreamCharset() {
+               return ctx.getInputStreamCharset();
+       }
+
+       /**
+        * Configuration property:  File charset.
+        *
+        * @see #RPARSER_fileCharset
+        * @return
+        *      The character set to use for reading <code>Files</code> from 
the file system.
+        */
+       protected final String getFileCharset() {
+               return ctx.getFileCharset();
        }
 
        @Override /* Session */
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 6462371..0054489 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
@@ -225,7 +225,7 @@ public class UonParser extends ReaderParser {
         *      <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 final boolean isDecodeChars() {
+       protected final boolean isDecodeChars() {
                return decodeChars;
        }
 
@@ -237,7 +237,7 @@ public class UonParser extends ReaderParser {
         *      <jk>true</jk> if after parsing a POJO from the input, verifies 
that the remaining input in
         *      the stream consists of only comments or whitespace.
         */
-       public final boolean isValidateEnd() {
+       protected final boolean isValidateEnd() {
                return validateEnd;
        }
 
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 37041e6..517e825 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
@@ -750,7 +750,7 @@ public class UonParserSession extends ReaderParserSession {
         * remainder in the input, that it consists only of whitespace and 
comments.
         */
        private void validateEnd(UonReader r) throws Exception {
-               if (! ctx.isValidateEnd())
+               if (! isValidateEnd())
                        return;
                while (true) {
                        int c = r.read();
@@ -785,4 +785,32 @@ public class UonParserSession extends ReaderParserSession {
                        return (UonReader)r;
                return new UonReader(pipe, decodeChars);
        }
+
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Properties
+       
//-----------------------------------------------------------------------------------------------------------------
+
+       /**
+        * Configuration property: Decode <js>"%xx"</js> sequences.
+        *
+        * @see #UON_decoding
+        * @return
+        *      <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.
+        */
+       protected final boolean isDecodeChars() {
+               return decodeChars;
+       }
+
+       /**
+        * Configuration property:  Validate end.
+        *
+        * @see #UON_validateEnd
+        * @return
+        *      <jk>true</jk> if after parsing a POJO from the input, verifies 
that the remaining input in
+        *      the stream consists of only comments or whitespace.
+        */
+       protected final boolean isValidateEnd() {
+               return ctx.isValidateEnd();
+       }
 }
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 d33845d..4915d5c 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
@@ -168,7 +168,7 @@ public class UrlEncodingParser extends UonParser {
         * <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>.
         */
-       public final boolean isExpandedParams() {
+       protected final boolean isExpandedParams() {
                return expandedParams;
        }
 
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 d1af782..625c626 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.*;
 
@@ -63,7 +65,7 @@ public class UrlEncodingParserSession extends 
UonParserSession {
        public final boolean shouldUseExpandedParams(BeanPropertyMeta pMeta) {
                ClassMeta<?> cm = 
pMeta.getClassMeta().getSerializedClassMeta(this);
                if (cm.isCollectionOrArray()) {
-                       if (ctx.isExpandedParams())
+                       if (isExpandedParams())
                                return true;
                        if 
(pMeta.getBeanMeta().getClassMeta().getExtendedMeta(UrlEncodingClassMeta.class).isExpandedParams())
                                return true;
@@ -357,4 +359,20 @@ public class UrlEncodingParserSession extends 
UonParserSession {
 
                return null; // Unreachable.
        }
+
+       
//--------------------------------------------------------------------------------
+       // Properties
+       
//--------------------------------------------------------------------------------
+
+       /**
+        * Configuration property:  Parser 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/XmlParser.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
index a8effec..e576d36 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
@@ -261,7 +261,7 @@ public class XmlParser extends ReaderParser {
         * @return
         *      <jk>true</jk> if XML document will be validated.
         */
-       public final boolean isValidating() {
+       protected final boolean isValidating() {
                return validating;
        }
 
@@ -273,7 +273,7 @@ public class XmlParser extends ReaderParser {
         *      <jk>true</jk> if when parsing into a generic {@link ObjectMap}, 
the map will contain a single entry whose key
         *      is the root element name.
         */
-       public final boolean isPreserveRootElement() {
+       protected final boolean isPreserveRootElement() {
                return preserveRootElement;
        }
 
@@ -284,7 +284,7 @@ public class XmlParser extends ReaderParser {
         * @return
         *      The {@link XMLReporter} associated with this parser, or 
<jk>null</jk> if there isn't one.
         */
-       public final XMLReporter getReporter() {
+       protected final XMLReporter getReporter() {
                return reporter;
        }
 
@@ -295,7 +295,7 @@ public class XmlParser extends ReaderParser {
         * @return
         *      The {@link XMLResolver} associated with this parser, or 
<jk>null</jk> if there isn't one.
         */
-       public final XMLResolver getResolver() {
+       protected final XMLResolver getResolver() {
                return resolver;
        }
 
@@ -306,7 +306,7 @@ public class XmlParser extends ReaderParser {
         * @return
         *      The {@link XMLEventAllocator} associated with this parser, or 
<jk>null</jk> if there isn't one.
         */
-       public final XMLEventAllocator getEventAllocator() {
+       protected final XMLEventAllocator getEventAllocator() {
                return eventAllocator;
        }
 
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 93c3eb4..7b97286 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
@@ -12,6 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.xml;
 
+import static org.apache.juneau.xml.XmlParser.*;
 import static javax.xml.stream.XMLStreamConstants.*;
 import static org.apache.juneau.internal.StringUtils.*;
 import static org.apache.juneau.xml.annotation.XmlFormat.*;
@@ -20,6 +21,7 @@ import java.lang.reflect.*;
 import java.util.*;
 
 import javax.xml.stream.*;
+import javax.xml.stream.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.parser.*;
@@ -70,7 +72,7 @@ public class XmlParserSession extends ReaderParserSession {
         * @throws Exception If problem occurred trying to create reader.
         */
        protected final XmlReader getXmlReader(ParserPipe pipe) throws 
Exception {
-               return new XmlReader(pipe, ctx.isValidating(), 
ctx.getReporter(), ctx.getResolver(), ctx.getEventAllocator());
+               return new XmlReader(pipe, isValidating(), getReporter(), 
getResolver(), getEventAllocator());
        }
 
        /**
@@ -280,7 +282,7 @@ public class XmlParserSession extends ReaderParserSession {
                        sType = eType;
                setCurrentClass(sType);
 
-               String wrapperAttr = (isRoot && ctx.isPreserveRootElement()) ? 
r.getName().getLocalPart() : null;
+               String wrapperAttr = (isRoot && isPreserveRootElement()) ? 
r.getName().getLocalPart() : null;
                String typeAttr = r.getAttributeValue(null, 
getBeanTypePropertyName(eType));
                int jsonType = getJsonType(typeAttr);
                String elementName = getElementName(r);
@@ -680,4 +682,63 @@ public class XmlParserSession extends ReaderParserSession {
                }
                return s;
        }
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Properties
+       
//-----------------------------------------------------------------------------------------------------------------
+
+       /**
+        * Configuration property:  Enable validation.
+        *
+        * @see #XML_validating
+        * @return
+        *      <jk>true</jk> if XML document will be validated.
+        */
+       protected final boolean isValidating() {
+               return ctx.isValidating();
+       }
+
+       /**
+        * Configuration property:  Preserve root element during generalized 
parsing.
+        *
+        * @see #XML_preserveRootElement
+        * @return
+        *      <jk>true</jk> if when parsing into a generic {@link ObjectMap}, 
the map will contain a single entry whose key
+        *      is the root element name.
+        */
+       protected final boolean isPreserveRootElement() {
+               return ctx.isPreserveRootElement();
+       }
+
+       /**
+        * Configuration property:  XML reporter.
+        *
+        * @see #XML_reporter
+        * @return
+        *      The {@link XMLReporter} associated with this parser, or 
<jk>null</jk> if there isn't one.
+        */
+       protected final XMLReporter getReporter() {
+               return ctx.getReporter();
+       }
+
+       /**
+        * Configuration property:  XML resolver.
+        *
+        * @see #XML_resolver
+        * @return
+        *      The {@link XMLResolver} associated with this parser, or 
<jk>null</jk> if there isn't one.
+        */
+       protected final XMLResolver getResolver() {
+               return ctx.getResolver();
+       }
+
+       /**
+        * Configuration property:  XML event allocator.
+        *
+        * @see #XML_eventAllocator
+        * @return
+        *      The {@link XMLEventAllocator} associated with this parser, or 
<jk>null</jk> if there isn't one.
+        */
+       protected final XMLEventAllocator getEventAllocator() {
+               return ctx.getEventAllocator();
+       }
 }

Reply via email to