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:46 UTC
[1/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
Repository: incubator-juneau
Updated Branches:
refs/heads/master 2c4b7cedc -> d22f1b266
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
index 66a0f65..69bcc4b 100644
--- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
+++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
@@ -13,8 +13,9 @@
package org.apache.juneau.rest.client;
import static org.apache.juneau.internal.StringUtils.*;
-import static org.apache.juneau.parser.ParserContext.*;
-import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.parser.Parser.*;
+import static org.apache.juneau.serializer.Serializer.*;
+import static org.apache.juneau.uon.UonSerializer.*;
import java.lang.reflect.*;
import java.net.*;
@@ -909,211 +910,211 @@ public class RestClientBuilder extends CoreObjectBuilder {
//--------------------------------------------------------------------------------
/**
- * Sets the {@link SerializerContext#SERIALIZER_maxDepth} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_maxDepth} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_maxDepth
+ * @see Serializer#SERIALIZER_maxDepth
*/
public RestClientBuilder maxDepth(int value) {
return property(SERIALIZER_maxDepth, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_initialDepth} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_initialDepth} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_initialDepth
+ * @see Serializer#SERIALIZER_initialDepth
*/
public RestClientBuilder initialDepth(int value) {
return property(SERIALIZER_initialDepth, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_detectRecursions} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_detectRecursions} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_detectRecursions
+ * @see Serializer#SERIALIZER_detectRecursions
*/
public RestClientBuilder detectRecursions(boolean value) {
return property(SERIALIZER_detectRecursions, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_ignoreRecursions} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_ignoreRecursions} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_ignoreRecursions
+ * @see Serializer#SERIALIZER_ignoreRecursions
*/
public RestClientBuilder ignoreRecursions(boolean value) {
return property(SERIALIZER_ignoreRecursions, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_useWhitespace} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_useWhitespace} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_useWhitespace
+ * @see Serializer#SERIALIZER_useWhitespace
*/
public RestClientBuilder useWhitespace(boolean value) {
return property(SERIALIZER_useWhitespace, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_maxIndent} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_maxIndent} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_maxIndent
+ * @see Serializer#SERIALIZER_maxIndent
*/
public RestClientBuilder maxIndent(boolean value) {
return property(SERIALIZER_maxIndent, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_addBeanTypeProperties} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_addBeanTypeProperties} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_addBeanTypeProperties
+ * @see Serializer#SERIALIZER_addBeanTypeProperties
*/
public RestClientBuilder addBeanTypeProperties(boolean value) {
return property(SERIALIZER_addBeanTypeProperties, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_quoteChar} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_quoteChar} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_quoteChar
+ * @see Serializer#SERIALIZER_quoteChar
*/
public RestClientBuilder quoteChar(char value) {
return property(SERIALIZER_quoteChar, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimNullProperties} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimNullProperties} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimNullProperties
+ * @see Serializer#SERIALIZER_trimNullProperties
*/
public RestClientBuilder trimNullProperties(boolean value) {
return property(SERIALIZER_trimNullProperties, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimEmptyCollections} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimEmptyCollections} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimEmptyCollections
+ * @see Serializer#SERIALIZER_trimEmptyCollections
*/
public RestClientBuilder trimEmptyCollections(boolean value) {
return property(SERIALIZER_trimEmptyCollections, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimEmptyMaps} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimEmptyMaps} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimEmptyMaps
+ * @see Serializer#SERIALIZER_trimEmptyMaps
*/
public RestClientBuilder trimEmptyMaps(boolean value) {
return property(SERIALIZER_trimEmptyMaps, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimStrings} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimStrings} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimStrings
+ * @see Serializer#SERIALIZER_trimStrings
*/
public RestClientBuilder trimStrings(boolean value) {
return property(SERIALIZER_trimStrings, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_uriContext} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_uriContext} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriContext
+ * @see Serializer#SERIALIZER_uriContext
*/
public RestClientBuilder uriContext(UriContext value) {
return property(SERIALIZER_uriContext, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_uriResolution} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_uriResolution} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriResolution
+ * @see Serializer#SERIALIZER_uriResolution
*/
public RestClientBuilder uriResolution(UriResolution value) {
return property(SERIALIZER_uriResolution, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_uriRelativity} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_uriRelativity} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriRelativity
+ * @see Serializer#SERIALIZER_uriRelativity
*/
public RestClientBuilder uriRelativity(UriRelativity value) {
return property(SERIALIZER_uriRelativity, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_sortCollections} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_sortCollections} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortCollections
+ * @see Serializer#SERIALIZER_sortCollections
*/
public RestClientBuilder sortCollections(boolean value) {
return property(SERIALIZER_sortCollections, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_sortMaps} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_sortMaps} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortMaps
+ * @see Serializer#SERIALIZER_sortMaps
*/
public RestClientBuilder sortMaps(boolean value) {
return property(SERIALIZER_sortMaps, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_abridged} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_abridged} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_abridged
+ * @see Serializer#SERIALIZER_abridged
*/
public RestClientBuilder abridged(boolean value) {
return property(SERIALIZER_abridged, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_listener} and {@link ParserContext#PARSER_listener} property on all
+ * Sets the {@link Serializer#SERIALIZER_listener} and {@link Parser#PARSER_listener} property on all
* serializers and parsers in this group.
*
* @param sl The new serializer listener.
* @param pl The new parser listener.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_abridged
+ * @see Serializer#SERIALIZER_abridged
*/
public RestClientBuilder listeners(Class<? extends SerializerListener> sl, Class<? extends ParserListener> pl) {
property(SERIALIZER_listener, sl);
@@ -1122,44 +1123,44 @@ public class RestClientBuilder extends CoreObjectBuilder {
}
/**
- * Sets the {@link ParserContext#PARSER_trimStrings} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_trimStrings} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_trimStrings
+ * @see Parser#PARSER_trimStrings
*/
public RestClientBuilder trimStringsP(boolean value) {
return property(PARSER_trimStrings, value);
}
/**
- * Sets the {@link ParserContext#PARSER_strict} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_strict} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_strict
+ * @see Parser#PARSER_strict
*/
public RestClientBuilder strict(boolean value) {
return property(PARSER_strict, value);
}
/**
- * Sets the {@link ParserContext#PARSER_inputStreamCharset} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_inputStreamCharset} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_inputStreamCharset
+ * @see Parser#PARSER_inputStreamCharset
*/
public RestClientBuilder inputStreamCharset(String value) {
return property(PARSER_inputStreamCharset, value);
}
/**
- * Sets the {@link ParserContext#PARSER_fileCharset} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_fileCharset} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_fileCharset
+ * @see Parser#PARSER_fileCharset
*/
public RestClientBuilder fileCharset(String value) {
return property(PARSER_fileCharset, value);
@@ -1180,7 +1181,7 @@ public class RestClientBuilder extends CoreObjectBuilder {
}
/**
- * Sets the {@link UonSerializerContext#UON_paramFormat} property on the URL-encoding serializers in this group.
+ * Sets the {@link UonSerializer#UON_paramFormat} property on the URL-encoding serializers in this group.
*
* <p>
* This overrides the behavior of the URL-encoding serializer to quote and escape characters in query names and
@@ -1188,10 +1189,10 @@ public class RestClientBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see UonSerializerContext#UON_paramFormat
+ * @see UonSerializer#UON_paramFormat
*/
public RestClientBuilder paramFormat(String value) {
- super.property(UonSerializerContext.UON_paramFormat, value);
+ super.property(UON_paramFormat, value);
return this;
}
@@ -1218,7 +1219,7 @@ public class RestClientBuilder extends CoreObjectBuilder {
* @return This object (for method chaining).
*/
public RestClientBuilder plainTextParts() {
- super.property(UonSerializerContext.UON_paramFormat, "PLAINTEXT");
+ super.property(UON_paramFormat, "PLAINTEXT");
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java
index 2eab1ec..0c877ba 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.rest;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import java.util.*;
import java.util.regex.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
index 30c2180..a9f5f02 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -15,8 +15,9 @@ package org.apache.juneau.rest;
import static java.util.Collections.*;
import static java.util.logging.Level.*;
import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import static org.apache.juneau.internal.IOUtils.*;
+import static org.apache.juneau.serializer.Serializer.*;
import java.io.*;
import java.lang.reflect.*;
@@ -68,7 +69,7 @@ import org.apache.juneau.utils.*;
* Refer to <a class="doclink" href="package-summary.html#TOC">REST Servlet API</a> for information about using this
* class.
*/
-@SuppressWarnings("unchecked")
+@SuppressWarnings({ "unchecked", "unused" })
public final class RestRequest extends HttpServletRequestWrapper {
private final RestContext context;
@@ -206,7 +207,7 @@ public final class RestRequest extends HttpServletRequestWrapper {
}
if (isPlainText())
- this.properties.put(SerializerContext.SERIALIZER_useWhitespace, true);
+ this.properties.put(SERIALIZER_useWhitespace, true);
}
/**
@@ -264,17 +265,17 @@ public final class RestRequest extends HttpServletRequestWrapper {
* <js>"HtmlDocSerializer"</js>
* <br>Valid names:
* <ul>
- * <li><js>"aside"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_aside}
- * <li><js>"footer"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_footer}
- * <li><js>"header"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_header}
- * <li><js>"navlinks.list"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_navlinks}
- * <li><js>"nav"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_nav}
- * <li><js>"noResultsMessage"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_noResultsMessage}
- * <li><js>"nowrap"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_nowrap}
- * <li><js>"script.list"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_script}
- * <li><js>"style.list"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_style}
- * <li><js>"stylesheet"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_stylesheet}
- * <li><js>"template"</js> - See {@link HtmlDocSerializerContext#HTMLDOC_template}
+ * <li><js>"aside"</js> - See {@link HtmlDocSerializer#HTMLDOC_aside}
+ * <li><js>"footer"</js> - See {@link HtmlDocSerializer#HTMLDOC_footer}
+ * <li><js>"header"</js> - See {@link HtmlDocSerializer#HTMLDOC_header}
+ * <li><js>"navlinks.list"</js> - See {@link HtmlDocSerializer#HTMLDOC_navlinks}
+ * <li><js>"nav"</js> - See {@link HtmlDocSerializer#HTMLDOC_nav}
+ * <li><js>"noResultsMessage"</js> - See {@link HtmlDocSerializer#HTMLDOC_noResultsMessage}
+ * <li><js>"nowrap"</js> - See {@link HtmlDocSerializer#HTMLDOC_nowrap}
+ * <li><js>"script.list"</js> - See {@link HtmlDocSerializer#HTMLDOC_script}
+ * <li><js>"style.list"</js> - See {@link HtmlDocSerializer#HTMLDOC_style}
+ * <li><js>"stylesheet"</js> - See {@link HtmlDocSerializer#HTMLDOC_stylesheet}
+ * <li><js>"template"</js> - See {@link HtmlDocSerializer#HTMLDOC_template}
* </ul>
* <li>
* <js>"Path"</js> - Value returned by {@link RestRequest#getPath(String)}.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServletDefault.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServletDefault.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServletDefault.java
index 3d47e5d..4e06f7b 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServletDefault.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServletDefault.java
@@ -13,7 +13,7 @@
package org.apache.juneau.rest;
import static org.apache.juneau.http.HttpMethodName.*;
-import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.serializer.Serializer.*;
import org.apache.juneau.dto.swagger.*;
import org.apache.juneau.html.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html
index 6def29e..2c57456 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/package.html
@@ -3096,7 +3096,7 @@
<td class='code'>&plainText=true</td>
<td>
Response will always be <l>Content-Type: text/plain</l> and the returned text will be human-readable
- ({@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_useWhitespace} enabled).
+ ({@link org.apache.juneau.serializer.Serializer#SERIALIZER_useWhitespace} enabled).
<br>Useful for debugging.
</td>
</tr>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 769f716..7de6669 100644
--- a/pom.xml
+++ b/pom.xml
@@ -168,7 +168,7 @@
<windowtitle>${project.name} ${project.version}</windowtitle>
<author>true</author>
<linksource>true</linksource>
- <source>1.6</source>
+ <source>1.7</source>
<bootclasspath>${sun.boot.class.path}</bootclasspath>
<overview>${basedir}/juneau-doc/src/main/javadoc/overview.html</overview>
<stylesheetfile>${basedir}/juneau-doc/src/main/javadoc/javadoc.css</stylesheetfile>
[7/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
Posted by ja...@apache.org.
Move configuration properties to serializer and parser classes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/d22f1b26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/d22f1b26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/d22f1b26
Branch: refs/heads/master
Commit: d22f1b2660fe5c640cbe8956ae7d5f74d7dee27c
Parents: 2c4b7ce
Author: JamesBognar <ja...@apache.org>
Authored: Thu Oct 19 21:49:33 2017 -0400
Committer: JamesBognar <ja...@apache.org>
Committed: Thu Oct 19 21:49:33 2017 -0400
----------------------------------------------------------------------
.../org/apache/juneau/ini/ConfigSource.java | 74 +++
.../org/apache/juneau/ini/ConfigSource.java.off | 74 ---
.../org/apache/juneau/ini/ConfigSourceFile.java | 133 ++++
.../apache/juneau/ini/ConfigSourceFile.java.off | 133 ----
.../apache/juneau/ini/ConfigSourceMemory.java | 131 ++++
.../juneau/ini/ConfigSourceMemory.java.off | 131 ----
.../apache/juneau/ini/ConfigSourceSettings.java | 104 +++
.../juneau/ini/ConfigSourceSettings.java.off | 104 ---
.../a/rttests/RoundTripTrimStringsTest.java | 2 +-
.../apache/juneau/jena/CommonParserTest.java | 2 +-
.../java/org/apache/juneau/jena/CommonTest.java | 2 +-
.../org/apache/juneau/jena/CommonXmlTest.java | 2 +-
.../org/apache/juneau/jena/RdfParserTest.java | 2 +-
.../java/org/apache/juneau/jena/RdfTest.java | 2 +-
.../juneau/transforms/CalendarSwapTest.java | 6 +-
.../org/apache/juneau/xml/XmlContentTest.java | 2 +-
.../java/org/apache/juneau/jena/Constants.java | 4 +-
.../java/org/apache/juneau/jena/RdfCommon.java | 646 +++++++++++++++++++
.../apache/juneau/jena/RdfCommonContext.java | 646 -------------------
.../java/org/apache/juneau/jena/RdfParser.java | 41 +-
.../apache/juneau/jena/RdfParserBuilder.java | 21 +-
.../apache/juneau/jena/RdfParserContext.java | 52 +-
.../apache/juneau/jena/RdfParserSession.java | 5 +-
.../org/apache/juneau/jena/RdfSerializer.java | 117 +++-
.../juneau/jena/RdfSerializerBuilder.java | 27 +-
.../juneau/jena/RdfSerializerContext.java | 125 +---
.../juneau/jena/RdfSerializerSession.java | 11 +-
.../java/org/apache/juneau/jena/package.html | 16 +-
.../java/org/apache/juneau/BeanContext.java | 12 +-
.../java/org/apache/juneau/BeanSession.java | 4 +-
.../org/apache/juneau/CoreObjectBuilder.java | 2 +-
.../java/org/apache/juneau/annotation/URI.java | 2 +-
.../java/org/apache/juneau/csv/CsvParser.java | 9 +
.../org/apache/juneau/csv/CsvParserContext.java | 21 +-
.../org/apache/juneau/csv/CsvSerializer.java | 9 +
.../apache/juneau/csv/CsvSerializerContext.java | 21 +-
.../java/org/apache/juneau/html/AnchorText.java | 2 +-
.../apache/juneau/html/HtmlDocSerializer.java | 469 +++++++++++++-
.../juneau/html/HtmlDocSerializerContext.java | 477 +-------------
.../juneau/html/HtmlDocSerializerSession.java | 46 +-
.../java/org/apache/juneau/html/HtmlParser.java | 15 +-
.../apache/juneau/html/HtmlParserContext.java | 22 +-
.../juneau/html/HtmlSchemaDocSerializer.java | 2 -
.../org/apache/juneau/html/HtmlSerializer.java | 129 +++-
.../juneau/html/HtmlSerializerBuilder.java | 18 +-
.../juneau/html/HtmlSerializerContext.java | 128 +---
.../juneau/html/HtmlSerializerSession.java | 10 +-
.../java/org/apache/juneau/jso/JsoParser.java | 8 +
.../org/apache/juneau/jso/JsoSerializer.java | 9 +
.../java/org/apache/juneau/json/JsonParser.java | 22 +-
.../apache/juneau/json/JsonParserContext.java | 22 +-
.../juneau/json/JsonSchemaSerializer.java | 2 -
.../org/apache/juneau/json/JsonSerializer.java | 87 ++-
.../juneau/json/JsonSerializerBuilder.java | 6 +-
.../juneau/json/JsonSerializerContext.java | 83 +--
.../juneau/json/JsonSerializerSession.java | 6 +-
.../java/org/apache/juneau/json/package.html | 4 +-
.../apache/juneau/msgpack/MsgPackParser.java | 15 +-
.../juneau/msgpack/MsgPackParserContext.java | 22 +-
.../juneau/msgpack/MsgPackSerializer.java | 48 +-
.../msgpack/MsgPackSerializerContext.java | 49 +-
.../msgpack/MsgPackSerializerSession.java | 6 +-
.../java/org/apache/juneau/parser/Parser.java | 130 +++-
.../org/apache/juneau/parser/ParserBuilder.java | 12 +-
.../org/apache/juneau/parser/ParserContext.java | 120 +---
.../juneau/parser/ParserGroupBuilder.java | 22 +-
.../org/apache/juneau/parser/ParserSession.java | 22 +-
.../juneau/plaintext/PlainTextParser.java | 15 +-
.../juneau/plaintext/PlainTextSerializer.java | 17 +-
.../apache/juneau/serializer/Serializer.java | 397 ++++++++++++
.../juneau/serializer/SerializerBuilder.java | 43 +-
.../juneau/serializer/SerializerContext.java | 394 +----------
.../serializer/SerializerGroupBuilder.java | 78 +--
.../juneau/serializer/SerializerSession.java | 64 +-
.../juneau/serializer/SerializerWriter.java | 8 +-
.../apache/juneau/soap/SoapXmlSerializer.java | 30 +-
.../juneau/soap/SoapXmlSerializerBuilder.java | 4 +-
.../juneau/soap/SoapXmlSerializerContext.java | 39 +-
.../juneau/soap/SoapXmlSerializerSession.java | 2 +-
.../java/org/apache/juneau/uon/ParamFormat.java | 2 +-
.../java/org/apache/juneau/uon/UonParser.java | 47 +-
.../org/apache/juneau/uon/UonParserBuilder.java | 4 +-
.../org/apache/juneau/uon/UonParserContext.java | 43 +-
.../org/apache/juneau/uon/UonParserSession.java | 4 +-
.../org/apache/juneau/uon/UonSerializer.java | 90 ++-
.../apache/juneau/uon/UonSerializerBuilder.java | 6 +-
.../apache/juneau/uon/UonSerializerContext.java | 90 +--
.../apache/juneau/uon/UonSerializerSession.java | 10 +-
.../java/org/apache/juneau/uon/package.html | 4 +-
.../juneau/urlencoding/UrlEncodingParser.java | 42 +-
.../urlencoding/UrlEncodingParserBuilder.java | 7 +-
.../urlencoding/UrlEncodingParserContext.java | 31 +-
.../urlencoding/UrlEncodingParserSession.java | 4 +-
.../urlencoding/UrlEncodingSerializer.java | 68 +-
.../UrlEncodingSerializerBuilder.java | 12 +-
.../UrlEncodingSerializerContext.java | 47 +-
.../UrlEncodingSerializerSession.java | 5 +-
.../urlencoding/annotation/UrlEncoding.java | 4 +-
.../org/apache/juneau/urlencoding/package.html | 4 +-
.../org/apache/juneau/xml/XmlDocSerializer.java | 11 +-
.../java/org/apache/juneau/xml/XmlParser.java | 123 +++-
.../org/apache/juneau/xml/XmlParserBuilder.java | 12 +-
.../org/apache/juneau/xml/XmlParserContext.java | 123 +---
.../org/apache/juneau/xml/XmlParserSession.java | 3 +-
.../apache/juneau/xml/XmlSchemaSerializer.java | 10 +-
.../org/apache/juneau/xml/XmlSerializer.java | 165 ++++-
.../apache/juneau/xml/XmlSerializerBuilder.java | 22 +-
.../apache/juneau/xml/XmlSerializerContext.java | 162 +----
.../apache/juneau/xml/XmlSerializerSession.java | 6 +-
.../java/org/apache/juneau/xml/package.html | 6 +-
.../apache/juneau/yaml/proto/YamlParser.java | 22 +-
.../juneau/yaml/proto/YamlParserContext.java | 22 +-
.../juneau/yaml/proto/YamlSerializer.java | 81 ++-
.../yaml/proto/YamlSerializerBuilder.java | 10 +-
.../yaml/proto/YamlSerializerContext.java | 91 +--
.../yaml/proto/YamlSerializerSession.java | 8 +-
.../org/apache/juneau/yaml/proto/package.html | 4 +-
juneau-doc/src/main/javadoc/overview.html | 103 ++-
.../juneau/examples/rest/AtomFeedResource.java | 6 +-
.../juneau/examples/rest/DirectoryResource.java | 2 +-
.../juneau/examples/rest/PhotosResource.java | 2 +-
.../examples/rest/RequestEchoResource.java | 2 +-
.../examples/rest/SystemPropertiesResource.java | 2 +-
.../rest/addressbook/AddressBookResource.java | 6 +-
.../examples/rest/AddressBookResourceTest.java | 2 +-
.../SampleRemoteableServicesResourceTest.java | 2 +-
.../resources/DirectoryResource.java | 2 +-
.../microservice/resources/LogsResource.java | 2 +-
.../apache/juneau/rest/test/ParamsResource.java | 4 +-
.../juneau/rest/client/RestClientBuilder.java | 105 +--
.../org/apache/juneau/rest/HtmlDocBuilder.java | 2 +-
.../org/apache/juneau/rest/RestRequest.java | 29 +-
.../apache/juneau/rest/RestServletDefault.java | 2 +-
.../java/org/apache/juneau/rest/package.html | 2 +-
pom.xml | 2 +-
135 files changed, 3638 insertions(+), 3843 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java
new file mode 100644
index 0000000..a8a337a
--- /dev/null
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java
@@ -0,0 +1,74 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.ini;
+
+/**
+ * Represents a storage location of a configuration file.
+ */
+public abstract class ConfigSource {
+
+ /** The path of the config file. */
+ private final ConfigSourceSettings settings;
+
+ /**
+ * Constructor.
+ *
+ * @param settings
+ * The settings for this config source.
+ */
+ protected ConfigSource(ConfigSourceSettings settings) {
+ this.settings = settings;
+ }
+
+ /**
+ * Returns the name of the config file.
+ *
+ * @return The name of the config file.
+ */
+ protected final ConfigSourceSettings getSettings() {
+ return settings;
+ }
+
+ /**
+ * Returns the contents of the configuration file.
+ *
+ * @param name The config file name.
+ * @return The contents of the configuration file.
+ * @throws Exception
+ */
+ protected abstract String read(String name) throws Exception;
+
+ /**
+ * Saves the contents of the configuration file if the underlying storage hasn't been modified.
+ *
+ * @param name The config file name.
+ * @param contents The new contents of the configuration file.
+ * @return <jk>true</jk> if we successfully saved the new configuration file contents, or <jk>false</jk> if the
+ * underlying storage changed since the last time the {@link #read(String)} method was called.
+ * @throws Exception
+ */
+ protected abstract boolean write(String name, String contents) throws Exception;
+
+ /**
+ * Returns whether the underlying configuration contents have changed.
+ *
+ * <p>
+ * For example, if the configuration source is a file, this method would return <jk>true</jk> if the
+ * file on the filesystem has been modified since the {@link #read(String)} method was called.
+ *
+ * @param name The config file name.
+ * @return <jk>true</jk> if the persisted contents of the config file have changed.
+ * @throws Exception
+ */
+ protected abstract boolean hasBeenModified(String name) throws Exception;
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java.off
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java.off b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java.off
deleted file mode 100644
index a8a337a..0000000
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSource.java.off
+++ /dev/null
@@ -1,74 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.ini;
-
-/**
- * Represents a storage location of a configuration file.
- */
-public abstract class ConfigSource {
-
- /** The path of the config file. */
- private final ConfigSourceSettings settings;
-
- /**
- * Constructor.
- *
- * @param settings
- * The settings for this config source.
- */
- protected ConfigSource(ConfigSourceSettings settings) {
- this.settings = settings;
- }
-
- /**
- * Returns the name of the config file.
- *
- * @return The name of the config file.
- */
- protected final ConfigSourceSettings getSettings() {
- return settings;
- }
-
- /**
- * Returns the contents of the configuration file.
- *
- * @param name The config file name.
- * @return The contents of the configuration file.
- * @throws Exception
- */
- protected abstract String read(String name) throws Exception;
-
- /**
- * Saves the contents of the configuration file if the underlying storage hasn't been modified.
- *
- * @param name The config file name.
- * @param contents The new contents of the configuration file.
- * @return <jk>true</jk> if we successfully saved the new configuration file contents, or <jk>false</jk> if the
- * underlying storage changed since the last time the {@link #read(String)} method was called.
- * @throws Exception
- */
- protected abstract boolean write(String name, String contents) throws Exception;
-
- /**
- * Returns whether the underlying configuration contents have changed.
- *
- * <p>
- * For example, if the configuration source is a file, this method would return <jk>true</jk> if the
- * file on the filesystem has been modified since the {@link #read(String)} method was called.
- *
- * @param name The config file name.
- * @return <jk>true</jk> if the persisted contents of the config file have changed.
- * @throws Exception
- */
- protected abstract boolean hasBeenModified(String name) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java
new file mode 100644
index 0000000..723c03b
--- /dev/null
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java
@@ -0,0 +1,133 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.ini;
+
+import java.io.*;
+import java.nio.channels.*;
+import java.nio.charset.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import org.apache.juneau.internal.*;
+
+/**
+ * Implementation of a configuration source that's a file on the local file system.
+ */
+public class ConfigSourceFile extends ConfigSource {
+
+ private ConcurrentHashMap<String,CacheEntry> cache = new ConcurrentHashMap<>();
+
+ /**
+ * Constructor.
+ *
+ * @param settings
+ * The settings for this config source.
+ */
+ public ConfigSourceFile(ConfigSourceSettings settings) {
+ super(settings);
+ }
+
+ @Override /* ConfigSource */
+ public synchronized String read(String name) throws Exception {
+ CacheEntry fe = cache.get(name);
+
+ if (fe == null || fe.hasBeenModified()) {
+ File f = findFile(name);
+ try (FileInputStream fis = new FileInputStream(f)) {
+ try (FileLock lock = fis.getChannel().lock()) {
+ try (Reader r = new InputStreamReader(fis, Charset.defaultCharset())) {
+ String contents = IOUtils.read(r);
+ long lastModified = f.lastModified();
+ fe = new CacheEntry(f, lastModified, contents);
+ cache.put(name, fe);
+ }
+ }
+ }
+ }
+
+ return fe.contents;
+ }
+
+ @Override /* ConfigSource */
+ public synchronized boolean write(String name, String contents) throws Exception {
+ if (hasBeenModified(name))
+ return false;
+
+ CacheEntry fe = cache.get(name);
+ File f = fe != null ? fe.file : findFile(name);
+
+ try (FileOutputStream fos = new FileOutputStream(f)) {
+ try (FileLock lock = fos.getChannel().lock()) {
+ if (hasBeenModified(name))
+ return false;
+ try (Writer w = new OutputStreamWriter(fos, Charset.defaultCharset())) {
+ IOUtils.pipe(contents, w);
+ }
+ fe = new CacheEntry(f, f.lastModified(), contents);
+ cache.put(name, fe);
+ return true;
+ }
+ }
+ }
+
+ @Override /* ConfigSource */
+ public boolean hasBeenModified(String name) throws Exception {
+ CacheEntry fe = cache.get(name);
+ return (fe != null && fe.hasBeenModified());
+ }
+
+ private static class CacheEntry {
+ final File file;
+ final long lastModified;
+ final String contents;
+
+ CacheEntry(File file, long lastModified, String contents) {
+ this.file = file;
+ this.lastModified = lastModified;
+ this.contents = contents;
+ }
+
+ boolean hasBeenModified() {
+ return file.lastModified() != lastModified;
+ }
+ }
+
+ private File findFile(String name) throws IOException {
+
+ List<String> searchPaths = getSettings().getSearchPaths();
+
+ if (searchPaths.isEmpty())
+ throw new FileNotFoundException("No search paths specified in ConfigFileBuilder.");
+
+ // Handle paths relative to search paths.
+ for (String sp : searchPaths) {
+ File pf = new File(sp);
+ File f = new File(pf, name);
+ if (f.exists())
+ return f;
+ }
+
+ if (getSettings().isCreateIfNotExists()) {
+ for (String sf : searchPaths) {
+ File pf = new File(sf);
+ if (pf.exists() && pf.isDirectory() && pf.canWrite()) {
+ File f = new File(pf, name);
+ if (f.createNewFile())
+ return f;
+ }
+ }
+ }
+
+ throw new FileNotFoundException("Could not find config file '"+name+"'");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java.off
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java.off b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java.off
deleted file mode 100644
index 723c03b..0000000
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceFile.java.off
+++ /dev/null
@@ -1,133 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.ini;
-
-import java.io.*;
-import java.nio.channels.*;
-import java.nio.charset.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import org.apache.juneau.internal.*;
-
-/**
- * Implementation of a configuration source that's a file on the local file system.
- */
-public class ConfigSourceFile extends ConfigSource {
-
- private ConcurrentHashMap<String,CacheEntry> cache = new ConcurrentHashMap<>();
-
- /**
- * Constructor.
- *
- * @param settings
- * The settings for this config source.
- */
- public ConfigSourceFile(ConfigSourceSettings settings) {
- super(settings);
- }
-
- @Override /* ConfigSource */
- public synchronized String read(String name) throws Exception {
- CacheEntry fe = cache.get(name);
-
- if (fe == null || fe.hasBeenModified()) {
- File f = findFile(name);
- try (FileInputStream fis = new FileInputStream(f)) {
- try (FileLock lock = fis.getChannel().lock()) {
- try (Reader r = new InputStreamReader(fis, Charset.defaultCharset())) {
- String contents = IOUtils.read(r);
- long lastModified = f.lastModified();
- fe = new CacheEntry(f, lastModified, contents);
- cache.put(name, fe);
- }
- }
- }
- }
-
- return fe.contents;
- }
-
- @Override /* ConfigSource */
- public synchronized boolean write(String name, String contents) throws Exception {
- if (hasBeenModified(name))
- return false;
-
- CacheEntry fe = cache.get(name);
- File f = fe != null ? fe.file : findFile(name);
-
- try (FileOutputStream fos = new FileOutputStream(f)) {
- try (FileLock lock = fos.getChannel().lock()) {
- if (hasBeenModified(name))
- return false;
- try (Writer w = new OutputStreamWriter(fos, Charset.defaultCharset())) {
- IOUtils.pipe(contents, w);
- }
- fe = new CacheEntry(f, f.lastModified(), contents);
- cache.put(name, fe);
- return true;
- }
- }
- }
-
- @Override /* ConfigSource */
- public boolean hasBeenModified(String name) throws Exception {
- CacheEntry fe = cache.get(name);
- return (fe != null && fe.hasBeenModified());
- }
-
- private static class CacheEntry {
- final File file;
- final long lastModified;
- final String contents;
-
- CacheEntry(File file, long lastModified, String contents) {
- this.file = file;
- this.lastModified = lastModified;
- this.contents = contents;
- }
-
- boolean hasBeenModified() {
- return file.lastModified() != lastModified;
- }
- }
-
- private File findFile(String name) throws IOException {
-
- List<String> searchPaths = getSettings().getSearchPaths();
-
- if (searchPaths.isEmpty())
- throw new FileNotFoundException("No search paths specified in ConfigFileBuilder.");
-
- // Handle paths relative to search paths.
- for (String sp : searchPaths) {
- File pf = new File(sp);
- File f = new File(pf, name);
- if (f.exists())
- return f;
- }
-
- if (getSettings().isCreateIfNotExists()) {
- for (String sf : searchPaths) {
- File pf = new File(sf);
- if (pf.exists() && pf.isDirectory() && pf.canWrite()) {
- File f = new File(pf, name);
- if (f.createNewFile())
- return f;
- }
- }
- }
-
- throw new FileNotFoundException("Could not find config file '"+name+"'");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java
new file mode 100644
index 0000000..9f73675
--- /dev/null
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java
@@ -0,0 +1,131 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.ini;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Implementation of a configuration source entirely in memory.
+ */
+public class ConfigSourceMemory extends ConfigSource {
+
+ private static final ConcurrentHashMap<String,MemoryFile> MEMORY = new ConcurrentHashMap<>();
+
+ private ConcurrentHashMap<String,CacheEntry> cache = new ConcurrentHashMap<>();
+
+ /**
+ * Constructor.
+ *
+ * @param settings
+ * The settings for this config source.
+ */
+ public ConfigSourceMemory(ConfigSourceSettings settings) {
+ super(settings);
+ }
+
+ @Override /* ConfigSource */
+ public synchronized String read(String name) throws Exception {
+ CacheEntry ce = cache.get(name);
+
+ if (ce == null || ce.hasBeenModified()) {
+ MemoryFile f = findFile(name);
+ synchronized(f) {
+ ce = new CacheEntry(f, f.lastModified, f.contents);
+ cache.put(name, ce);
+ }
+ }
+
+ return ce.contents;
+ }
+
+ @Override /* ConfigSource */
+ public synchronized boolean write(String name, String contents) throws Exception {
+ if (hasBeenModified(name))
+ return false;
+
+ CacheEntry ce = cache.get(name);
+ MemoryFile f = ce != null ? ce.file : findFile(name);
+
+ synchronized(f) {
+ if (hasBeenModified(name))
+ return false;
+ f.contents = contents;
+ f.lastModified = System.currentTimeMillis();
+ ce = new CacheEntry(f, f.lastModified, f.contents);
+ cache.put(name, ce);
+ }
+
+ return true;
+ }
+
+ @Override /* ConfigSource */
+ public boolean hasBeenModified(String name) throws Exception {
+ CacheEntry ce = cache.get(name);
+ return (ce != null && ce.hasBeenModified());
+ }
+
+ private MemoryFile findFile(String name) throws IOException {
+
+ List<String> searchPaths = getSettings().getSearchPaths();
+
+ if (searchPaths.isEmpty())
+ throw new FileNotFoundException("No search paths specified in ConfigFileBuilder.");
+
+ // Handle paths relative to search paths.
+ for (String sp : searchPaths) {
+ String pf = sp + '/' + name;
+ MemoryFile mf = MEMORY.get(pf);
+ if (mf != null)
+ return mf;
+ }
+
+ if (getSettings().isCreateIfNotExists()) {
+ for (String sf : searchPaths) {
+ String path = sf + '/' + name;
+ MemoryFile mf = new MemoryFile("");
+ MEMORY.putIfAbsent(path, mf);
+ return MEMORY.get(path);
+ }
+ }
+
+ throw new FileNotFoundException("Could not find config file '"+name+"'");
+ }
+
+ private static class MemoryFile {
+ private String contents;
+ private long lastModified;
+
+ private MemoryFile(String contents) {
+ this.contents = contents;
+ this.lastModified = System.currentTimeMillis();
+ }
+ }
+
+ private static class CacheEntry {
+ final MemoryFile file;
+ final long lastModified;
+ final String contents;
+
+ CacheEntry(MemoryFile file, long lastModified, String contents) {
+ this.file = file;
+ this.lastModified = lastModified;
+ this.contents = contents;
+ }
+
+ boolean hasBeenModified() {
+ return file.lastModified != lastModified;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java.off
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java.off b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java.off
deleted file mode 100644
index 9f73675..0000000
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceMemory.java.off
+++ /dev/null
@@ -1,131 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.ini;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-/**
- * Implementation of a configuration source entirely in memory.
- */
-public class ConfigSourceMemory extends ConfigSource {
-
- private static final ConcurrentHashMap<String,MemoryFile> MEMORY = new ConcurrentHashMap<>();
-
- private ConcurrentHashMap<String,CacheEntry> cache = new ConcurrentHashMap<>();
-
- /**
- * Constructor.
- *
- * @param settings
- * The settings for this config source.
- */
- public ConfigSourceMemory(ConfigSourceSettings settings) {
- super(settings);
- }
-
- @Override /* ConfigSource */
- public synchronized String read(String name) throws Exception {
- CacheEntry ce = cache.get(name);
-
- if (ce == null || ce.hasBeenModified()) {
- MemoryFile f = findFile(name);
- synchronized(f) {
- ce = new CacheEntry(f, f.lastModified, f.contents);
- cache.put(name, ce);
- }
- }
-
- return ce.contents;
- }
-
- @Override /* ConfigSource */
- public synchronized boolean write(String name, String contents) throws Exception {
- if (hasBeenModified(name))
- return false;
-
- CacheEntry ce = cache.get(name);
- MemoryFile f = ce != null ? ce.file : findFile(name);
-
- synchronized(f) {
- if (hasBeenModified(name))
- return false;
- f.contents = contents;
- f.lastModified = System.currentTimeMillis();
- ce = new CacheEntry(f, f.lastModified, f.contents);
- cache.put(name, ce);
- }
-
- return true;
- }
-
- @Override /* ConfigSource */
- public boolean hasBeenModified(String name) throws Exception {
- CacheEntry ce = cache.get(name);
- return (ce != null && ce.hasBeenModified());
- }
-
- private MemoryFile findFile(String name) throws IOException {
-
- List<String> searchPaths = getSettings().getSearchPaths();
-
- if (searchPaths.isEmpty())
- throw new FileNotFoundException("No search paths specified in ConfigFileBuilder.");
-
- // Handle paths relative to search paths.
- for (String sp : searchPaths) {
- String pf = sp + '/' + name;
- MemoryFile mf = MEMORY.get(pf);
- if (mf != null)
- return mf;
- }
-
- if (getSettings().isCreateIfNotExists()) {
- for (String sf : searchPaths) {
- String path = sf + '/' + name;
- MemoryFile mf = new MemoryFile("");
- MEMORY.putIfAbsent(path, mf);
- return MEMORY.get(path);
- }
- }
-
- throw new FileNotFoundException("Could not find config file '"+name+"'");
- }
-
- private static class MemoryFile {
- private String contents;
- private long lastModified;
-
- private MemoryFile(String contents) {
- this.contents = contents;
- this.lastModified = System.currentTimeMillis();
- }
- }
-
- private static class CacheEntry {
- final MemoryFile file;
- final long lastModified;
- final String contents;
-
- CacheEntry(MemoryFile file, long lastModified, String contents) {
- this.file = file;
- this.lastModified = lastModified;
- this.contents = contents;
- }
-
- boolean hasBeenModified() {
- return file.lastModified != lastModified;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java
new file mode 100644
index 0000000..7a72bae
--- /dev/null
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java
@@ -0,0 +1,104 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.ini;
+
+import java.nio.charset.*;
+import java.util.*;
+
+/**
+ * Configuration settings for the {@link ConfigSource} class.
+ */
+public class ConfigSourceSettings {
+
+ private final List<String> searchPaths;
+ private final Charset charset;
+ private final boolean readonly, createIfNotExists;
+
+ @SuppressWarnings("hiding")
+ static class Builder {
+ private List<String> searchPaths = Arrays.asList(new String[]{"."});
+ private Charset charset = Charset.defaultCharset();
+ private boolean readonly = false, createIfNotExists = true;
+
+ Builder searchPaths(String[] searchPaths) {
+ this.searchPaths = Arrays.asList(searchPaths);
+ return this;
+ }
+
+ Builder charset(Charset charset) {
+ this.charset = charset;
+ return this;
+ }
+
+ Builder readonly(boolean readonly) {
+ this.readonly = readonly;
+ return this;
+ }
+
+ Builder createIfNotExists(boolean createIfNotExists) {
+ this.createIfNotExists = createIfNotExists;
+ return this;
+ }
+
+ ConfigSourceSettings build() {
+ return new ConfigSourceSettings(this);
+ }
+ }
+
+ ConfigSourceSettings(Builder b) {
+ this.searchPaths = b.searchPaths;
+ this.charset = b.charset;
+ this.readonly = b.readonly;
+ this.createIfNotExists = b.createIfNotExists;
+ }
+
+ /**
+ * Returns the paths to search to find config files.
+ *
+ * @return The paths to search to find config files.
+ */
+ public List<String> getSearchPaths() {
+ return searchPaths;
+ }
+
+ /**
+ * Returns the charset of the config file.
+ *
+ * @return The charset of the config file.
+ */
+ public Charset getCharset() {
+ return charset;
+ }
+
+ /**
+ * Specifies whether the config file should be opened in read-only mode.
+ *
+ * @return <jk>true</jk> if the config file should be opened in read-only mode.
+ */
+ public boolean isReadonly() {
+ return readonly;
+ }
+
+ /**
+ * Specifies whether config files should be created if they're not found in the search paths.
+ *
+ * <p>
+ * Note that the first writable path will be used for the location of the file.
+ *
+ * @return <jk>true</jk> if the config file should be created if not found.
+ */
+ public boolean isCreateIfNotExists() {
+ return createIfNotExists;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java.off
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java.off b/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java.off
deleted file mode 100644
index 7a72bae..0000000
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/ini/ConfigSourceSettings.java.off
+++ /dev/null
@@ -1,104 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.ini;
-
-import java.nio.charset.*;
-import java.util.*;
-
-/**
- * Configuration settings for the {@link ConfigSource} class.
- */
-public class ConfigSourceSettings {
-
- private final List<String> searchPaths;
- private final Charset charset;
- private final boolean readonly, createIfNotExists;
-
- @SuppressWarnings("hiding")
- static class Builder {
- private List<String> searchPaths = Arrays.asList(new String[]{"."});
- private Charset charset = Charset.defaultCharset();
- private boolean readonly = false, createIfNotExists = true;
-
- Builder searchPaths(String[] searchPaths) {
- this.searchPaths = Arrays.asList(searchPaths);
- return this;
- }
-
- Builder charset(Charset charset) {
- this.charset = charset;
- return this;
- }
-
- Builder readonly(boolean readonly) {
- this.readonly = readonly;
- return this;
- }
-
- Builder createIfNotExists(boolean createIfNotExists) {
- this.createIfNotExists = createIfNotExists;
- return this;
- }
-
- ConfigSourceSettings build() {
- return new ConfigSourceSettings(this);
- }
- }
-
- ConfigSourceSettings(Builder b) {
- this.searchPaths = b.searchPaths;
- this.charset = b.charset;
- this.readonly = b.readonly;
- this.createIfNotExists = b.createIfNotExists;
- }
-
- /**
- * Returns the paths to search to find config files.
- *
- * @return The paths to search to find config files.
- */
- public List<String> getSearchPaths() {
- return searchPaths;
- }
-
- /**
- * Returns the charset of the config file.
- *
- * @return The charset of the config file.
- */
- public Charset getCharset() {
- return charset;
- }
-
- /**
- * Specifies whether the config file should be opened in read-only mode.
- *
- * @return <jk>true</jk> if the config file should be opened in read-only mode.
- */
- public boolean isReadonly() {
- return readonly;
- }
-
- /**
- * Specifies whether config files should be created if they're not found in the search paths.
- *
- * <p>
- * Note that the first writable path will be used for the location of the file.
- *
- * @return <jk>true</jk> if the config file should be created if not found.
- */
- public boolean isCreateIfNotExists() {
- return createIfNotExists;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
index dfac4fe..567281a 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
@@ -20,7 +20,7 @@ import org.apache.juneau.serializer.*;
import org.junit.*;
/**
- * Tests for the {@link SerializerContext#SERIALIZER_trimStrings} and {@link ParserContext#PARSER_trimStrings}.
+ * Tests for the {@link Serializer#SERIALIZER_trimStrings} and {@link Parser#PARSER_trimStrings}.
*/
@SuppressWarnings("javadoc")
public class RoundTripTrimStringsTest extends RoundTripTest {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
index f424533..8bb87cb 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonParserTest.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.jena;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
import static org.junit.Assert.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
index adbf317..845198d 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
@@ -13,7 +13,7 @@
package org.apache.juneau.jena;
import static org.apache.juneau.TestUtils.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
import static org.junit.Assert.*;
import java.net.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
index 00ccbb7..fcb03e3 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonXmlTest.java
@@ -13,7 +13,7 @@
package org.apache.juneau.jena;
import static org.apache.juneau.TestUtils.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
import static org.junit.Assert.*;
import java.net.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
index 1f1002c..cbb43cb 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfParserTest.java
@@ -13,7 +13,7 @@
package org.apache.juneau.jena;
import static org.apache.juneau.TestUtils.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
import static org.junit.Assert.*;
import java.net.URI;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
index 840e272..b9ca944 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/RdfTest.java
@@ -13,7 +13,7 @@
package org.apache.juneau.jena;
import static org.apache.juneau.TestUtils.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
import java.net.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
index e7a9b27..e29a286 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/transforms/CalendarSwapTest.java
@@ -55,9 +55,9 @@ public class CalendarSwapTest {
return new RdfSerializerBuilder()
.sq()
.useWhitespace(false)
- .property(RdfCommonContext.RDF_rdfxml_allowBadUris, true)
- .property(RdfCommonContext.RDF_rdfxml_showDoctypeDeclaration, false)
- .property(RdfCommonContext.RDF_rdfxml_showXmlDeclaration, false)
+ .property(RdfCommon.RDF_rdfxml_allowBadUris, true)
+ .property(RdfCommon.RDF_rdfxml_showDoctypeDeclaration, false)
+ .property(RdfCommon.RDF_rdfxml_showXmlDeclaration, false)
.build();
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlContentTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlContentTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlContentTest.java
index 21f778a..c6210d6 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlContentTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlContentTest.java
@@ -13,7 +13,7 @@
package org.apache.juneau.xml;
import static org.apache.juneau.TestUtils.*;
-import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.serializer.Serializer.*;
import static org.apache.juneau.xml.annotation.XmlFormat.*;
import static org.junit.Assert.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/Constants.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/Constants.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/Constants.java
index 2920b5d..852dc20 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/Constants.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/Constants.java
@@ -59,7 +59,7 @@ public final class Constants {
* Property added to root nodes to help identify them as root elements during parsing.
*
* <p>
- * Added if {@link RdfSerializerContext#RDF_addRootProperty} setting is enabled.
+ * Added if {@link RdfSerializer#RDF_addRootProperty} setting is enabled.
*/
public static final String RDF_juneauNs_ROOT = "root";
@@ -70,7 +70,7 @@ public final class Constants {
* Property added to bean resources to identify the class type.
*
* <p>
- * Added if {@link SerializerContext#SERIALIZER_addBeanTypeProperties} setting is enabled.
+ * Added if {@link Serializer#SERIALIZER_addBeanTypeProperties} setting is enabled.
*/
public static final String RDF_juneauNs_TYPE = "_type";
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java
new file mode 100644
index 0000000..d959c0d
--- /dev/null
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommon.java
@@ -0,0 +1,646 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.jena;
+
+import java.util.*;
+
+import org.apache.juneau.jena.annotation.*;
+import org.apache.juneau.utils.*;
+import org.apache.juneau.xml.*;
+import org.apache.juneau.xml.annotation.*;
+
+/**
+ * Configurable properties common to both the {@link RdfSerializer} and {@link RdfParser} classes.
+ */
+public interface RdfCommon {
+
+ /**
+ * Maps RDF writer names to property prefixes that apply to them.
+ */
+ final static Map<String,String> LANG_PROP_MAP = new AMap<String,String>()
+ .append("RDF/XML","rdfXml.")
+ .append("RDF/XML-ABBREV","rdfXml.")
+ .append("N3","n3.")
+ .append("N3-PP","n3.")
+ .append("N3-PLAIN","n3.")
+ .append("N3-TRIPLES","n3.")
+ .append("TURTLE","n3.")
+ .append("N-TRIPLE","ntriple.");
+
+ /**
+ * <b>Configuration property:</b> RDF language.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.language"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"RDF/XML-ABBREV"</js>
+ * </ul>
+ *
+ * <p>
+ * Can be any of the following:
+ * <ul class='spaced-list'>
+ * <li>
+ * <js>"RDF/XML"</js>
+ * <li>
+ * <js>"RDF/XML-ABBREV"</js>
+ * <li>
+ * <js>"N-TRIPLE"</js>
+ * <li>
+ * <js>"N3"</js> - General name for the N3 writer.
+ * Will make a decision on exactly which writer to use (pretty writer, plain writer or simple writer) when
+ * created.
+ * Default is the pretty writer but can be overridden with system property
+ * <code>com.hp.hpl.jena.n3.N3JenaWriter.writer</code>.
+ * <li>
+ * <js>"N3-PP"</js> - Name of the N3 pretty writer.
+ * The pretty writer uses a frame-like layout, with prefixing, clustering like properties and embedding
+ * one-referenced bNodes.
+ * <li>
+ * <js>"N3-PLAIN"</js> - Name of the N3 plain writer.
+ * The plain writer writes records by subject.
+ * <li>
+ * <js>"N3-TRIPLES"</js> - Name of the N3 triples writer.
+ * This writer writes one line per statement, like N-Triples, but does N3-style prefixing.
+ * <li>
+ * <js>"TURTLE"</js> - Turtle writer.
+ * http://www.dajobe.org/2004/01/turtle/
+ * </ul>
+ */
+ public static final String RDF_language = "Rdf.language";
+
+ /**
+ * <b>Configuration property:</b> XML namespace for Juneau properties.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.juneauNs"</js>
+ * <li><b>Data type:</b> {@link Namespace}
+ * <li><b>Default:</b> <code>{j:<js>'http://www.apache.org/juneau/'</js>}</code>
+ * </ul>
+ */
+ public static final String RDF_juneauNs = "Rdf.juneauNs";
+
+ /**
+ * <b>Configuration property:</b> Default XML namespace for bean properties.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.juneauBpNs"</js>
+ * <li><b>Data type:</b> {@link Namespace}
+ * <li><b>Default:</b> <code>{j:<js>'http://www.apache.org/juneaubp/'</js>}</code>
+ * </ul>
+ */
+ public static final String RDF_juneauBpNs = "Rdf.juneauBpNs";
+
+ /**
+ * <b>Configuration property:</b> Reuse XML namespaces when RDF namespaces not specified.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.useXmlNamespaces"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * When specified, namespaces defined using {@link XmlNs} and {@link Xml} will be inherited by the RDF serializers.
+ * Otherwise, namespaces will be defined using {@link RdfNs} and {@link Rdf}.
+ */
+ public static final String RDF_useXmlNamespaces = "Rdf.useXmlNamespaces";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>iri_rules</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.iri-rules"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"lax"</js>
+ * </ul>
+ *
+ * <p>
+ * Set the engine for checking and resolving.
+ *
+ * <p>
+ * Possible values:
+ * <ul class='spaced-list'>
+ * <li>
+ * <js>"lax"</js> - The rules for RDF URI references only, which does permit spaces although the use of spaces
+ * is not good practice.
+ * <li>
+ * <js>"strict"</js> - Sets the IRI engine with rules for valid IRIs, XLink and RDF; it does not permit spaces
+ * in IRIs.
+ * <li>
+ * <js>"iri"</js> - Sets the IRI engine to IRI
+ * (<a class="doclink" href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>,
+ * <a class="doclink" href="http://www.ietf.org/rfc/rfc3987.txt">RFC 3987</a>).
+ * </ul>
+ */
+ public static final String RDF_arp_iriRules = "Rdf.jena.rdfXml.iri-rules";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML ARP property: <code>error-mode</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.error-mode"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"lax"</js>
+ * </ul>
+ *
+ * <p>
+ * This allows a coarse-grained approach to control of error handling.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"default"</js>
+ * <li><js>"lax"</js>
+ * <li><js>"strict"</js>
+ * <li><js>"strict-ignore"</js>
+ * <li><js>"strict-warning"</js>
+ * <li><js>"strict-error"</js>
+ * <li><js>"strict-fatal"</js>
+ * </ul>
+ *
+ * <p>
+ * See also:
+ * <ul class='spaced-list'>
+ * <li>
+ * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setDefaultErrorMode()">ARPOptions.setDefaultErrorMode()</a>
+ * <li>
+ * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setLaxErrorMode()">ARPOptions.setLaxErrorMode()</a>
+ * <li>
+ * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setStrictErrorMode()">ARPOptions.setStrictErrorMode()</a>
+ * <li>
+ * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setStrictErrorMode(int)">ARPOptions.setStrictErrorMode(int)</a>
+ * </ul>
+ */
+ public static final String RDF_arp_errorMode = "Rdf.jena.rdfXml.error-mode";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML ARP property: <code>embedding</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.embedding"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * </ul>
+ *
+ * <p>
+ * Sets ARP to look for RDF embedded within an enclosing XML document.
+ *
+ * <p>
+ * See also:
+ * <ul class='spaced-list'>
+ * <li>
+ * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setEmbedding(boolean)">ARPOptions.setEmbedding(boolean)</a>
+ * </ul>
+ */
+ public static final String RDF_arp_embedding = "Rdf.jena.rdfXml.embedding";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML ARP property: <code>ERR_xxx</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.ERR_"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * </ul>
+ *
+ * <p>
+ * Provides fine-grained control over detected error conditions.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"EM_IGNORE"</js>
+ * <li><js>"EM_WARNING"</js>
+ * <li><js>"EM_ERROR"</js>
+ * <li><js>"EM_FATAL"</js>
+ * </ul>
+ *
+ * <p>
+ * See also:
+ * <ul class='spaced-list'>
+ * <li>
+ * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPErrorNumbers.html">ARPErrorNumbers</a>
+ * <li>
+ * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setErrorMode(int,%20int)">ARPOptions.setErrorMode(int, int)</a>
+ * </ul>
+ */
+ public static final String RDF_arp_err_ = "Rdf.jena.rdfXml.ERR_";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML ARP property: <code>WARN_xxx</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.WARN_"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * </ul>
+ *
+ * <p>
+ * See {@link #RDF_arp_err_} for details.
+ */
+ public static final String RDF_arp_warn_ = "Rdf.jena.rdfXml.WARN_";
+
+ /**
+ * RDF/XML ARP property: <code>IGN_xxx</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.IGN_"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * </ul>
+ *
+ * <p>
+ * See {@link #RDF_arp_err_} for details.
+ */
+ public static final String RDF_arp_ign_ = "Rdf.jena.rdfXml.IGN_";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>xmlbase</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.xmlbase"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <jk>null</jk>
+ * </ul>
+ *
+ * <p>
+ * The value to be included for an <xa>xml:base</xa> attribute on the root element in the file.
+ */
+ public static final String RDF_rdfxml_xmlBase = "Rdf.jena.rdfXml.xmlbase";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>longId</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.longId"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * </ul>
+ *
+ * <p>
+ * Whether to use long ID's for anon resources.
+ * Short ID's are easier to read, but can run out of memory on very large models.
+ */
+ public static final String RDF_rdfxml_longId = "Rdf.jena.rdfXml.longId";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>allowBadURIs</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.allowBadURIs"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * </ul>
+ *
+ * <p>
+ * URIs in the graph are, by default, checked prior to serialization.
+ */
+ public static final String RDF_rdfxml_allowBadUris = "Rdf.jena.rdfXml.allowBadURIs";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>relativeURIs</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.relativeURIs"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"same-document, absolute, relative, parent"</js>
+ * </ul>
+ *
+ * <p>
+ * What sort of relative URIs should be used.
+ *
+ * <p>
+ * A comma separate list of options:
+ * <ul class='spaced-list'>
+ * <li>
+ * <js>"same-document"</js> - Same-document references (e.g. <js>""</js> or <js>"#foo"</js>)
+ * <li>
+ * <js>"network"</js> - Network paths (e.g. <js>"//example.org/foo"</js> omitting the URI scheme)
+ * <li>
+ * <js>"absolute"</js> - Absolute paths (e.g. <js>"/foo"</js> omitting the scheme and authority)
+ * <li>
+ * <js>"relative"</js> - Relative path not beginning in <js>"../"</js>
+ * <li>
+ * <js>"parent"</js> - Relative path beginning in <js>"../"</js>
+ * <li>
+ * <js>"grandparent"</js> - Relative path beginning in <js>"../../"</js>
+ * </ul>
+ *
+ * <p>
+ * The default value is <js>"same-document, absolute, relative, parent"</js>.
+ * To switch off relative URIs use the value <js>""</js>.
+ * Relative URIs of any of these types are output where possible if and only if the option has been specified.
+ */
+ public static final String RDF_rdfxml_relativeUris = "Rdf.jena.rdfXml.relativeURIs";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>showXmlDeclaration</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.showXmlDeclaration"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"default"</js>
+ * </ul>
+ *
+ * <p>
+ * Possible values:
+ * <ul class='spaced-list'>
+ * <li>
+ * <js>"true"</js> - Add XML Declaration to the output.
+ * <li>
+ * <js>"false"</js> - Don't add XML Declaration to the output.
+ * <li>
+ * <js>"default"</js> - Only add an XML Declaration when asked to write to an <code>OutputStreamWriter</code>
+ * that uses some encoding other than <code>UTF-8</code> or <code>UTF-16</code>.
+ * In this case the encoding is shown in the XML declaration.
+ * </ul>
+ */
+ public static final String RDF_rdfxml_showXmlDeclaration = "Rdf.jena.rdfXml.showXmlDeclaration";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>showDoctypeDeclaration</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.showDoctypeDeclaration"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * If true, an XML doctype declaration is included in the output.
+ * This declaration includes a <code>!ENTITY</code> declaration for each prefix mapping in the model, and any
+ * attribute value that starts with the URI of that mapping is written as starting with the corresponding entity
+ * invocation.
+ */
+ public static final String RDF_rdfxml_showDoctypeDeclaration = "Rdf.jena.rdfXml.showDoctypeDeclaration";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>tab</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.tab"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>2</code>
+ * </ul>
+ *
+ * <p>
+ * The number of spaces with which to indent XML child elements.
+ */
+ public static final String RDF_rdfxml_tab = "Rdf.jena.rdfXml.tab";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>attributeQuoteChar</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.attributeQuoteChar"</js>
+ * <li><b>Data type:</b> <code>Character</code>
+ * <li><b>Default:</b> <js>'"'</js>
+ * </ul>
+ *
+ * <p>
+ * The XML attribute quote character.
+ */
+ public static final String RDF_rdfxml_attributeQuoteChar = "Rdf.jena.rdfXml.attributeQuoteChar";
+
+ /**
+ * <b>Configuration property:</b> RDF/XML property: <code>blockRules</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.blockRules"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>""</js>
+ * </ul>
+ *
+ * <p>
+ * A list of <code>Resource</code> or a <code>String</code> being a comma separated list of fragment IDs from
+ * <a class="doclink" href="http://www.w3.org/TR/rdf-syntax-grammar">RDF Syntax Grammar</a> indicating grammar
+ * rules that will not be used.
+ */
+ public static final String RDF_rdfxml_blockRules = "Rdf.jena.rdfXml.blockRules";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>minGap</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.minGap"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>1</code>
+ * </ul>
+ *
+ * <p>
+ * Minimum gap between items on a line.
+ */
+ public static final String RDF_n3_minGap = "Rdf.jena.n3.minGap";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>objectLists</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.objectLists"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Print object lists as comma separated lists.
+ */
+ public static final String RDF_n3_objectLists = "Rdf.jena.n3.objectLists";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>subjectColumn</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.subjectColumn"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> indentProperty
+ * </ul>
+ *
+ * <p>
+ * If the subject is shorter than this value, the first property may go on the same line.
+ */
+ public static final String RDF_n3_subjectColumn = "Rdf.jena.n3.subjectColumn";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>propertyColumn</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.propertyColumn"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>8</code>
+ * </ul>
+ *
+ * <p>
+ * Width of the property column.
+ */
+ public static final String RDF_n3_propertyColumn = "Rdf.jena.n3.propertyColumn";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>indentProperty</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.indentProperty"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>6</code>
+ * </ul>
+ *
+ * <p>
+ * Width to indent properties.
+ */
+ public static final String RDF_n3_indentProperty = "Rdf.jena.n3.indentProperty";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>widePropertyLen</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.widePropertyLen"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>20</code>
+ * </ul>
+ *
+ * <p>
+ * Width of the property column.
+ * Must be longer than <code>propertyColumn</code>.
+ */
+ public static final String RDF_n3_widePropertyLen = "Rdf.jena.n3.widePropertyLen";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>abbrevBaseURI</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.abbrevBaseURI"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Control whether to use abbreviations <code><></code> or <code><#></code>.
+ */
+ public static final String RDF_n3_abbrevBaseUri = "Rdf.jena.n3.abbrevBaseURI";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>usePropertySymbols</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.usePropertySymbols"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Control whether to use <code>a</code>, <code>=</code> and <code>=></code> in output
+ */
+ public static final String RDF_n3_usePropertySymbols = "Rdf.jena.n3.usePropertySymbols";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>useTripleQuotedStrings</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.useTripleQuotedStrings"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Allow the use of <code>"""</code> to delimit long strings.
+ */
+ public static final String RDF_n3_useTripleQuotedStrings = "Rdf.jena.n3.useTripleQuotedStrings";
+
+ /**
+ * <b>Configuration property:</b> N3/Turtle property: <code>useDoubles</code>.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.jena.n3.useDoubles"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Allow the use doubles as <code>123.456</code>.
+ */
+ public static final String RDF_n3_useDoubles = "Rdf.jena.n3.useDoubles";
+
+ /**
+ * <b>Configuration property:</b> RDF format for representing collections and arrays.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.collectionFormat"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"DEFAULT"</js>
+ * </ul>
+ *
+ * <p>
+ * Possible values:
+ * <ul class='spaced-list'>
+ * <li>
+ * <js>"DEFAULT"</js> - Default format. The default is an RDF Sequence container.
+ * <li>
+ * <js>"SEQ"</js> - RDF Sequence container.
+ * <li>
+ * <js>"BAG"</js> - RDF Bag container.
+ * <li>
+ * <js>"LIST"</js> - RDF List container.
+ * <li>
+ * <js>"MULTI_VALUED"</js> - Multi-valued properties.
+ * </ul>
+ *
+ * <h5 class='section'>Notes:</h5>
+ * <ul>
+ * <li>If you use <js>"BAG"</js> or <js>"MULTI_VALUED"</js>, the order of the elements in the collection will get
+ * lost.
+ * </ul>
+ */
+ public static final String RDF_collectionFormat = "Rdf.collectionFormat";
+
+ /**
+ * <b>Configuration property:</b> Collections should be serialized and parsed as loose collections.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Rdf.looseCollections"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>false</jk>
+ * </ul>
+ *
+ * <p>
+ * When specified, 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).
+ *
+ * <p>
+ * Note that this setting is specialized for RDF syntax, and is incompatible with the concept of
+ * losslessly representing POJO models, since the tree structure of these POJO models are lost
+ * when serialized as loose collections.
+ *
+ * <p>
+ * This setting is typically only useful if the beans being parsed into do not have a bean property
+ * annotated with {@link Rdf#beanUri @Rdf(beanUri=true)}.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * WriterSerializer s = <jk>new</jk> RdfSerializerBuilder().xmlabbrev().looseCollections(<jk>true</jk>).build();
+ * ReaderParser p = <jk>new</jk> RdfParserBuilder().xml().looseCollections(<jk>true</jk>).build();
+ *
+ * List<MyBean> l = createListOfMyBeans();
+ *
+ * <jc>// Serialize to RDF/XML as loose resources</jc>
+ * String rdfXml = s.serialize(l);
+ *
+ * <jc>// Parse back into a Java collection</jc>
+ * l = p.parse(rdfXml, LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
+ *
+ * MyBean[] b = createArrayOfMyBeans();
+ *
+ * <jc>// Serialize to RDF/XML as loose resources</jc>
+ * String rdfXml = s.serialize(b);
+ *
+ * <jc>// Parse back into a bean array</jc>
+ * b = p.parse(rdfXml, MyBean[].<jk>class</jk>);
+ * </p>
+ */
+ public static final String RDF_looseCollections = "Rdf.looseCollections";
+}
[5/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializer.java
index 63cfcf2..d99be25 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializer.java
@@ -29,21 +29,478 @@ import org.apache.juneau.serializer.*;
* Same as {@link HtmlSerializer}, except wraps the response in <code><xt><html></code>,
* <code><xt><head></code>, and <code><xt><body></code> tags so that it can be rendered in a browser.
*
- * <h5 class='section'>Configurable properties:</h5>
+ * <p>
+ * Configurable properties are typically specified via <ja>@RestResource.properties()</ja> and <ja>@RestMethod.properties()</ja>
+ * annotations, although they can also be set programmatically via the <code>RestResponse.setProperty()</code> method.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * messages=<js>"nls/AddressBookResource"</js>,
+ * properties={
+ * <ja>@Property</ja>(name=HtmlDocSerializer.<jsf>HTMLDOC_title</jsf>, value=<js>"$L{title}"</js>),
+ * <ja>@Property</ja>(name=HtmlDocSerializer.<jsf>HTMLDOC_description</jsf>, value=<js>"$L{description}"</js>),
+ * <ja>@Property</ja>(name=HtmlDocSerializer.<jsf>HTMLDOC_navlinks</jsf>, value=<js>"{options:'?method=OPTIONS',doc:'doc'}"</js>)
+ * }
+ * )
+ * <jk>public class</jk> AddressBookResource <jk>extends</jk> RestServletJenaDefault {
+ * </p>
+ *
+ * <p>
+ * Note that shortcut annotations are also provided for these particular settings:
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * messages=<js>"nls/AddressBookResource"</js>,
+ * htmldoc=<ja>@HtmlDoc</ja>(
+ * title=<js>"$L{title}"</js>,
+ * description=<js>"$L{description}"</js>,
+ * navlinks={
+ * <js>"options: ?method=OPTIONS"</js>,
+ * <js>"doc: doc"</js>
+ * }
+ * )
+ * )
+ * </p>
*
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link HtmlDocSerializerContext}
- * <li>{@link BeanContext}
- * </ul>
+ * <p>
+ * The <code>$L{...}</code> variable represent localized strings pulled from the resource bundle identified by the
+ * <code>messages</code> annotation.
+ * These variables are replaced at runtime based on the HTTP request locale.
+ * Several built-in runtime variable types are defined, and the API can be extended to include user-defined variables.
*/
@SuppressWarnings("hiding")
public class HtmlDocSerializer extends HtmlStrippedDocSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "HtmlDocSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Header section contents.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.header"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Allows you to override the contents of the header section on the HTML page.
+ * The header section normally contains the title and description at the top of the page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=<ja>@HtmlDoc</ja>(
+ * header={
+ * <js>"<h1>My own header</h1>"</js>
+ * }
+ * )
+ * )
+ * </p>
+ */
+ public static final String HTMLDOC_header = PREFIX + "header.list";
+
+ /**
+ * <b>Configuration property:</b> Page navigation links.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.navlinks.list"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> empty array
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Adds a list of hyperlinks immediately under the title and description but above the content of the page.
+ *
+ * <p>
+ * This can be used to provide convenient hyperlinks when viewing the REST interface from a browser.
+ *
+ * <p>
+ * The value is an array of strings with two possible values:
+ * <ul>
+ * <li>A key-value pair representing a hyperlink label and href:
+ * <br><js>"google: http://google.com"</js>
+ * <li>Arbitrary HTML.
+ * </ul>
+ *
+ * <p>
+ * Relative URLs are considered relative to the servlet path.
+ * For example, if the servlet path is <js>"http://localhost/myContext/myServlet"</js>, and the
+ * URL is <js>"foo"</js>, the link becomes <js>"http://localhost/myContext/myServlet/foo"</js>.
+ * Absolute (<js>"/myOtherContext/foo"</js>) and fully-qualified (<js>"http://localhost2/foo"</js>) URLs
+ * can also be used in addition to various other protocols specified by {@link UriResolver} such as
+ * <js>"servlet:/..."</js>.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p>
+ * The <code>AddressBookResource</code> sample class uses this property...
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * properties={
+ * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_navlinks</jsf>,
+ * value=<js>"['options: ?method=OPTIONS', 'doc: doc']"</js>)
+ * }
+ * )
+ * <jk>public class</jk> AddressBookResource <jk>extends</jk> RestServletJenaDefault {
+ * </p>
+ *
+ * <p>
+ * ...to produce this list of links on the HTML page...
+ * <img class='bordered' src='doc-files/HTML_LINKS.png'>
+ *
+ * <p>
+ * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=@HtmlDoc(
+ * navlinks={
+ * <js>"options: ?method=OPTIONS"</js>,
+ * <js>"doc: doc"</js>
+ * }
+ * )
+ * )
+ * <jk>public class</jk> AddressBookResource <jk>extends</jk> RestServletJenaDefault {
+ * </p>
+ */
+ public static final String HTMLDOC_navlinks = PREFIX + "navlinks.list";
+
+ /**
+ * <b>Configuration property:</b> Add to the {@link #HTMLDOC_navlinks} property.
+ */
+ public static final String HTMLDOC_navlinks_add = PREFIX + "navlinks.list.add";
+
+ /**
+ * <b>Configuration property:</b> Nav section contents.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.nav"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Allows you to override the contents of the nav section on the HTML page.
+ * The nav section normally contains the page links at the top of the page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=<ja>@HtmlDoc</ja>(
+ * nav={
+ * <js>"<p class='special-navigation'>This is my special navigation content</p>"</js>
+ * }
+ * )
+ * )
+ * </p>
+ *
+ * <p>
+ * When this property is specified, the {@link #HTMLDOC_navlinks} property is ignored.
+ */
+ public static final String HTMLDOC_nav = PREFIX + "nav.list";
+
+ /**
+ * <b>Configuration property:</b> Aside section contents.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.aside"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Allows you to specify the contents of the aside section on the HTML page.
+ * The aside section floats on the right of the page for providing content supporting the serialized content of
+ * the page.
+ *
+ * <p>
+ * By default, the aside section is empty.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=<ja>@HtmlDoc</ja>(
+ * aside={
+ * <js>"<ul>"</js>,
+ * <js>" <li>Item 1"</js>,
+ * <js>" <li>Item 2"</js>,
+ * <js>" <li>Item 3"</js>,
+ * <js>"</ul>"</js>
+ * }
+ * )
+ * )
+ * </p>
+ */
+ public static final String HTMLDOC_aside = PREFIX + "aside.list";
+
+ /**
+ * <b>Configuration property:</b> Footer section contents.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.footer"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Allows you to specify the contents of the footer section on the HTML page.
+ *
+ * <p>
+ * By default, the footer section is empty.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=<ja>@HtmlDoc</ja>(
+ * footer={
+ * <js>"<b>This interface is great!</b>"</js>
+ * }
+ * )
+ * )
+ * </p>
+ */
+ public static final String HTMLDOC_footer = PREFIX + "footer.list";
+
+ /**
+ * <b>Configuration property:</b> No-results message.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.noResultsMessage"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"<p>no results</p>"</js>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Allows you to specify the string message used when trying to serialize an empty array or empty list.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=<ja>@HtmlDoc</ja>(
+ * noResultsMessage=<js>"<b>This interface is great!</b>"</js>
+ * )
+ * )
+ * </p>
+ *
+ * <p>
+ * A value of <js>"NONE"</js> can be used to represent no value to differentiate it from an empty string.
+ */
+ public static final String HTMLDOC_noResultsMessage = PREFIX + "noResultsMessage";
+
+ /**
+ * <b>Configuration property:</b> Prevent word wrap on page.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.nowrap"</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>
+ * Adds <js>"* {white-space:nowrap}"</js> to the CSS instructions on the page to prevent word wrapping.
+ */
+ public static final String HTMLDOC_nowrap = PREFIX + "nowrap";
+
+ /**
+ * <b>Configuration property:</b> Stylesheet import URLs.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.stylesheet"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> empty array
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Adds a link to the specified stylesheet URL.
+ *
+ * <p>
+ * Note that this stylesheet is controlled by the <code><ja>@RestResource</ja>.stylesheet()</code> annotation.
+ */
+ public static final String HTMLDOC_stylesheet = PREFIX + "stylesheet.list";
+
+ /**
+ * <b>Configuration property:</b> Add to the {@link #HTMLDOC_stylesheet} property.
+ */
+ public static final String HTMLDOC_stylesheet_add = PREFIX + "stylesheet.list.add";
+
+ /**
+ * <b>Configuration property:</b> CSS style code.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.style.list"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> empty array
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Adds the specified CSS instructions to the HTML page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * properties={
+ * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_style</jsf>,
+ * value=<js>"h3 { color: red; }\nh5 { font-weight: bold; }"</js>)
+ * }
+ * )
+ * </p>
+ *
+ * <p>
+ * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=@HtmlDoc(
+ * style={
+ * <js>"h3 { color: red; }"</js>,
+ * <js>"h5 { font-weight: bold; }"</js>
+ * }
+ * )
+ * )
+ * </p>
+ */
+ public static final String HTMLDOC_style = PREFIX + "style.list";
+
+ /**
+ * <b>Configuration property:</b> Add to the {@link #HTMLDOC_style} property.
+ */
+ public static final String HTMLDOC_style_add = PREFIX + "style.list.add";
+
+ /**
+ * <b>Configuration property:</b> Javascript code.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.script.list"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> empty array
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Adds the specified Javascript code to the HTML page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * properties={
+ * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_script</jsf>,
+ * value=<js>"alert('hello!');"</js>)
+ * }
+ * )
+ * </p>
+ *
+ * <p>
+ * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=@HtmlDoc(
+ * script={
+ * <js>"alert('hello!');"</js>
+ * }
+ * )
+ * )
+ * </p>
+ */
+ public static final String HTMLDOC_script = PREFIX + "script.list";
+
+ /**
+ * <b>Configuration property:</b> Add to the {@link #HTMLDOC_script} property.
+ */
+ public static final String HTMLDOC_script_add = PREFIX + "script.list.add";
+
+ /**
+ * <b>Configuration property:</b> Additional head section content.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.head.list"</js>
+ * <li><b>Data type:</b> <code>String[]</code>
+ * <li><b>Default:</b> empty array
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Adds the specified HTML content to the head section of the page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * properties={
+ * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_links</jsf>,
+ * value=<js>"['<link rel=\"icon\" href=\"htdocs/mypageicon.ico\">']"</js>)
+ * }
+ * )
+ * </p>
+ *
+ * <p>
+ * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=@HtmlDoc(
+ * head={
+ * <js>"<link rel='icon' href='$U{servlet:/htdocs/mypageicon.ico}'>"</js>
+ * }
+ * )
+ * )
+ * </p>
+ */
+ public static final String HTMLDOC_head = PREFIX + "head.list";
+
+ /**
+ * <b>Configuration property:</b> Add to the {@link #HTMLDOC_head} property.
+ */
+ public static final String HTMLDOC_links_add = PREFIX + "head.list.add";
+
+ /**
+ * <b>Configuration property:</b> HTML document template.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlDocSerializer.template"</js>
+ * <li><b>Data type:</b> <code>Class<? <jk>extends</jk> HtmlDocTemplate></code> or {@link HtmlDocTemplate}
+ * <li><b>Default:</b> <code>HtmlDocTemplateBasic.<jk>class</jk></code>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Specifies the template to use for serializing the page.
+ *
+ * <p>
+ * By default, the {@link HtmlDocTemplateBasic} class is used to construct the contents of the HTML page, but
+ * can be overridden with your own custom implementation class.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <ja>@RestResource</ja>(
+ * htmldoc=@HtmlDoc(
+ * template=MySpecialDocTemplate.<jk>class</jk>
+ * )
+ * )
+ * </p>
+ */
+ public static final String HTMLDOC_template = PREFIX + "template";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings. */
public static final HtmlDocSerializer DEFAULT = new HtmlDocSerializer(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
final HtmlDocSerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
index ef2b964..4b6fb1e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerContext.java
@@ -12,486 +12,15 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
+
import org.apache.juneau.*;
/**
- * Properties associated with the {@link HtmlDocSerializer} class.
- *
- * <p>
- * These are typically specified via <ja>@RestResource.properties()</ja> and <ja>@RestMethod.properties()</ja>
- * annotations, although they can also be set programmatically via the <code>RestResponse.setProperty()</code> method.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * messages=<js>"nls/AddressBookResource"</js>,
- * properties={
- * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, value=<js>"$L{title}"</js>),
- * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_description</jsf>, value=<js>"$L{description}"</js>),
- * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_navlinks</jsf>, value=<js>"{options:'?method=OPTIONS',doc:'doc'}"</js>)
- * }
- * )
- * <jk>public class</jk> AddressBookResource <jk>extends</jk> RestServletJenaDefault {
- * </p>
- *
- * <p>
- * Note that shortcut annotations are also provided for these particular settings:
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * messages=<js>"nls/AddressBookResource"</js>,
- * htmldoc=<ja>@HtmlDoc</ja>(
- * title=<js>"$L{title}"</js>,
- * description=<js>"$L{description}"</js>,
- * navlinks={
- * <js>"options: ?method=OPTIONS"</js>,
- * <js>"doc: doc"</js>
- * }
- * )
- * )
- * </p>
- *
- * <p>
- * The <code>$L{...}</code> variable represent localized strings pulled from the resource bundle identified by the
- * <code>messages</code> annotation.
- * These variables are replaced at runtime based on the HTTP request locale.
- * Several built-in runtime variable types are defined, and the API can be extended to include user-defined variables.
- *
- * <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 class='jc'>
- * <a class="doclink" href="../html/HtmlSerializerContext.html#ConfigProperties">HtmlSerializerContext</a>
- * - Configurable properties on the HTML serializer.
- * </ul>
- * </li>
- * </ul>
- * </li>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link HtmlDocSerializer} class.
*/
public final class HtmlDocSerializerContext extends HtmlSerializerContext {
- @SuppressWarnings("hiding")
- static final String PREFIX = "HtmlDocSerializer.";
-
- /**
- * <b>Configuration property:</b> Header section contents.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.header"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Allows you to override the contents of the header section on the HTML page.
- * The header section normally contains the title and description at the top of the page.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=<ja>@HtmlDoc</ja>(
- * header={
- * <js>"<h1>My own header</h1>"</js>
- * }
- * )
- * )
- * </p>
- */
- public static final String HTMLDOC_header = PREFIX + "header.list";
-
- /**
- * <b>Configuration property:</b> Page navigation links.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.navlinks.list"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> empty array
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Adds a list of hyperlinks immediately under the title and description but above the content of the page.
- *
- * <p>
- * This can be used to provide convenient hyperlinks when viewing the REST interface from a browser.
- *
- * <p>
- * The value is an array of strings with two possible values:
- * <ul>
- * <li>A key-value pair representing a hyperlink label and href:
- * <br><js>"google: http://google.com"</js>
- * <li>Arbitrary HTML.
- * </ul>
- *
- * <p>
- * Relative URLs are considered relative to the servlet path.
- * For example, if the servlet path is <js>"http://localhost/myContext/myServlet"</js>, and the
- * URL is <js>"foo"</js>, the link becomes <js>"http://localhost/myContext/myServlet/foo"</js>.
- * Absolute (<js>"/myOtherContext/foo"</js>) and fully-qualified (<js>"http://localhost2/foo"</js>) URLs
- * can also be used in addition to various other protocols specified by {@link UriResolver} such as
- * <js>"servlet:/..."</js>.
- *
- * <h5 class='section'>Example:</h5>
- * <p>
- * The <code>AddressBookResource</code> sample class uses this property...
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * properties={
- * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_navlinks</jsf>,
- * value=<js>"['options: ?method=OPTIONS', 'doc: doc']"</js>)
- * }
- * )
- * <jk>public class</jk> AddressBookResource <jk>extends</jk> RestServletJenaDefault {
- * </p>
- *
- * <p>
- * ...to produce this list of links on the HTML page...
- * <img class='bordered' src='doc-files/HTML_LINKS.png'>
- *
- * <p>
- * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=@HtmlDoc(
- * navlinks={
- * <js>"options: ?method=OPTIONS"</js>,
- * <js>"doc: doc"</js>
- * }
- * )
- * )
- * <jk>public class</jk> AddressBookResource <jk>extends</jk> RestServletJenaDefault {
- * </p>
- */
- public static final String HTMLDOC_navlinks = PREFIX + "navlinks.list";
-
- /**
- * <b>Configuration property:</b> Add to the {@link #HTMLDOC_navlinks} property.
- */
- public static final String HTMLDOC_navlinks_add = PREFIX + "navlinks.list.add";
-
- /**
- * <b>Configuration property:</b> Nav section contents.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.nav"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Allows you to override the contents of the nav section on the HTML page.
- * The nav section normally contains the page links at the top of the page.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=<ja>@HtmlDoc</ja>(
- * nav={
- * <js>"<p class='special-navigation'>This is my special navigation content</p>"</js>
- * }
- * )
- * )
- * </p>
- *
- * <p>
- * When this property is specified, the {@link #HTMLDOC_navlinks} property is ignored.
- */
- public static final String HTMLDOC_nav = PREFIX + "nav.list";
-
- /**
- * <b>Configuration property:</b> Aside section contents.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.aside"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Allows you to specify the contents of the aside section on the HTML page.
- * The aside section floats on the right of the page for providing content supporting the serialized content of
- * the page.
- *
- * <p>
- * By default, the aside section is empty.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=<ja>@HtmlDoc</ja>(
- * aside={
- * <js>"<ul>"</js>,
- * <js>" <li>Item 1"</js>,
- * <js>" <li>Item 2"</js>,
- * <js>" <li>Item 3"</js>,
- * <js>"</ul>"</js>
- * }
- * )
- * )
- * </p>
- */
- public static final String HTMLDOC_aside = PREFIX + "aside.list";
-
- /**
- * <b>Configuration property:</b> Footer section contents.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.footer"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Allows you to specify the contents of the footer section on the HTML page.
- *
- * <p>
- * By default, the footer section is empty.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=<ja>@HtmlDoc</ja>(
- * footer={
- * <js>"<b>This interface is great!</b>"</js>
- * }
- * )
- * )
- * </p>
- */
- public static final String HTMLDOC_footer = PREFIX + "footer.list";
-
- /**
- * <b>Configuration property:</b> No-results message.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.noResultsMessage"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"<p>no results</p>"</js>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Allows you to specify the string message used when trying to serialize an empty array or empty list.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=<ja>@HtmlDoc</ja>(
- * noResultsMessage=<js>"<b>This interface is great!</b>"</js>
- * )
- * )
- * </p>
- *
- * <p>
- * A value of <js>"NONE"</js> can be used to represent no value to differentiate it from an empty string.
- */
- public static final String HTMLDOC_noResultsMessage = PREFIX + "noResultsMessage";
-
- /**
- * <b>Configuration property:</b> Prevent word wrap on page.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.nowrap"</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>
- * Adds <js>"* {white-space:nowrap}"</js> to the CSS instructions on the page to prevent word wrapping.
- */
- public static final String HTMLDOC_nowrap = PREFIX + "nowrap";
-
- /**
- * <b>Configuration property:</b> Stylesheet import URLs.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.stylesheet"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> empty array
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Adds a link to the specified stylesheet URL.
- *
- * <p>
- * Note that this stylesheet is controlled by the <code><ja>@RestResource</ja>.stylesheet()</code> annotation.
- */
- public static final String HTMLDOC_stylesheet = PREFIX + "stylesheet.list";
-
- /**
- * <b>Configuration property:</b> Add to the {@link #HTMLDOC_stylesheet} property.
- */
- public static final String HTMLDOC_stylesheet_add = PREFIX + "stylesheet.list.add";
-
- /**
- * <b>Configuration property:</b> CSS style code.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.style.list"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> empty array
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Adds the specified CSS instructions to the HTML page.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * properties={
- * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_style</jsf>,
- * value=<js>"h3 { color: red; }\nh5 { font-weight: bold; }"</js>)
- * }
- * )
- * </p>
- *
- * <p>
- * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=@HtmlDoc(
- * style={
- * <js>"h3 { color: red; }"</js>,
- * <js>"h5 { font-weight: bold; }"</js>
- * }
- * )
- * )
- * </p>
- */
- public static final String HTMLDOC_style = PREFIX + "style.list";
-
- /**
- * <b>Configuration property:</b> Add to the {@link #HTMLDOC_style} property.
- */
- public static final String HTMLDOC_style_add = PREFIX + "style.list.add";
-
- /**
- * <b>Configuration property:</b> Javascript code.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.script.list"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> empty array
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Adds the specified Javascript code to the HTML page.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * properties={
- * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_script</jsf>,
- * value=<js>"alert('hello!');"</js>)
- * }
- * )
- * </p>
- *
- * <p>
- * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=@HtmlDoc(
- * script={
- * <js>"alert('hello!');"</js>
- * }
- * )
- * )
- * </p>
- */
- public static final String HTMLDOC_script = PREFIX + "script.list";
-
- /**
- * <b>Configuration property:</b> Add to the {@link #HTMLDOC_script} property.
- */
- public static final String HTMLDOC_script_add = PREFIX + "script.list.add";
-
- /**
- * <b>Configuration property:</b> Additional head section content.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.head.list"</js>
- * <li><b>Data type:</b> <code>String[]</code>
- * <li><b>Default:</b> empty array
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Adds the specified HTML content to the head section of the page.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * properties={
- * <ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_links</jsf>,
- * value=<js>"['<link rel=\"icon\" href=\"htdocs/mypageicon.ico\">']"</js>)
- * }
- * )
- * </p>
- *
- * <p>
- * A shortcut on <ja>@RestResource</ja> is also provided for this setting:
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=@HtmlDoc(
- * head={
- * <js>"<link rel='icon' href='$U{servlet:/htdocs/mypageicon.ico}'>"</js>
- * }
- * )
- * )
- * </p>
- */
- public static final String HTMLDOC_head = PREFIX + "head.list";
-
- /**
- * <b>Configuration property:</b> Add to the {@link #HTMLDOC_head} property.
- */
- public static final String HTMLDOC_links_add = PREFIX + "head.list.add";
-
- /**
- * <b>Configuration property:</b> HTML document template.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlDocSerializer.template"</js>
- * <li><b>Data type:</b> <code>Class<? <jk>extends</jk> HtmlDocTemplate></code> or {@link HtmlDocTemplate}
- * <li><b>Default:</b> <code>HtmlDocTemplateBasic.<jk>class</jk></code>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Specifies the template to use for serializing the page.
- *
- * <p>
- * By default, the {@link HtmlDocTemplateBasic} class is used to construct the contents of the HTML page, but
- * can be overridden with your own custom implementation class.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * <ja>@RestResource</ja>(
- * htmldoc=@HtmlDoc(
- * template=MySpecialDocTemplate.<jk>class</jk>
- * )
- * )
- * </p>
- */
- public static final String HTMLDOC_template = PREFIX + "template";
-
-
final String[] style, stylesheet, script, navlinks, head, header, nav, aside, footer;
final String noResultsMessage;
final boolean nowrap;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java
index 007c260..3405483 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerSession.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import org.apache.juneau.*;
import org.apache.juneau.internal.*;
@@ -81,10 +81,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_style} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_style} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_style} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_style} setting value in this context.
* An empty array if not specified.
* Never <jk>null</jk>.
*/
@@ -93,10 +93,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_stylesheet} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_stylesheet} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_stylesheet} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_stylesheet} setting value in this context.
* An empty array if not specified.
* Never <jk>null</jk>.
*/
@@ -105,10 +105,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_script} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_script} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_script} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_script} setting value in this context.
* An empty array if not specified.
* Never <jk>null</jk>.
*/
@@ -117,10 +117,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_head} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_head} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_head} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_head} setting value in this context.
* An empty array if not specified.
* Never <jk>null</jk>.
*/
@@ -129,19 +129,19 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_nowrap} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_nowrap} setting value in this context.
*
- * @return The {@link HtmlDocSerializerContext#HTMLDOC_nowrap} setting value in this context.
+ * @return The {@link HtmlDocSerializer#HTMLDOC_nowrap} setting value in this context.
*/
public final boolean isNoWrap() {
return nowrap;
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_header} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_header} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_header} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_header} setting value in this context.
* <jk>null</jk> if not specified.
* Never an empty string.
*/
@@ -150,10 +150,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_navlinks} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_navlinks} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_navlinks} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_navlinks} setting value in this context.
* <jk>null</jk> if not specified.
* Never an empty map.
*/
@@ -173,10 +173,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_nav} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_nav} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_nav} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_nav} setting value in this context.
* <jk>null</jk> if not specified.
* Never an empty string.
*/
@@ -185,10 +185,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_aside} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_aside} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_aside} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_aside} setting value in this context.
* <jk>null</jk> if not specified.
* Never an empty string.
*/
@@ -197,10 +197,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_footer} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_footer} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_footer} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_footer} setting value in this context.
* <jk>null</jk> if not specified.
* Never an empty string.
*/
@@ -209,10 +209,10 @@ public class HtmlDocSerializerSession extends HtmlStrippedDocSerializerSession {
}
/**
- * Returns the {@link HtmlDocSerializerContext#HTMLDOC_noResultsMessage} setting value in this context.
+ * Returns the {@link HtmlDocSerializer#HTMLDOC_noResultsMessage} setting value in this context.
*
* @return
- * The {@link HtmlDocSerializerContext#HTMLDOC_noResultsMessage} setting value in this context.
+ * The {@link HtmlDocSerializer#HTMLDOC_noResultsMessage} setting value in this context.
* <jk>null</jk> if not specified.
* Never an empty string.
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java
index a18dbc4..6d88fb2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java
@@ -28,21 +28,22 @@ import org.apache.juneau.xml.*;
* See the {@link HtmlSerializer} class for a description of the HTML generated.
* <p>
* This class is used primarily for automated testing of the {@link HtmlSerializer} class.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link HtmlSerializerContext}
- * </ul>
*/
@SuppressWarnings({ "hiding" })
public class HtmlParser extends XmlParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final HtmlParser DEFAULT = new HtmlParser(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final HtmlParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserContext.java
index e1abc7f..399a3a2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserContext.java
@@ -16,27 +16,7 @@ import org.apache.juneau.*;
import org.apache.juneau.xml.*;
/**
- * Configurable properties on the {@link HtmlParser} 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 HtmlParser} class.
*/
public final class HtmlParserContext extends XmlParserContext {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
index a20778c..4eff575 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
@@ -12,8 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
-import static org.apache.juneau.serializer.SerializerContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
index 9a1f302..a446497 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
@@ -12,8 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
-import static org.apache.juneau.serializer.SerializerContext.*;
-
import java.util.*;
import org.apache.juneau.*;
@@ -54,14 +52,6 @@ import org.apache.juneau.xml.*;
* <p>
* The {@link HtmlLink} annotation can be used on beans to add hyperlinks to the output.
*
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul class='spaced-list'>
- * <li>
- * {@link HtmlSerializerContext}
- * </ul>
- *
* <h6 class='topic'>Behavior-specific subclasses</h6>
*
* The following direct subclasses are provided for convenience:
@@ -135,6 +125,117 @@ import org.apache.juneau.xml.*;
@SuppressWarnings("hiding")
public class HtmlSerializer extends XmlSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "HtmlSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Anchor text source.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlSerializer.uriAnchorText"</js>
+ * <li><b>Data type:</b> <code>AnchorText</code>
+ * <li><b>Default:</b> <jsf>TO_STRING</jsf>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * When creating anchor tags (e.g. <code><xt><a</xt> <xa>href</xa>=<xs>'...'</xs>
+ * <xt>></xt>text<xt></a></xt></code>) in HTML, this setting defines what to set the inner text to.
+ *
+ * <p>
+ * See the {@link AnchorText} enum for possible values.
+ */
+ public static final String HTML_uriAnchorText = PREFIX + "uriAnchorText";
+
+ /**
+ * <b>Configuration property:</b> Look for URLs in {@link String Strings}.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlSerializer.detectLinksInStrings"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * If a string looks like a URL (e.g. starts with <js>"http://"</js> or <js>"https://"</js>, then treat it like a URL
+ * and make it into a hyperlink based on the rules specified by {@link #HTML_uriAnchorText}.
+ */
+ public static final String HTML_detectLinksInStrings = PREFIX + "detectLinksInStrings";
+
+ /**
+ * <b>Configuration property:</b> Look for link labels in the <js>"label"</js> parameter of the URL.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlSerializer.lookForLabelParameters"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * If the URL has a label parameter (e.g. <js>"?label=foobar"</js>), then use that as the anchor text of the link.
+ *
+ * <p>
+ * The parameter name can be changed via the {@link #HTML_labelParameter} property.
+ */
+ public static final String HTML_lookForLabelParameters = PREFIX + "lookForLabelParameters";
+
+ /**
+ * <b>Configuration property:</b> The parameter name to use when using {@link #HTML_lookForLabelParameters}.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlSerializer.labelParameter"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"label"</js>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ */
+ public static final String HTML_labelParameter = PREFIX + "labelParameter";
+
+ /**
+ * <b>Configuration property:</b> Add key/value headers on bean/map tables.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlSerializer.addKeyValueTableHeaders"</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>
+ */
+ public static final String HTML_addKeyValueTableHeaders = PREFIX + "addKeyValueTableHeaders";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"HtmlSerializer.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 HTML_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings. */
public static final HtmlSerializer DEFAULT = new HtmlSerializer(PropertyStore.create());
@@ -145,6 +246,10 @@ public class HtmlSerializer extends XmlSerializer {
public static final HtmlSerializer DEFAULT_SQ_READABLE = new HtmlSerializer.SqReadable(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, single quotes. */
public static class Sq extends HtmlSerializer {
@@ -172,6 +277,10 @@ public class HtmlSerializer extends XmlSerializer {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
final HtmlSerializerContext ctx;
private volatile HtmlSchemaDocSerializer schemaSerializer;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerBuilder.java
index 6acada7..dec298a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
-import static org.apache.juneau.html.HtmlSerializerContext.*;
+import static org.apache.juneau.html.HtmlSerializer.*;
import java.util.*;
@@ -76,7 +76,7 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see HtmlSerializerContext#HTML_uriAnchorText
+ * @see HtmlSerializer#HTML_uriAnchorText
*/
public HtmlSerializerBuilder uriAnchorText(AnchorText value) {
return property(HTML_uriAnchorText, value);
@@ -94,7 +94,7 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
*
* <p>
* If a string looks like a URL (e.g. starts with <js>"http://"</js> or <js>"https://"</js>, then treat it like a URL
- * and make it into a hyperlink based on the rules specified by {@link HtmlSerializerContext#HTML_uriAnchorText}.
+ * and make it into a hyperlink based on the rules specified by {@link HtmlSerializer#HTML_uriAnchorText}.
*
* <h5 class='section'>Notes:</h5>
* <ul>
@@ -104,7 +104,7 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see HtmlSerializerContext#HTML_detectLinksInStrings
+ * @see HtmlSerializer#HTML_detectLinksInStrings
*/
public HtmlSerializerBuilder detectLinksInStrings(boolean value) {
return property(HTML_detectLinksInStrings, value);
@@ -124,7 +124,7 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
* If the URL has a label parameter (e.g. <js>"?label=foobar"</js>), then use that as the anchor text of the link.
*
* <p>
- * The parameter name can be changed via the {@link HtmlSerializerContext#HTML_labelParameter} property.
+ * The parameter name can be changed via the {@link HtmlSerializer#HTML_labelParameter} property.
*
* <h5 class='section'>Notes:</h5>
* <ul>
@@ -134,14 +134,14 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see HtmlSerializerContext#HTML_lookForLabelParameters
+ * @see HtmlSerializer#HTML_lookForLabelParameters
*/
public HtmlSerializerBuilder lookForLabelParameters(boolean value) {
return property(HTML_lookForLabelParameters, value);
}
/**
- * <b>Configuration property:</b> The parameter name to use when using {@link HtmlSerializerContext#HTML_lookForLabelParameters}.
+ * <b>Configuration property:</b> The parameter name to use when using {@link HtmlSerializer#HTML_lookForLabelParameters}.
*
* <ul>
* <li><b>Name:</b> <js>"HtmlSerializer.labelParameter"</js>
@@ -158,7 +158,7 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see HtmlSerializerContext#HTML_labelParameter
+ * @see HtmlSerializer#HTML_labelParameter
*/
public HtmlSerializerBuilder labelParameter(String value) {
return property(HTML_labelParameter, value);
@@ -182,7 +182,7 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see HtmlSerializerContext#HTML_addKeyValueTableHeaders
+ * @see HtmlSerializer#HTML_addKeyValueTableHeaders
*/
public HtmlSerializerBuilder addKeyValueTableHeaders(boolean value) {
return property(HTML_addKeyValueTableHeaders, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
index 2749b51..8bb191b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerContext.java
@@ -12,138 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
+import static org.apache.juneau.html.HtmlSerializer.*;
+
import org.apache.juneau.*;
-import org.apache.juneau.serializer.*;
import org.apache.juneau.xml.*;
/**
- * Configurable properties on the {@link HtmlSerializer} 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 HtmlSerializer} class.
*/
public class HtmlSerializerContext extends XmlSerializerContext {
- static final String PREFIX = "HtmlSerializer.";
-
- /**
- * <b>Configuration property:</b> Anchor text source.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlSerializer.uriAnchorText"</js>
- * <li><b>Data type:</b> <code>AnchorText</code>
- * <li><b>Default:</b> <jsf>TO_STRING</jsf>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * When creating anchor tags (e.g. <code><xt><a</xt> <xa>href</xa>=<xs>'...'</xs>
- * <xt>></xt>text<xt></a></xt></code>) in HTML, this setting defines what to set the inner text to.
- *
- * <p>
- * See the {@link AnchorText} enum for possible values.
- */
- public static final String HTML_uriAnchorText = PREFIX + "uriAnchorText";
-
- /**
- * <b>Configuration property:</b> Look for URLs in {@link String Strings}.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlSerializer.detectLinksInStrings"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * If a string looks like a URL (e.g. starts with <js>"http://"</js> or <js>"https://"</js>, then treat it like a URL
- * and make it into a hyperlink based on the rules specified by {@link #HTML_uriAnchorText}.
- */
- public static final String HTML_detectLinksInStrings = PREFIX + "detectLinksInStrings";
-
- /**
- * <b>Configuration property:</b> Look for link labels in the <js>"label"</js> parameter of the URL.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlSerializer.lookForLabelParameters"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * If the URL has a label parameter (e.g. <js>"?label=foobar"</js>), then use that as the anchor text of the link.
- *
- * <p>
- * The parameter name can be changed via the {@link #HTML_labelParameter} property.
- */
- public static final String HTML_lookForLabelParameters = PREFIX + "lookForLabelParameters";
-
- /**
- * <b>Configuration property:</b> The parameter name to use when using {@link #HTML_lookForLabelParameters}.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlSerializer.labelParameter"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"label"</js>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- */
- public static final String HTML_labelParameter = PREFIX + "labelParameter";
-
- /**
- * <b>Configuration property:</b> Add key/value headers on bean/map tables.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlSerializer.addKeyValueTableHeaders"</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>
- */
- public static final String HTML_addKeyValueTableHeaders = PREFIX + "addKeyValueTableHeaders";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"HtmlSerializer.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 HTML_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
-
final AnchorText uriAnchorText;
final boolean
lookForLabelParameters,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
index 9e9ae42..8906a0c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
@@ -13,7 +13,7 @@
package org.apache.juneau.html;
import static org.apache.juneau.html.HtmlSerializerSession.ContentResult.*;
-import static org.apache.juneau.html.HtmlSerializerContext.*;
+import static org.apache.juneau.html.HtmlSerializer.*;
import static org.apache.juneau.xml.XmlUtils.*;
import java.io.*;
@@ -169,18 +169,18 @@ public class HtmlSerializerSession extends XmlSerializerSession {
}
/**
- * Returns the {@link HtmlSerializerContext#HTML_addKeyValueTableHeaders} setting value for this session.
+ * Returns the {@link HtmlSerializer#HTML_addKeyValueTableHeaders} setting value for this session.
*
- * @return The {@link HtmlSerializerContext#HTML_addKeyValueTableHeaders} setting value for this session.
+ * @return The {@link HtmlSerializer#HTML_addKeyValueTableHeaders} setting value for this session.
*/
public final boolean isAddKeyValueTableHeaders() {
return addKeyValueTableHeaders;
}
/**
- * Returns the {@link HtmlSerializerContext#HTML_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link HtmlSerializer#HTML_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link HtmlSerializerContext#HTML_addBeanTypeProperties} setting value for this session.
+ * @return The {@link HtmlSerializer#HTML_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/jso/JsoParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java
index 835ca36..8b5666a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java
@@ -26,10 +26,18 @@ import org.apache.juneau.parser.*;
*/
public final class JsoParser extends InputStreamParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final JsoParser DEFAULT = new JsoParser(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
/**
* Constructor.
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java
index 2fa50fb..e56c279 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java
@@ -29,9 +29,18 @@ import org.apache.juneau.serializer.*;
*/
public class JsoSerializer extends OutputStreamSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings.*/
public static final JsoSerializer DEFAULT = new JsoSerializer(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final SerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
----------------------------------------------------------------------
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 5fa9c85..98f05c7 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
@@ -12,8 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.json;
-import static org.apache.juneau.parser.ParserContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
@@ -99,22 +97,24 @@ import org.apache.juneau.parser.*;
* {@link ObjectMap#ObjectMap(CharSequence) ObjectMap(CharSequence)} or {@link ObjectList#ObjectList(CharSequence)
* ObjectList(CharSequence)} constructors instead of using this class.
* The end result should be the same.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link JsonParserContext}
- * </ul>
*/
public class JsonParser extends ReaderParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final JsonParser DEFAULT = new JsonParser(PropertyStore.create());
/** Default parser, all default settings.*/
public static final JsonParser DEFAULT_STRICT = new JsonParser.Strict(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, strict mode. */
public static class Strict extends JsonParser {
@@ -129,6 +129,10 @@ public class JsonParser extends ReaderParser {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final JsonParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserContext.java
index 66977f3..af8ab7a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserContext.java
@@ -16,27 +16,7 @@ import org.apache.juneau.*;
import org.apache.juneau.parser.*;
/**
- * Configurable properties on the {@link JsonParser} 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 JsonParser} class.
*/
public final class JsonParserContext extends ParserContext {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
index 42ae307..c8d55ee 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
@@ -12,8 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.json;
-import static org.apache.juneau.serializer.SerializerContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java
index 5336f7b..ed0141e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java
@@ -12,8 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.json;
-import static org.apache.juneau.json.JsonSerializerContext.*;
-
import java.util.*;
import org.apache.juneau.*;
@@ -63,15 +61,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 JsonSerializerContext}
- * <li>{@link SerializerContext}
- * <li>{@link BeanContext}
- * </ul>
- *
* <h6 class='topic'>Behavior-specific subclasses</h6>
*
* The following direct subclasses are provided for convenience:
@@ -99,6 +88,74 @@ import org.apache.juneau.serializer.*;
*/
public class JsonSerializer extends WriterSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "JsonSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Simple JSON mode.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"JsonSerializer.simpleMode"</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>, JSON attribute names will only be quoted when necessary.
+ * Otherwise, they are always quoted.
+ */
+ public static final String JSON_simpleMode = PREFIX + "simpleMode";
+
+ /**
+ * <b>Configuration property:</b> Prefix solidus <js>'/'</js> characters with escapes.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"JsonSerializer.escapeSolidus"</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>, solidus (e.g. slash) characters should be escaped.
+ * The JSON specification allows for either format.
+ * However, if you're embedding JSON in an HTML script tag, this setting prevents confusion when trying to serialize
+ * <xt><\/script></xt>.
+ */
+ public static final String JSON_escapeSolidus = PREFIX + "escapeSolidus";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"JsonSerializer.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 JSON_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings.*/
public static final JsonSerializer DEFAULT = new JsonSerializer(PropertyStore.create());
@@ -118,6 +175,10 @@ public class JsonSerializer extends WriterSerializer {
public static final JsonSerializer DEFAULT_LAX_READABLE_SAFE = new SimpleReadableSafe(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, with whitespace. */
public static class Readable extends JsonSerializer {
@@ -194,6 +255,10 @@ public class JsonSerializer extends WriterSerializer {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
final JsonSerializerContext ctx;
private volatile JsonSchemaSerializer schemaSerializer;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java
index 14393cc..e411b91 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.json;
-import static org.apache.juneau.json.JsonSerializerContext.*;
+import static org.apache.juneau.json.JsonSerializer.*;
import java.util.*;
@@ -72,7 +72,7 @@ public class JsonSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see JsonSerializerContext#JSON_simpleMode
+ * @see JsonSerializer#JSON_simpleMode
*/
public JsonSerializerBuilder simple(boolean value) {
return property(JSON_simpleMode, value);
@@ -110,7 +110,7 @@ public class JsonSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see JsonSerializerContext#JSON_escapeSolidus
+ * @see JsonSerializer#JSON_escapeSolidus
*/
public JsonSerializerBuilder escapeSolidus(boolean value) {
return property(JSON_escapeSolidus, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerContext.java
index 0284aee..599e5cc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerContext.java
@@ -12,93 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.json;
+import static org.apache.juneau.json.JsonSerializer.*;
+
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
/**
- * Configurable properties on the {@link JsonSerializer} 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 JsonSerializer} class.
*/
public final class JsonSerializerContext extends SerializerContext {
- static final String PREFIX = "JsonSerializer.";
-
- /**
- * <b>Configuration property:</b> Simple JSON mode.
- *
- * <ul>
- * <li><b>Name:</b> <js>"JsonSerializer.simpleMode"</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>, JSON attribute names will only be quoted when necessary.
- * Otherwise, they are always quoted.
- */
- public static final String JSON_simpleMode = PREFIX + "simpleMode";
-
- /**
- * <b>Configuration property:</b> Prefix solidus <js>'/'</js> characters with escapes.
- *
- * <ul>
- * <li><b>Name:</b> <js>"JsonSerializer.escapeSolidus"</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>, solidus (e.g. slash) characters should be escaped.
- * The JSON specification allows for either format.
- * However, if you're embedding JSON in an HTML script tag, this setting prevents confusion when trying to serialize
- * <xt><\/script></xt>.
- */
- public static final String JSON_escapeSolidus = PREFIX + "escapeSolidus";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"JsonSerializer.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 JSON_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
final boolean
simpleMode,
escapeSolidus,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java
index 6762136..628c1f0 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerSession.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.json;
-import static org.apache.juneau.json.JsonSerializerContext.*;
+import static org.apache.juneau.json.JsonSerializer.*;
import java.util.*;
@@ -238,9 +238,9 @@ public class JsonSerializerSession extends WriterSerializerSession {
/**
- * Returns the {@link JsonSerializerContext#JSON_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link JsonSerializer#JSON_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link JsonSerializerContext#JSON_addBeanTypeProperties} setting value for this session.
+ * @return The {@link JsonSerializer#JSON_addBeanTypeProperties} setting value for this session.
*/
@Override /* SerializerSession */
protected 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/json/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/package.html b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/package.html
index 3c3e845..9e1598a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/package.html
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/package.html
@@ -647,12 +647,12 @@
The JSON 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
+ be thrown (if {@link org.apache.juneau.serializer.Serializer#SERIALIZER_maxDepth} is not reached
first).
</p>
<p>
If you still want to use the JSON 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>
[6/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
deleted file mode 100644
index ae65e23..0000000
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
+++ /dev/null
@@ -1,646 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.jena;
-
-import java.util.*;
-
-import org.apache.juneau.jena.annotation.*;
-import org.apache.juneau.utils.*;
-import org.apache.juneau.xml.*;
-import org.apache.juneau.xml.annotation.*;
-
-/**
- * Configurable properties common to both the {@link RdfSerializer} and {@link RdfParser} classes.
- */
-public interface RdfCommonContext {
-
- /**
- * Maps RDF writer names to property prefixes that apply to them.
- */
- final static Map<String,String> LANG_PROP_MAP = new AMap<String,String>()
- .append("RDF/XML","rdfXml.")
- .append("RDF/XML-ABBREV","rdfXml.")
- .append("N3","n3.")
- .append("N3-PP","n3.")
- .append("N3-PLAIN","n3.")
- .append("N3-TRIPLES","n3.")
- .append("TURTLE","n3.")
- .append("N-TRIPLE","ntriple.");
-
- /**
- * <b>Configuration property:</b> RDF language.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.language"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"RDF/XML-ABBREV"</js>
- * </ul>
- *
- * <p>
- * Can be any of the following:
- * <ul class='spaced-list'>
- * <li>
- * <js>"RDF/XML"</js>
- * <li>
- * <js>"RDF/XML-ABBREV"</js>
- * <li>
- * <js>"N-TRIPLE"</js>
- * <li>
- * <js>"N3"</js> - General name for the N3 writer.
- * Will make a decision on exactly which writer to use (pretty writer, plain writer or simple writer) when
- * created.
- * Default is the pretty writer but can be overridden with system property
- * <code>com.hp.hpl.jena.n3.N3JenaWriter.writer</code>.
- * <li>
- * <js>"N3-PP"</js> - Name of the N3 pretty writer.
- * The pretty writer uses a frame-like layout, with prefixing, clustering like properties and embedding
- * one-referenced bNodes.
- * <li>
- * <js>"N3-PLAIN"</js> - Name of the N3 plain writer.
- * The plain writer writes records by subject.
- * <li>
- * <js>"N3-TRIPLES"</js> - Name of the N3 triples writer.
- * This writer writes one line per statement, like N-Triples, but does N3-style prefixing.
- * <li>
- * <js>"TURTLE"</js> - Turtle writer.
- * http://www.dajobe.org/2004/01/turtle/
- * </ul>
- */
- public static final String RDF_language = "Rdf.language";
-
- /**
- * <b>Configuration property:</b> XML namespace for Juneau properties.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.juneauNs"</js>
- * <li><b>Data type:</b> {@link Namespace}
- * <li><b>Default:</b> <code>{j:<js>'http://www.apache.org/juneau/'</js>}</code>
- * </ul>
- */
- public static final String RDF_juneauNs = "Rdf.juneauNs";
-
- /**
- * <b>Configuration property:</b> Default XML namespace for bean properties.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.juneauBpNs"</js>
- * <li><b>Data type:</b> {@link Namespace}
- * <li><b>Default:</b> <code>{j:<js>'http://www.apache.org/juneaubp/'</js>}</code>
- * </ul>
- */
- public static final String RDF_juneauBpNs = "Rdf.juneauBpNs";
-
- /**
- * <b>Configuration property:</b> Reuse XML namespaces when RDF namespaces not specified.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.useXmlNamespaces"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * When specified, namespaces defined using {@link XmlNs} and {@link Xml} will be inherited by the RDF serializers.
- * Otherwise, namespaces will be defined using {@link RdfNs} and {@link Rdf}.
- */
- public static final String RDF_useXmlNamespaces = "Rdf.useXmlNamespaces";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>iri_rules</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.iri-rules"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"lax"</js>
- * </ul>
- *
- * <p>
- * Set the engine for checking and resolving.
- *
- * <p>
- * Possible values:
- * <ul class='spaced-list'>
- * <li>
- * <js>"lax"</js> - The rules for RDF URI references only, which does permit spaces although the use of spaces
- * is not good practice.
- * <li>
- * <js>"strict"</js> - Sets the IRI engine with rules for valid IRIs, XLink and RDF; it does not permit spaces
- * in IRIs.
- * <li>
- * <js>"iri"</js> - Sets the IRI engine to IRI
- * (<a class="doclink" href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>,
- * <a class="doclink" href="http://www.ietf.org/rfc/rfc3987.txt">RFC 3987</a>).
- * </ul>
- */
- public static final String RDF_arp_iriRules = "Rdf.jena.rdfXml.iri-rules";
-
- /**
- * <b>Configuration property:</b> RDF/XML ARP property: <code>error-mode</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.error-mode"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"lax"</js>
- * </ul>
- *
- * <p>
- * This allows a coarse-grained approach to control of error handling.
- *
- * <p>
- * Possible values:
- * <ul>
- * <li><js>"default"</js>
- * <li><js>"lax"</js>
- * <li><js>"strict"</js>
- * <li><js>"strict-ignore"</js>
- * <li><js>"strict-warning"</js>
- * <li><js>"strict-error"</js>
- * <li><js>"strict-fatal"</js>
- * </ul>
- *
- * <p>
- * See also:
- * <ul class='spaced-list'>
- * <li>
- * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setDefaultErrorMode()">ARPOptions.setDefaultErrorMode()</a>
- * <li>
- * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setLaxErrorMode()">ARPOptions.setLaxErrorMode()</a>
- * <li>
- * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setStrictErrorMode()">ARPOptions.setStrictErrorMode()</a>
- * <li>
- * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setStrictErrorMode(int)">ARPOptions.setStrictErrorMode(int)</a>
- * </ul>
- */
- public static final String RDF_arp_errorMode = "Rdf.jena.rdfXml.error-mode";
-
- /**
- * <b>Configuration property:</b> RDF/XML ARP property: <code>embedding</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.embedding"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk>
- * </ul>
- *
- * <p>
- * Sets ARP to look for RDF embedded within an enclosing XML document.
- *
- * <p>
- * See also:
- * <ul class='spaced-list'>
- * <li>
- * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setEmbedding(boolean)">ARPOptions.setEmbedding(boolean)</a>
- * </ul>
- */
- public static final String RDF_arp_embedding = "Rdf.jena.rdfXml.embedding";
-
- /**
- * <b>Configuration property:</b> RDF/XML ARP property: <code>ERR_xxx</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.ERR_"</js>
- * <li><b>Data type:</b> <code>String</code>
- * </ul>
- *
- * <p>
- * Provides fine-grained control over detected error conditions.
- *
- * <p>
- * Possible values:
- * <ul>
- * <li><js>"EM_IGNORE"</js>
- * <li><js>"EM_WARNING"</js>
- * <li><js>"EM_ERROR"</js>
- * <li><js>"EM_FATAL"</js>
- * </ul>
- *
- * <p>
- * See also:
- * <ul class='spaced-list'>
- * <li>
- * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPErrorNumbers.html">ARPErrorNumbers</a>
- * <li>
- * <a class="doclink" href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setErrorMode(int,%20int)">ARPOptions.setErrorMode(int, int)</a>
- * </ul>
- */
- public static final String RDF_arp_err_ = "Rdf.jena.rdfXml.ERR_";
-
- /**
- * <b>Configuration property:</b> RDF/XML ARP property: <code>WARN_xxx</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.WARN_"</js>
- * <li><b>Data type:</b> <code>String</code>
- * </ul>
- *
- * <p>
- * See {@link #RDF_arp_err_} for details.
- */
- public static final String RDF_arp_warn_ = "Rdf.jena.rdfXml.WARN_";
-
- /**
- * RDF/XML ARP property: <code>IGN_xxx</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.IGN_"</js>
- * <li><b>Data type:</b> <code>String</code>
- * </ul>
- *
- * <p>
- * See {@link #RDF_arp_err_} for details.
- */
- public static final String RDF_arp_ign_ = "Rdf.jena.rdfXml.IGN_";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>xmlbase</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.xmlbase"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <jk>null</jk>
- * </ul>
- *
- * <p>
- * The value to be included for an <xa>xml:base</xa> attribute on the root element in the file.
- */
- public static final String RDF_rdfxml_xmlBase = "Rdf.jena.rdfXml.xmlbase";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>longId</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.longId"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk>
- * </ul>
- *
- * <p>
- * Whether to use long ID's for anon resources.
- * Short ID's are easier to read, but can run out of memory on very large models.
- */
- public static final String RDF_rdfxml_longId = "Rdf.jena.rdfXml.longId";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>allowBadURIs</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.allowBadURIs"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk>
- * </ul>
- *
- * <p>
- * URIs in the graph are, by default, checked prior to serialization.
- */
- public static final String RDF_rdfxml_allowBadUris = "Rdf.jena.rdfXml.allowBadURIs";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>relativeURIs</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.relativeURIs"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"same-document, absolute, relative, parent"</js>
- * </ul>
- *
- * <p>
- * What sort of relative URIs should be used.
- *
- * <p>
- * A comma separate list of options:
- * <ul class='spaced-list'>
- * <li>
- * <js>"same-document"</js> - Same-document references (e.g. <js>""</js> or <js>"#foo"</js>)
- * <li>
- * <js>"network"</js> - Network paths (e.g. <js>"//example.org/foo"</js> omitting the URI scheme)
- * <li>
- * <js>"absolute"</js> - Absolute paths (e.g. <js>"/foo"</js> omitting the scheme and authority)
- * <li>
- * <js>"relative"</js> - Relative path not beginning in <js>"../"</js>
- * <li>
- * <js>"parent"</js> - Relative path beginning in <js>"../"</js>
- * <li>
- * <js>"grandparent"</js> - Relative path beginning in <js>"../../"</js>
- * </ul>
- *
- * <p>
- * The default value is <js>"same-document, absolute, relative, parent"</js>.
- * To switch off relative URIs use the value <js>""</js>.
- * Relative URIs of any of these types are output where possible if and only if the option has been specified.
- */
- public static final String RDF_rdfxml_relativeUris = "Rdf.jena.rdfXml.relativeURIs";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>showXmlDeclaration</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.showXmlDeclaration"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"default"</js>
- * </ul>
- *
- * <p>
- * Possible values:
- * <ul class='spaced-list'>
- * <li>
- * <js>"true"</js> - Add XML Declaration to the output.
- * <li>
- * <js>"false"</js> - Don't add XML Declaration to the output.
- * <li>
- * <js>"default"</js> - Only add an XML Declaration when asked to write to an <code>OutputStreamWriter</code>
- * that uses some encoding other than <code>UTF-8</code> or <code>UTF-16</code>.
- * In this case the encoding is shown in the XML declaration.
- * </ul>
- */
- public static final String RDF_rdfxml_showXmlDeclaration = "Rdf.jena.rdfXml.showXmlDeclaration";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>showDoctypeDeclaration</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.showDoctypeDeclaration"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * If true, an XML doctype declaration is included in the output.
- * This declaration includes a <code>!ENTITY</code> declaration for each prefix mapping in the model, and any
- * attribute value that starts with the URI of that mapping is written as starting with the corresponding entity
- * invocation.
- */
- public static final String RDF_rdfxml_showDoctypeDeclaration = "Rdf.jena.rdfXml.showDoctypeDeclaration";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>tab</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.tab"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>2</code>
- * </ul>
- *
- * <p>
- * The number of spaces with which to indent XML child elements.
- */
- public static final String RDF_rdfxml_tab = "Rdf.jena.rdfXml.tab";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>attributeQuoteChar</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.attributeQuoteChar"</js>
- * <li><b>Data type:</b> <code>Character</code>
- * <li><b>Default:</b> <js>'"'</js>
- * </ul>
- *
- * <p>
- * The XML attribute quote character.
- */
- public static final String RDF_rdfxml_attributeQuoteChar = "Rdf.jena.rdfXml.attributeQuoteChar";
-
- /**
- * <b>Configuration property:</b> RDF/XML property: <code>blockRules</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.rdfXml.blockRules"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>""</js>
- * </ul>
- *
- * <p>
- * A list of <code>Resource</code> or a <code>String</code> being a comma separated list of fragment IDs from
- * <a class="doclink" href="http://www.w3.org/TR/rdf-syntax-grammar">RDF Syntax Grammar</a> indicating grammar
- * rules that will not be used.
- */
- public static final String RDF_rdfxml_blockRules = "Rdf.jena.rdfXml.blockRules";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>minGap</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.minGap"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>1</code>
- * </ul>
- *
- * <p>
- * Minimum gap between items on a line.
- */
- public static final String RDF_n3_minGap = "Rdf.jena.n3.minGap";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>objectLists</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.objectLists"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Print object lists as comma separated lists.
- */
- public static final String RDF_n3_objectLists = "Rdf.jena.n3.objectLists";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>subjectColumn</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.subjectColumn"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> indentProperty
- * </ul>
- *
- * <p>
- * If the subject is shorter than this value, the first property may go on the same line.
- */
- public static final String RDF_n3_subjectColumn = "Rdf.jena.n3.subjectColumn";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>propertyColumn</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.propertyColumn"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>8</code>
- * </ul>
- *
- * <p>
- * Width of the property column.
- */
- public static final String RDF_n3_propertyColumn = "Rdf.jena.n3.propertyColumn";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>indentProperty</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.indentProperty"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>6</code>
- * </ul>
- *
- * <p>
- * Width to indent properties.
- */
- public static final String RDF_n3_indentProperty = "Rdf.jena.n3.indentProperty";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>widePropertyLen</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.widePropertyLen"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>20</code>
- * </ul>
- *
- * <p>
- * Width of the property column.
- * Must be longer than <code>propertyColumn</code>.
- */
- public static final String RDF_n3_widePropertyLen = "Rdf.jena.n3.widePropertyLen";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>abbrevBaseURI</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.abbrevBaseURI"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Control whether to use abbreviations <code><></code> or <code><#></code>.
- */
- public static final String RDF_n3_abbrevBaseUri = "Rdf.jena.n3.abbrevBaseURI";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>usePropertySymbols</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.usePropertySymbols"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Control whether to use <code>a</code>, <code>=</code> and <code>=></code> in output
- */
- public static final String RDF_n3_usePropertySymbols = "Rdf.jena.n3.usePropertySymbols";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>useTripleQuotedStrings</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.useTripleQuotedStrings"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Allow the use of <code>"""</code> to delimit long strings.
- */
- public static final String RDF_n3_useTripleQuotedStrings = "Rdf.jena.n3.useTripleQuotedStrings";
-
- /**
- * <b>Configuration property:</b> N3/Turtle property: <code>useDoubles</code>.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.jena.n3.useDoubles"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Allow the use doubles as <code>123.456</code>.
- */
- public static final String RDF_n3_useDoubles = "Rdf.jena.n3.useDoubles";
-
- /**
- * <b>Configuration property:</b> RDF format for representing collections and arrays.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.collectionFormat"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"DEFAULT"</js>
- * </ul>
- *
- * <p>
- * Possible values:
- * <ul class='spaced-list'>
- * <li>
- * <js>"DEFAULT"</js> - Default format. The default is an RDF Sequence container.
- * <li>
- * <js>"SEQ"</js> - RDF Sequence container.
- * <li>
- * <js>"BAG"</js> - RDF Bag container.
- * <li>
- * <js>"LIST"</js> - RDF List container.
- * <li>
- * <js>"MULTI_VALUED"</js> - Multi-valued properties.
- * </ul>
- *
- * <h5 class='section'>Notes:</h5>
- * <ul>
- * <li>If you use <js>"BAG"</js> or <js>"MULTI_VALUED"</js>, the order of the elements in the collection will get
- * lost.
- * </ul>
- */
- public static final String RDF_collectionFormat = "Rdf.collectionFormat";
-
- /**
- * <b>Configuration property:</b> Collections should be serialized and parsed as loose collections.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Rdf.looseCollections"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>false</jk>
- * </ul>
- *
- * <p>
- * When specified, 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).
- *
- * <p>
- * Note that this setting is specialized for RDF syntax, and is incompatible with the concept of
- * losslessly representing POJO models, since the tree structure of these POJO models are lost
- * when serialized as loose collections.
- *
- * <p>
- * This setting is typically only useful if the beans being parsed into do not have a bean property
- * annotated with {@link Rdf#beanUri @Rdf(beanUri=true)}.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode'>
- * WriterSerializer s = <jk>new</jk> RdfSerializerBuilder().xmlabbrev().looseCollections(<jk>true</jk>).build();
- * ReaderParser p = <jk>new</jk> RdfParserBuilder().xml().looseCollections(<jk>true</jk>).build();
- *
- * List<MyBean> l = createListOfMyBeans();
- *
- * <jc>// Serialize to RDF/XML as loose resources</jc>
- * String rdfXml = s.serialize(l);
- *
- * <jc>// Parse back into a Java collection</jc>
- * l = p.parse(rdfXml, LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
- *
- * MyBean[] b = createArrayOfMyBeans();
- *
- * <jc>// Serialize to RDF/XML as loose resources</jc>
- * String rdfXml = s.serialize(b);
- *
- * <jc>// Parse back into a bean array</jc>
- * b = p.parse(rdfXml, MyBean[].<jk>class</jk>);
- * </p>
- */
- public static final String RDF_looseCollections = "Rdf.looseCollections";
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java
----------------------------------------------------------------------
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 a94c123..f6e0c0b 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
@@ -13,7 +13,7 @@
package org.apache.juneau.jena;
import static org.apache.juneau.jena.Constants.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
@@ -21,11 +21,6 @@ import org.apache.juneau.parser.*;
/**
* Parses RDF into POJOs.
*
- * <h5 class='section'>Configurable properties:</h5>
- *
- * Refer to <a class="doclink" href="package-summary.html#ParserConfigurableProperties">Configurable Properties</a>
- * for the entire list of configurable properties.
- *
* <h6 class='topic'>Behavior-specific subclasses</h6>
*
* The following direct subclasses are provided for language-specific parsers:
@@ -46,6 +41,32 @@ import org.apache.juneau.parser.*;
*/
public class RdfParser extends ReaderParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "RdfParser.";
+
+ /**
+ * <b>Configuration property:</b> Trim whitespace from text elements.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"RdfParser.trimWhitespace"</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>, whitespace in text elements will be automatically trimmed.
+ */
+ public static final String RDF_trimWhitespace = PREFIX + "trimWhitespace";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default XML parser, all default settings.*/
public static final RdfParser DEFAULT_XML = new Xml(PropertyStore.create());
@@ -59,6 +80,10 @@ public class RdfParser extends ReaderParser {
public static final RdfParser DEFAULT_N3 = new N3(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Consumes RDF/XML input */
public static class Xml extends RdfParser {
@@ -112,6 +137,10 @@ public class RdfParser extends ReaderParser {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final RdfParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserBuilder.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserBuilder.java
index 095d45a..79b8d7a 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserBuilder.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserBuilder.java
@@ -12,8 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.jena;
-import static org.apache.juneau.jena.RdfCommonContext.*;
-import static org.apache.juneau.jena.RdfParserContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
+import static org.apache.juneau.jena.RdfParser.*;
import java.util.*;
@@ -75,7 +75,7 @@ public class RdfParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfParserContext#RDF_trimWhitespace
+ * @see RdfParser#RDF_trimWhitespace
*/
public RdfParserBuilder trimWhitespace(boolean value) {
return property(RDF_trimWhitespace, value);
@@ -127,7 +127,7 @@ public class RdfParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfParserContext#RDF_language
+ * @see RdfCommon#RDF_language
*/
public RdfParserBuilder language(String value) {
return property(RDF_language, value);
@@ -194,7 +194,7 @@ public class RdfParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfParserContext#RDF_juneauNs
+ * @see RdfCommon#RDF_juneauNs
*/
public RdfParserBuilder juneauNs(Namespace value) {
return property(RDF_juneauNs, value);
@@ -216,7 +216,7 @@ public class RdfParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfParserContext#RDF_juneauBpNs
+ * @see RdfCommon#RDF_juneauBpNs
*/
public RdfParserBuilder juneauBpNs(Namespace value) {
return property(RDF_juneauBpNs, value);
@@ -232,7 +232,8 @@ public class RdfParserBuilder extends ParserBuilder {
* </ul>
*
* <p>
- * When specified, namespaces defined using {@link XmlNs} and {@link Xml} will be inherited by the RDF parsers.
+ * When specified, namespaces defined using {@link XmlNs} and {@link org.apache.juneau.xml.annotation.Xml} will be
+ * inherited by the RDF parsers.
* Otherwise, namespaces will be defined using {@link RdfNs} and {@link Rdf}.
*
* <h5 class='section'>Notes:</h5>
@@ -242,7 +243,7 @@ public class RdfParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfParserContext#RDF_useXmlNamespaces
+ * @see RdfCommon#RDF_useXmlNamespaces
*/
public RdfParserBuilder useXmlNamespaces(boolean value) {
return property(RDF_useXmlNamespaces, value);
@@ -286,7 +287,7 @@ public class RdfParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfCommonContext#RDF_collectionFormat
+ * @see RdfCommon#RDF_collectionFormat
*/
public RdfParserBuilder collectionFormat(RdfCollectionFormat value) {
return property(RDF_collectionFormat, value);
@@ -343,7 +344,7 @@ public class RdfParserBuilder extends ParserBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfCommonContext#RDF_looseCollections
+ * @see RdfCommon#RDF_looseCollections
*/
public RdfParserBuilder looseCollections(boolean value) {
return property(RDF_looseCollections, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserContext.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserContext.java
index 53039f3..60e66d7 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserContext.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserContext.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.jena;
+import static org.apache.juneau.jena.RdfParser.*;
+
import java.util.*;
import org.apache.juneau.*;
@@ -19,53 +21,10 @@ import org.apache.juneau.parser.*;
import org.apache.juneau.xml.*;
/**
- * Configurable properties on the {@link RdfParser} 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' id='ConfigProperties'>Configurable properties inherited by the RDF parsers</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 class='jic'>
- * <a class="doclink" href="RdfCommonContext.html#ConfigProperties">RdfCommonContext</a>
- * - Configurable properties common to the RDF serializers and parsers.
- * </ul>
- * </li>
- * </ul>
- * </li>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link RdfParser} class.
*/
-public final class RdfParserContext extends ParserContext implements RdfCommonContext {
+public final class RdfParserContext extends ParserContext implements RdfCommon {
- static final String PREFIX = "RdfParser.";
-
- /**
- * <b>Configuration property:</b> Trim whitespace from text elements.
- *
- * <ul>
- * <li><b>Name:</b> <js>"RdfParser.trimWhitespace"</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>, whitespace in text elements will be automatically trimmed.
- */
- public static final String RDF_trimWhitespace = PREFIX + "trimWhitespace";
-
final boolean trimWhitespace, looseCollections;
final String rdfLanguage;
final Namespace juneauNs, juneauBpNs;
@@ -102,5 +61,4 @@ public final class RdfParserContext extends ParserContext implements RdfCommonCo
.append("collectionFormat", collectionFormat)
);
}
-}
-
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParserSession.java
----------------------------------------------------------------------
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 2365035..4bc2ad1 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
@@ -14,7 +14,8 @@ package org.apache.juneau.jena;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.jena.Constants.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
+import static org.apache.juneau.jena.RdfParser.*;
import java.util.*;
@@ -62,7 +63,7 @@ public class RdfParserSession extends ReaderParserSession {
this.rdfLanguage = p.getString(RDF_language, ctx.rdfLanguage);
this.juneauNs = (p.containsKey(RDF_juneauNs) ? NamespaceFactory.parseNamespace(p.get(RDF_juneauNs)) : ctx.juneauNs);
this.juneauBpNs = (p.containsKey(RDF_juneauBpNs) ? NamespaceFactory.parseNamespace(p.get(RDF_juneauBpNs)) : ctx.juneauBpNs);
- this.trimWhitespace = p.getBoolean(RdfParserContext.RDF_trimWhitespace, ctx.trimWhitespace);
+ this.trimWhitespace = p.getBoolean(RDF_trimWhitespace, ctx.trimWhitespace);
this.collectionFormat = p.getWithDefault(RDF_collectionFormat, ctx.collectionFormat, RdfCollectionFormat.class);
this.looseCollections = p.getBoolean(RDF_looseCollections, ctx.looseCollections);
this.model = ModelFactory.createDefaultModel();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
index b574186..af3dbd3 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
@@ -13,19 +13,15 @@
package org.apache.juneau.jena;
import static org.apache.juneau.jena.Constants.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.xml.*;
/**
* Serializes POJOs to RDF.
*
- * <h5 class='section'>Configurable properties:</h5>
- *
- * Refer to <a class="doclink" href="package-summary.html#SerializerConfigurableProperties">Configurable Properties</a>
- * for the entire list of configurable properties.
- *
* <h6 class='topic'>Behavior-specific subclasses</h6>
*
* The following direct subclasses are provided for language-specific serializers:
@@ -43,6 +39,107 @@ import org.apache.juneau.serializer.*;
*/
public class RdfSerializer extends WriterSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "RdfSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Add XSI data types to non-<code>String</code> literals.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"RdfSerializer.addLiteralTypes"</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>
+ */
+ public static final String RDF_addLiteralTypes = PREFIX + "addLiteralTypes";
+
+ /**
+ * <b>Configuration property:</b> Add RDF root identifier property to root node.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"RdfSerializer.addRootProperty"</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>
+ * When enabled an RDF property <code>http://www.apache.org/juneau/root</code> is added with a value of <js>"true"</js>
+ * to identify the root node in the graph.
+ * This helps locate the root node during parsing.
+ *
+ * <p>
+ * If disabled, the parser has to search through the model to find any resources without incoming predicates to
+ * identify root notes, which can introduce a considerable performance degradation.
+ */
+ public static final String RDF_addRootProperty = PREFIX + "addRootProperty";
+
+ /**
+ * <b>Configuration property:</b> Auto-detect namespace usage.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"RdfSerializer.autoDetectNamespaces"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Detect namespace usage before serialization.
+ *
+ * <p>
+ * If enabled, then the data structure will first be crawled looking for namespaces that will be encountered before
+ * the root element is serialized.
+ */
+ public static final String RDF_autoDetectNamespaces = PREFIX + "autoDetectNamespaces";
+
+ /**
+ * <b>Configuration property:</b> Default namespaces.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"RdfSerializer.namespaces.list"</js>
+ * <li><b>Data type:</b> <code>List<{@link Namespace}></code>
+ * <li><b>Default:</b> empty list
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * The default list of namespaces associated with this serializer.
+ */
+ public static final String RDF_namespaces = PREFIX + "namespaces.list";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"RdfSerializer.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 RDF_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default RDF/XML serializer, all default settings.*/
public static final RdfSerializer DEFAULT_XML = new Xml(PropertyStore.create());
@@ -59,6 +156,10 @@ public class RdfSerializer extends WriterSerializer {
public static final RdfSerializer DEFAULT_N3 = new N3(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Produces RDF/XML output */
public static class Xml extends RdfSerializer {
@@ -125,6 +226,10 @@ public class RdfSerializer extends WriterSerializer {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final RdfSerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
index 59b15c5..57bb5cc 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
@@ -12,8 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.jena;
-import static org.apache.juneau.jena.RdfCommonContext.*;
-import static org.apache.juneau.jena.RdfSerializerContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
+import static org.apache.juneau.jena.RdfSerializer.*;
import java.util.*;
@@ -102,7 +102,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfCommonContext#RDF_language
+ * @see RdfCommon#RDF_language
*/
public RdfSerializerBuilder language(String value) {
return property(RDF_language, value);
@@ -170,7 +170,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfSerializerContext#RDF_juneauNs
+ * @see RdfCommon#RDF_juneauNs
*/
public RdfSerializerBuilder juneauNs(Namespace value) {
return property(RDF_juneauNs, value);
@@ -193,7 +193,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfSerializerContext#RDF_juneauBpNs
+ * @see RdfCommon#RDF_juneauBpNs
*/
public RdfSerializerBuilder juneauBpNs(Namespace value) {
return property(RDF_juneauBpNs, value);
@@ -209,7 +209,8 @@ public class RdfSerializerBuilder extends SerializerBuilder {
* </ul>
*
* <p>
- * When specified, namespaces defined using {@link XmlNs} and {@link Xml} will be inherited by the RDF serializers.
+ * When specified, namespaces defined using {@link XmlNs} and {@link org.apache.juneau.xml.annotation.Xml} will be
+ * inherited by the RDF serializers.
* Otherwise, namespaces will be defined using {@link RdfNs} and {@link Rdf}.
*
* <h5 class='section'>Notes:</h5>
@@ -220,7 +221,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortMaps
+ * @see RdfCommon#RDF_useXmlNamespaces
*/
public RdfSerializerBuilder useXmlNamespaces(boolean value) {
return property(RDF_useXmlNamespaces, value);
@@ -244,7 +245,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfSerializerContext#RDF_addLiteralTypes
+ * @see RdfSerializer#RDF_addLiteralTypes
*/
public RdfSerializerBuilder addLiteralTypes(boolean value) {
return property(RDF_addLiteralTypes, value);
@@ -277,7 +278,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfSerializerContext#RDF_addRootProperty
+ * @see RdfSerializer#RDF_addRootProperty
*/
public RdfSerializerBuilder addRootProperty(boolean value) {
return property(RDF_addRootProperty, value);
@@ -308,7 +309,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfSerializerContext#RDF_autoDetectNamespaces
+ * @see RdfSerializer#RDF_autoDetectNamespaces
*/
public RdfSerializerBuilder autoDetectNamespaces(boolean value) {
return property(RDF_autoDetectNamespaces, value);
@@ -335,7 +336,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param values The new value for this property.
* @return This object (for method chaining).
- * @see RdfSerializerContext#RDF_namespaces
+ * @see RdfSerializer#RDF_namespaces
*/
public RdfSerializerBuilder namespaces(Namespace...values) {
return property(RDF_namespaces, values);
@@ -379,7 +380,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfCommonContext#RDF_collectionFormat
+ * @see RdfCommon#RDF_collectionFormat
*/
public RdfSerializerBuilder collectionFormat(RdfCollectionFormat value) {
return property(RDF_collectionFormat, value);
@@ -436,7 +437,7 @@ public class RdfSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see RdfCommonContext#RDF_looseCollections
+ * @see RdfCommon#RDF_looseCollections
*/
public RdfSerializerBuilder looseCollections(boolean value) {
return property(RDF_looseCollections, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerContext.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerContext.java
index 3b050b5..3360fe0 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerContext.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerContext.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.jena;
+import static org.apache.juneau.jena.RdfSerializer.*;
+
import java.util.*;
import org.apache.juneau.*;
@@ -19,129 +21,10 @@ import org.apache.juneau.serializer.*;
import org.apache.juneau.xml.*;
/**
- * Configurable properties on the {@link RdfSerializer} 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' id='ConfigProperties'>Configurable properties inherited by the RDF serializers</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 class='jc'>
- * <a class="doclink" href="RdfCommonContext.html#ConfigProperties">RdfCommonContext</a>
- * - Configurable properties common to the RDF serializers and parsers.
- * </ul>
- * </li>
- * </ul>
- * </li>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link RdfSerializer} class.
*/
-public final class RdfSerializerContext extends SerializerContext implements RdfCommonContext {
+public final class RdfSerializerContext extends SerializerContext implements RdfCommon {
- static final String PREFIX = "RdfSerializer.";
-
- /**
- * <b>Configuration property:</b> Add XSI data types to non-<code>String</code> literals.
- *
- * <ul>
- * <li><b>Name:</b> <js>"RdfSerializer.addLiteralTypes"</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>
- */
- public static final String RDF_addLiteralTypes = PREFIX + "addLiteralTypes";
-
- /**
- * <b>Configuration property:</b> Add RDF root identifier property to root node.
- *
- * <ul>
- * <li><b>Name:</b> <js>"RdfSerializer.addRootProperty"</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>
- * When enabled an RDF property <code>http://www.apache.org/juneau/root</code> is added with a value of <js>"true"</js>
- * to identify the root node in the graph.
- * This helps locate the root node during parsing.
- *
- * <p>
- * If disabled, the parser has to search through the model to find any resources without incoming predicates to
- * identify root notes, which can introduce a considerable performance degradation.
- */
- public static final String RDF_addRootProperty = PREFIX + "addRootProperty";
-
- /**
- * <b>Configuration property:</b> Auto-detect namespace usage.
- *
- * <ul>
- * <li><b>Name:</b> <js>"RdfSerializer.autoDetectNamespaces"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Detect namespace usage before serialization.
- *
- * <p>
- * If enabled, then the data structure will first be crawled looking for namespaces that will be encountered before
- * the root element is serialized.
- */
- public static final String RDF_autoDetectNamespaces = PREFIX + "autoDetectNamespaces";
-
- /**
- * <b>Configuration property:</b> Default namespaces.
- *
- * <ul>
- * <li><b>Name:</b> <js>"RdfSerializer.namespaces.list"</js>
- * <li><b>Data type:</b> <code>List<{@link Namespace}></code>
- * <li><b>Default:</b> empty list
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * The default list of namespaces associated with this serializer.
- */
- public static final String RDF_namespaces = PREFIX + "namespaces.list";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"RdfSerializer.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 RDF_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
-
final boolean
addLiteralTypes,
addRootProperty,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java
index 3a6fb25..1f42a0f 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerSession.java
@@ -13,14 +13,13 @@
package org.apache.juneau.jena;
import static org.apache.juneau.jena.Constants.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
-import static org.apache.juneau.jena.RdfSerializerContext.*;
+import static org.apache.juneau.jena.RdfCommon.*;
+import static org.apache.juneau.jena.RdfSerializer.*;
import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.internal.*;
-import org.apache.juneau.msgpack.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.transform.*;
import org.apache.juneau.xml.*;
@@ -97,7 +96,7 @@ public final class RdfSerializerSession extends WriterSerializerSession {
writer = model.getWriter(rdfLanguage);
// Only apply properties with this prefix!
- String propPrefix = RdfCommonContext.LANG_PROP_MAP.get(rdfLanguage);
+ String propPrefix = RdfCommon.LANG_PROP_MAP.get(rdfLanguage);
if (propPrefix == null)
throw new FormattedRuntimeException("Unknown RDF language encountered: ''{0}''", rdfLanguage);
@@ -132,9 +131,9 @@ public final class RdfSerializerSession extends WriterSerializerSession {
}
/**
- * Returns the {@link MsgPackSerializerContext#MSGPACK_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link Serializer#SERIALIZER_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link MsgPackSerializerContext#MSGPACK_addBeanTypeProperties} setting value for this session.
+ * @return The {@link Serializer#SERIALIZER_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-rdf/src/main/java/org/apache/juneau/jena/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/package.html b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/package.html
index 3d35186..f32362c 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/package.html
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/package.html
@@ -342,7 +342,7 @@
<xt></rdf:RDF></xt>
</p>
<p>
- Namespace auto-detection ({@link org.apache.juneau.xml.XmlSerializerContext#XML_autoDetectNamespaces}) is
+ Namespace auto-detection ({@link org.apache.juneau.xml.XmlSerializer#XML_autoDetectNamespaces}) is
enabled on serializers by default.
<br>This causes the serializer to make a first-pass over the data structure to look for namespaces.
<br>In high-performance environments, you may want to consider disabling auto-detection and providing an
@@ -440,9 +440,9 @@
<ja>@URI</ja> <jk>public</jk> String <jf>addressBookUri</jf>;
</p>
<p>
- Also take note of the {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_uriResolution},
- {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_uriRelativity}, and
- and {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_uriContext}
+ Also take note of the {@link org.apache.juneau.serializer.Serializer#SERIALIZER_uriResolution},
+ {@link org.apache.juneau.serializer.Serializer#SERIALIZER_uriRelativity}, and
+ and {@link org.apache.juneau.serializer.Serializer#SERIALIZER_uriContext}
settings that can be specified on the serializer to resolve relative and context-root-relative URIs to
fully-qualified URIs.
</p>
@@ -657,7 +657,7 @@
locate the root at all.
</p>
<p>
- To resolve this issue, the property {@link org.apache.juneau.jena.RdfSerializerContext#RDF_addRootProperty}
+ To resolve this issue, the property {@link org.apache.juneau.jena.RdfSerializer#RDF_addRootProperty}
was introduced.
<br>When enabled, this adds a special <code>root</code> attribute to the root node to make it easy to locate
by the parser.
@@ -716,7 +716,7 @@
<div class='topic'>
<p>
XML-Schema data-types can be added to non-<code>String</code> literals through the
- {@link org.apache.juneau.jena.RdfSerializerContext#RDF_addLiteralTypes} setting.
+ {@link org.apache.juneau.jena.RdfSerializer#RDF_addLiteralTypes} setting.
</p>
<p>
To enable, set the <jsf>RDF_addLiteralTypes</jsf> property to <jk>true</jk> on the serializer:
@@ -773,12 +773,12 @@
The RDF serializer is designed to be used against 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
+ be thrown (if {@link org.apache.juneau.serializer.Serializer#SERIALIZER_maxDepth} is not reached
first).
</p>
<p>
If you still want to use the XML 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/BeanContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
index 762cb1b..8da93b2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
@@ -77,18 +77,18 @@ import org.apache.juneau.transform.*;
* handled. These are denoted as the static <jsf>BEAN_*</jsf> fields on this class.
*
* <p>
- * Some settings (e.g. {@link BeanContext#BEAN_beansRequireDefaultConstructor}) are used to differentiate between bean
+ * Some settings (e.g. {@link #BEAN_beansRequireDefaultConstructor}) are used to differentiate between bean
* and non-bean classes.
* Attempting to create a bean map around one of these objects will throw a {@link BeanRuntimeException}.
* The purpose for this behavior is so that the serializers can identify these non-bean classes and convert them to
* plain strings using the {@link Object#toString()} method.
*
* <p>
- * Some settings (e.g. {@link BeanContext#BEAN_beanFieldVisibility}) are used to determine what kinds of properties are
+ * Some settings (e.g. {@link #BEAN_beanFieldVisibility}) are used to determine what kinds of properties are
* detected on beans.
*
* <p>
- * Some settings (e.g. {@link BeanContext#BEAN_beanMapPutReturnsOldValue}) change the runtime behavior of bean maps.
+ * Some settings (e.g. {@link #BEAN_beanMapPutReturnsOldValue}) change the runtime behavior of bean maps.
*
* <p>
* Settings are specified using the {@link PropertyStore#setProperty(String, Object)} method and related convenience
@@ -871,7 +871,7 @@ public class BeanContext extends Context {
* When bean getters throws exceptions, the exception includes the object stack information
* in order to determine how that method was invoked.
* <li>
- * Enables {@link SerializerContext#SERIALIZER_detectRecursions}.
+ * Enables {@link Serializer#SERIALIZER_detectRecursions}.
* </ul>
*
* <p>
@@ -1585,7 +1585,7 @@ public class BeanContext extends Context {
}
/**
- * Returns the type property name as defined by {@link BeanContext#BEAN_beanTypePropertyName}.
+ * Returns the type property name as defined by {@link #BEAN_beanTypePropertyName}.
*
* @return The type property name. Never <jk>null</jk>.
*/
@@ -1594,7 +1594,7 @@ public class BeanContext extends Context {
}
/**
- * Returns the bean registry defined in this bean context defined by {@link BeanContext#BEAN_beanDictionary}.
+ * Returns the bean registry defined in this bean context defined by {@link #BEAN_beanDictionary}.
*
* @return The bean registry defined in this bean context. Never <jk>null</jk>.
*/
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
index 0a4d78d..4382b38 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
@@ -120,9 +120,9 @@ public class BeanSession extends Session {
}
/**
- * Returns the {@link SerializerContext#BEAN_debug} setting value for this session.
+ * Returns the {@link BeanContext#BEAN_debug} setting value for this session.
*
- * @return The {@link SerializerContext#BEAN_debug} setting value for this session.
+ * @return The {@link BeanContext#BEAN_debug} setting value for this session.
*/
public final boolean isDebug() {
return debug;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/CoreObjectBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/CoreObjectBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/CoreObjectBuilder.java
index 2049e25..74bbdb8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/CoreObjectBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/CoreObjectBuilder.java
@@ -1595,7 +1595,7 @@ public abstract class CoreObjectBuilder {
* When bean getters throws exceptions, the exception includes the object stack information
* in order to determine how that method was invoked.
* <li>
- * Enables {@link SerializerContext#SERIALIZER_detectRecursions}.
+ * Enables {@link Serializer#SERIALIZER_detectRecursions}.
* </ul>
*
* <p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java
index 192664b..8b73a65 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java
@@ -34,7 +34,7 @@ import org.apache.juneau.serializer.*;
*
* <p>
* URIs are automatically resolved to absolute or root-relative form based on the serializer
- * {@link SerializerContext#SERIALIZER_uriResolution} and {@link SerializerContext#SERIALIZER_uriRelativity}
+ * {@link Serializer#SERIALIZER_uriResolution} and {@link Serializer#SERIALIZER_uriRelativity}
* configuration settings, and the URI context defined by the {@link UriContext} that's part of the serializer
* session.
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java
index 450902a..4932b68 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java
@@ -20,9 +20,18 @@ import org.apache.juneau.parser.*;
*/
public class CsvParser extends ReaderParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final CsvParser DEFAULT = new CsvParser(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final CsvParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserContext.java
index 93c5f57..d6f4298 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserContext.java
@@ -16,26 +16,7 @@ import org.apache.juneau.*;
import org.apache.juneau.parser.*;
/**
- * Configurable properties on the {@link CsvParser} 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>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link CsvParser} class.
*/
public final class CsvParserContext extends ParserContext {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java
index 2593175..9f757d6 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java
@@ -20,9 +20,18 @@ import org.apache.juneau.serializer.*;
*/
public final class CsvSerializer extends WriterSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings.*/
public static final CsvSerializer DEFAULT = new CsvSerializer(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final CsvSerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerContext.java
index 3c8c77b..db79a3b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerContext.java
@@ -16,26 +16,7 @@ import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
/**
- * Configurable properties on the {@link CsvSerializer} 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>
- * </ul>
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link CsvSerializer} class.
*/
public final class CsvSerializerContext extends SerializerContext {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/AnchorText.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/AnchorText.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/AnchorText.java
index 8b2f7ce..3fa31b4 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/AnchorText.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/AnchorText.java
@@ -13,7 +13,7 @@
package org.apache.juneau.html;
/**
- * Identifies possible values for the {@link HtmlSerializerContext#HTML_uriAnchorText} setting.
+ * Identifies possible values for the {@link HtmlSerializer#HTML_uriAnchorText} setting.
*/
public enum AnchorText {
[2/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
index 2a81c03..647e794 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
@@ -12,9 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
-import static org.apache.juneau.serializer.SerializerContext.*;
-import static org.apache.juneau.xml.XmlSerializerContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.json.*;
import org.apache.juneau.serializer.*;
@@ -104,14 +101,6 @@ import org.apache.juneau.serializer.*;
* If an attribute name contains any non-valid XML element characters, they will be escaped using standard
* {@code _x####_} notation.
*
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link XmlSerializerContext}
- * <li>{@link BeanContext}
- * </ul>
- *
* <h6 class='topic'>Behavior-specific subclasses</h6>
*
* The following direct subclasses are provided for convenience:
@@ -122,6 +111,152 @@ import org.apache.juneau.serializer.*;
*/
public class XmlSerializer extends WriterSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "XmlSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Enable support for XML namespaces.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlSerializer.enableNamespaces"</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 not enabled, XML output will not contain any namespaces regardless of any other settings.
+ */
+ public static final String XML_enableNamespaces = PREFIX + "enableNamespaces";
+
+ /**
+ * <b>Configuration property:</b> Auto-detect namespace usage.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlSerializer.autoDetectNamespaces"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Detect namespace usage before serialization.
+ *
+ * <p>
+ * Used in conjunction with {@link #XML_addNamespaceUrisToRoot} to reduce the list of namespace URLs appended to the
+ * root element to only those that will be used in the resulting document.
+ *
+ * <p>
+ * If enabled, then the data structure will first be crawled looking for namespaces that will be encountered before
+ * the root element is serialized.
+ *
+ * <p>
+ * This setting is ignored if {@link #XML_enableNamespaces} is not enabled.
+ *
+ * <h5 class='section'>Notes:</h5>
+ * <ul>
+ * <li>Auto-detection of namespaces can be costly performance-wise.
+ * In high-performance environments, it's recommended that namespace detection be
+ * disabled, and that namespaces be manually defined through the {@link #XML_namespaces} property.
+ * </ul>
+ */
+ public static final String XML_autoDetectNamespaces = PREFIX + "autoDetectNamespaces";
+
+ /**
+ * <b>Configuration property:</b> Add namespace URLs to the root element.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlSerializer.addNamespaceUrisToRoot"</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>
+ * Use this setting to add {@code xmlns:x} attributes to the root element for the default and all mapped namespaces.
+ *
+ * <p>
+ * This setting is ignored if {@link #XML_enableNamespaces} is not enabled.
+ */
+ public static final String XML_addNamespaceUrisToRoot = PREFIX + "addNamespaceUrisToRoot";
+
+ /**
+ * <b>Configuration property:</b> Default namespace.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlSerializer.defaultNamespace"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"{juneau:'http://www.apache.org/2013/Juneau'}"</js>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Specifies the default namespace URI for this document.
+ */
+ public static final String XML_defaultNamespace = PREFIX + "defaultNamespace";
+
+ /**
+ * <b>Configuration property:</b> XMLSchema namespace.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlSerializer.xsNamespace"</js>
+ * <li><b>Data type:</b> {@link Namespace}
+ * <li><b>Default:</b> <code>{name:<js>'xs'</js>,uri:<js>'http://www.w3.org/2001/XMLSchema'</js>}</code>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Specifies the namespace for the <code>XMLSchema</code> namespace, used by the schema generated by the
+ * {@link XmlSchemaSerializer} class.
+ */
+ public static final String XML_xsNamespace = PREFIX + "xsNamespace";
+
+ /**
+ * <b>Configuration property:</b> Default namespaces.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlSerializer.namespaces"</js>
+ * <li><b>Data type:</b> <code>Set<{@link Namespace}></code>
+ * <li><b>Default:</b> empty set
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * The default list of namespaces associated with this serializer.
+ */
+ public static final String XML_namespaces = PREFIX + "namespaces.list";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"XmlSerializer.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 XML_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer without namespaces. */
public static final XmlSerializer DEFAULT = new XmlSerializer(PropertyStore.create());
@@ -141,6 +276,10 @@ public class XmlSerializer extends WriterSerializer {
public static final XmlSerializer DEFAULT_NS_SQ_READABLE = new NsSqReadable(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, single quotes. */
public static class Sq extends XmlSerializer {
@@ -208,6 +347,10 @@ public class XmlSerializer extends WriterSerializer {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
final XmlSerializerContext ctx;
private volatile XmlSchemaSerializer schemaSerializer;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
index 0a5cf30..e09cd21 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
-import static org.apache.juneau.xml.XmlSerializerContext.*;
+import static org.apache.juneau.xml.XmlSerializer.*;
import java.util.*;
@@ -72,7 +72,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlSerializerContext#XML_enableNamespaces
+ * @see XmlSerializer#XML_enableNamespaces
*/
public XmlSerializerBuilder enableNamespaces(boolean value) {
return property(XML_enableNamespaces, value);
@@ -101,7 +101,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
* Detect namespace usage before serialization.
*
* <p>
- * Used in conjunction with {@link XmlSerializerContext#XML_addNamespaceUrisToRoot} to reduce the list of namespace
+ * Used in conjunction with {@link XmlSerializer#XML_addNamespaceUrisToRoot} to reduce the list of namespace
* URLs appended to the root element to only those that will be used in the resulting document.
*
* <p>
@@ -109,13 +109,13 @@ public class XmlSerializerBuilder extends SerializerBuilder {
* the root element is serialized.
*
* <p>
- * This setting is ignored if {@link XmlSerializerContext#XML_enableNamespaces} is not enabled.
+ * This setting is ignored if {@link XmlSerializer#XML_enableNamespaces} is not enabled.
*
* <h5 class='section'>Notes:</h5>
* <ul>
* <li>Auto-detection of namespaces can be costly performance-wise.
* In high-performance environments, it's recommended that namespace detection be disabled, and that
- * namespaces be manually defined through the {@link XmlSerializerContext#XML_namespaces} property.
+ * namespaces be manually defined through the {@link XmlSerializer#XML_namespaces} property.
* </ul>
*
* <h5 class='section'>Notes:</h5>
@@ -126,7 +126,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlSerializerContext#XML_autoDetectNamespaces
+ * @see XmlSerializer#XML_autoDetectNamespaces
*/
public XmlSerializerBuilder autoDetectNamespaces(boolean value) {
return property(XML_autoDetectNamespaces, value);
@@ -146,7 +146,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
* Use this setting to add {@code xmlns:x} attributes to the root element for the default and all mapped namespaces.
*
* <p>
- * This setting is ignored if {@link XmlSerializerContext#XML_enableNamespaces} is not enabled.
+ * This setting is ignored if {@link XmlSerializer#XML_enableNamespaces} is not enabled.
*
* <h5 class='section'>Notes:</h5>
* <ul>
@@ -156,7 +156,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlSerializerContext#XML_addNamespaceUrisToRoot
+ * @see XmlSerializer#XML_addNamespaceUrisToRoot
*/
public XmlSerializerBuilder addNamespaceUrisToRoot(boolean value) {
return property(XML_addNamespaceUrisToRoot, value);
@@ -183,7 +183,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlSerializerContext#XML_defaultNamespace
+ * @see XmlSerializer#XML_defaultNamespace
*/
public XmlSerializerBuilder defaultNamespace(String value) {
return property(XML_defaultNamespace, value);
@@ -211,7 +211,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see XmlSerializerContext#XML_xsNamespace
+ * @see XmlSerializer#XML_xsNamespace
*/
public XmlSerializerBuilder xsNamespace(Namespace value) {
return property(XML_xsNamespace, value);
@@ -238,7 +238,7 @@ public class XmlSerializerBuilder extends SerializerBuilder {
*
* @param values The new value for this property.
* @return This object (for method chaining).
- * @see XmlSerializerContext#XML_namespaces
+ * @see XmlSerializer#XML_namespaces
*/
public XmlSerializerBuilder namespaces(Namespace...values) {
return property(XML_namespaces, values);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerContext.java
index 0a5b26c..e9cd107 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerContext.java
@@ -12,172 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
+import static org.apache.juneau.xml.XmlSerializer.*;
+
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
/**
- * Configurable properties on the {@link XmlSerializer} 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 XmlSerializer} class.
*/
public class XmlSerializerContext extends SerializerContext {
- static final String PREFIX = "XmlSerializer.";
-
- /**
- * <b>Configuration property:</b> Enable support for XML namespaces.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlSerializer.enableNamespaces"</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 not enabled, XML output will not contain any namespaces regardless of any other settings.
- */
- public static final String XML_enableNamespaces = PREFIX + "enableNamespaces";
-
- /**
- * <b>Configuration property:</b> Auto-detect namespace usage.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlSerializer.autoDetectNamespaces"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Detect namespace usage before serialization.
- *
- * <p>
- * Used in conjunction with {@link #XML_addNamespaceUrisToRoot} to reduce the list of namespace URLs appended to the
- * root element to only those that will be used in the resulting document.
- *
- * <p>
- * If enabled, then the data structure will first be crawled looking for namespaces that will be encountered before
- * the root element is serialized.
- *
- * <p>
- * This setting is ignored if {@link #XML_enableNamespaces} is not enabled.
- *
- * <h5 class='section'>Notes:</h5>
- * <ul>
- * <li>Auto-detection of namespaces can be costly performance-wise.
- * In high-performance environments, it's recommended that namespace detection be
- * disabled, and that namespaces be manually defined through the {@link #XML_namespaces} property.
- * </ul>
- */
- public static final String XML_autoDetectNamespaces = PREFIX + "autoDetectNamespaces";
-
- /**
- * <b>Configuration property:</b> Add namespace URLs to the root element.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlSerializer.addNamespaceUrisToRoot"</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>
- * Use this setting to add {@code xmlns:x} attributes to the root element for the default and all mapped namespaces.
- *
- * <p>
- * This setting is ignored if {@link #XML_enableNamespaces} is not enabled.
- */
- public static final String XML_addNamespaceUrisToRoot = PREFIX + "addNamespaceUrisToRoot";
-
- /**
- * <b>Configuration property:</b> Default namespace.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlSerializer.defaultNamespace"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"{juneau:'http://www.apache.org/2013/Juneau'}"</js>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Specifies the default namespace URI for this document.
- */
- public static final String XML_defaultNamespace = PREFIX + "defaultNamespace";
-
- /**
- * <b>Configuration property:</b> XMLSchema namespace.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlSerializer.xsNamespace"</js>
- * <li><b>Data type:</b> {@link Namespace}
- * <li><b>Default:</b> <code>{name:<js>'xs'</js>,uri:<js>'http://www.w3.org/2001/XMLSchema'</js>}</code>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Specifies the namespace for the <code>XMLSchema</code> namespace, used by the schema generated by the
- * {@link XmlSchemaSerializer} class.
- */
- public static final String XML_xsNamespace = PREFIX + "xsNamespace";
-
- /**
- * <b>Configuration property:</b> Default namespaces.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlSerializer.namespaces"</js>
- * <li><b>Data type:</b> <code>Set<{@link Namespace}></code>
- * <li><b>Default:</b> empty set
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * The default list of namespaces associated with this serializer.
- */
- public static final String XML_namespaces = PREFIX + "namespaces.list";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"XmlSerializer.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 XML_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
-
final boolean
autoDetectNamespaces,
enableNamespaces,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
index 4eae96e..ea65b11 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
@@ -15,7 +15,7 @@ package org.apache.juneau.xml;
import static org.apache.juneau.xml.NamespaceFactory.*;
import static org.apache.juneau.xml.XmlSerializerSession.ContentResult.*;
import static org.apache.juneau.xml.XmlSerializerSession.JsonType.*;
-import static org.apache.juneau.xml.XmlSerializerContext.*;
+import static org.apache.juneau.xml.XmlSerializer.*;
import static org.apache.juneau.xml.annotation.XmlFormat.*;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.internal.ArrayUtils.*;
@@ -120,9 +120,9 @@ public class XmlSerializerSession extends WriterSerializerSession {
}
/**
- * Returns the {@link XmlSerializerContext#XML_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link XmlSerializer#XML_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link XmlSerializerContext#XML_addBeanTypeProperties} setting value for this session.
+ * @return The {@link XmlSerializer#XML_addBeanTypeProperties} setting value for this session.
*/
@Override /* SerializerSession */
protected boolean isAddBeanTypeProperties() {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/package.html b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/package.html
index 4136008..2584818 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/package.html
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/package.html
@@ -2162,7 +2162,7 @@
<div class='topic'>
<p>
One important property on the XML serializer class is
- {@link org.apache.juneau.xml.XmlSerializerContext#XML_autoDetectNamespaces XML_autoDetectNamespaces}.
+ {@link org.apache.juneau.xml.XmlSerializer#XML_autoDetectNamespaces XML_autoDetectNamespaces}.
<br>This property tells the serializer to make a first-pass over the data structure to look for namespaces
defined on classes and bean properties.
<br>In high-performance environments, you may want to consider disabling auto-detection and providing your
@@ -2714,12 +2714,12 @@
The XML 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
+ be thrown (if {@link org.apache.juneau.serializer.Serializer#SERIALIZER_maxDepth} is not reached
first).
</p>
<p>
If you still want to use the XML 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/yaml/proto/YamlParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParser.java
index 5ddcf33..483338e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParser.java
@@ -12,8 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.yaml.proto;
-import static org.apache.juneau.parser.ParserContext.*;
-
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
@@ -99,22 +97,24 @@ import org.apache.juneau.parser.*;
* {@link ObjectMap#ObjectMap(CharSequence) ObjectMap(CharSequence)} or {@link ObjectList#ObjectList(CharSequence)
* ObjectList(CharSequence)} constructors instead of using this class.
* The end result should be the same.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link YamlParserContext}
- * </ul>
*/
public class YamlParser extends ReaderParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final YamlParser DEFAULT = new YamlParser(PropertyStore.create());
/** Default parser, all default settings.*/
public static final YamlParser DEFAULT_STRICT = new YamlParser.Strict(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, strict mode. */
public static class Strict extends YamlParser {
@@ -129,6 +129,10 @@ public class YamlParser extends ReaderParser {
}
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final YamlParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParserContext.java
index c7a0c20..4b0661d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlParserContext.java
@@ -16,27 +16,7 @@ import org.apache.juneau.*;
import org.apache.juneau.parser.*;
/**
- * Configurable properties on the {@link YamlParser} 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 YamlParser} class.
*/
public final class YamlParserContext extends ParserContext {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializer.java
index c8598b5..9be89e7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializer.java
@@ -61,15 +61,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 YamlSerializerContext}
- * <li>{@link SerializerContext}
- * <li>{@link BeanContext}
- * </ul>
- *
* <h5 class='section'>Example:</h5>
* <p class='bcode'>
* <jc>// Use one of the default serializers to serialize a POJO</jc>
@@ -87,10 +78,82 @@ import org.apache.juneau.serializer.*;
*/
public class YamlSerializer extends WriterSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "YamlSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Simple JSON mode.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"JsonSerializer.simpleMode"</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>, JSON attribute names will only be quoted when necessary.
+ * Otherwise, they are always quoted.
+ */
+ public static final String YAML_simpleMode = PREFIX + "simpleMode";
+
+ /**
+ * <b>Configuration property:</b> Prefix solidus <js>'/'</js> characters with escapes.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"JsonSerializer.escapeSolidus"</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>, solidus (e.g. slash) characters should be escaped.
+ * The JSON specification allows for either format.
+ * However, if you're embedding JSON in an HTML script tag, this setting prevents confusion when trying to serialize
+ * <xt><\/script></xt>.
+ */
+ public static final String YAML_escapeSolidus = PREFIX + "escapeSolidus";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"JsonSerializer.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 YAML_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings.*/
public static final YamlSerializer DEFAULT = new YamlSerializer(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
final YamlSerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerBuilder.java
index 69bdcb4..4535a7f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.yaml.proto;
-import static org.apache.juneau.json.JsonSerializerContext.*;
+import static org.apache.juneau.yaml.proto.YamlSerializer.*;
import java.util.*;
@@ -72,10 +72,10 @@ public class YamlSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see YamlSerializerContext#JSON_simpleMode
+ * @see #YAML_simpleMode
*/
public YamlSerializerBuilder simple(boolean value) {
- return property(JSON_simpleMode, value);
+ return property(YAML_simpleMode, value);
}
/**
@@ -110,10 +110,10 @@ public class YamlSerializerBuilder extends SerializerBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see YamlSerializerContext#JSON_escapeSolidus
+ * @see #YAML_escapeSolidus
*/
public YamlSerializerBuilder escapeSolidus(boolean value) {
- return property(JSON_escapeSolidus, value);
+ return property(YAML_escapeSolidus, value);
}
@Override /* SerializerBuilder */
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerContext.java
index f847575..2179131 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerContext.java
@@ -12,93 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.yaml.proto;
+import static org.apache.juneau.yaml.proto.YamlSerializer.*;
+
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
/**
- * Configurable properties on the {@link YamlSerializer} 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 YamlSerializer} class.
*/
public final class YamlSerializerContext extends SerializerContext {
- static final String PREFIX = "YamlSerializer.";
-
- /**
- * <b>Configuration property:</b> Simple JSON mode.
- *
- * <ul>
- * <li><b>Name:</b> <js>"JsonSerializer.simpleMode"</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>, JSON attribute names will only be quoted when necessary.
- * Otherwise, they are always quoted.
- */
- public static final String JSON_simpleMode = PREFIX + "simpleMode";
-
- /**
- * <b>Configuration property:</b> Prefix solidus <js>'/'</js> characters with escapes.
- *
- * <ul>
- * <li><b>Name:</b> <js>"JsonSerializer.escapeSolidus"</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>, solidus (e.g. slash) characters should be escaped.
- * The JSON specification allows for either format.
- * However, if you're embedding JSON in an HTML script tag, this setting prevents confusion when trying to serialize
- * <xt><\/script></xt>.
- */
- public static final String JSON_escapeSolidus = PREFIX + "escapeSolidus";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"JsonSerializer.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 JSON_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
final boolean
simpleMode,
escapeSolidus,
@@ -114,16 +37,16 @@ public final class YamlSerializerContext extends SerializerContext {
*/
public YamlSerializerContext(PropertyStore ps) {
super(ps);
- simpleMode = ps.getProperty(JSON_simpleMode, boolean.class, false);
- escapeSolidus = ps.getProperty(JSON_escapeSolidus, boolean.class, false);
- addBeanTypeProperties = ps.getProperty(JSON_addBeanTypeProperties, boolean.class,
+ simpleMode = ps.getProperty(YAML_simpleMode, boolean.class, false);
+ escapeSolidus = ps.getProperty(YAML_escapeSolidus, boolean.class, false);
+ addBeanTypeProperties = ps.getProperty(YAML_addBeanTypeProperties, boolean.class,
ps.getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true));
}
@Override /* Context */
public ObjectMap asMap() {
return super.asMap()
- .append("JsonSerializerContext", new ObjectMap()
+ .append("YamlSerializerContext", new ObjectMap()
.append("simpleMode", simpleMode)
.append("escapeSolidus", escapeSolidus)
.append("addBeanTypeProperties", addBeanTypeProperties)
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerSession.java
index 3dd9b18..35a9243 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/YamlSerializerSession.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.yaml.proto;
-import static org.apache.juneau.json.JsonSerializerContext.*;
+import static org.apache.juneau.yaml.proto.YamlSerializer.*;
import java.util.*;
@@ -51,7 +51,7 @@ public class YamlSerializerSession extends WriterSerializerSession {
if (p.isEmpty()) {
addBeanTypeProperties = ctx.addBeanTypeProperties;
} else {
- addBeanTypeProperties = p.getBoolean(JSON_addBeanTypeProperties, ctx.addBeanTypeProperties);
+ addBeanTypeProperties = p.getBoolean(YAML_addBeanTypeProperties, ctx.addBeanTypeProperties);
}
}
@@ -224,9 +224,9 @@ public class YamlSerializerSession extends WriterSerializerSession {
/**
- * Returns the {@link YamlSerializerContext#JSON_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link #YAML_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link YamlSerializerContext#JSON_addBeanTypeProperties} setting value for this session.
+ * @return The {@link #YAML_addBeanTypeProperties} setting value for this session.
*/
@Override /* SerializerSession */
protected 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/yaml/proto/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/package.html b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/package.html
index 3c3e845..9e1598a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/package.html
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/yaml/proto/package.html
@@ -647,12 +647,12 @@
The JSON 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
+ be thrown (if {@link org.apache.juneau.serializer.Serializer#SERIALIZER_maxDepth} is not reached
first).
</p>
<p>
If you still want to use the JSON 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-doc/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/juneau-doc/src/main/javadoc/overview.html b/juneau-doc/src/main/javadoc/overview.html
index c1cdf86..8e878ab 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -970,7 +970,7 @@
</div>
<!-- ======================================================================================================= -->
- <a id="juneau-marshall-Transforms"></a>
+ <a id="juneau-marshall.Transforms"></a>
<h4 class='topic' onclick='toggle(this)'>2.1.6 - Transforms</h4>
<div class='topic'>
<p>
@@ -1618,7 +1618,7 @@
<li class='info'>
Serialized type names are DISABLED by default.
They must be enabled on the serializer using the
- {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_addBeanTypeProperties}
+ {@link org.apache.juneau.serializer.Serializer#SERIALIZER_addBeanTypeProperties}
configuration property.
<li class='info'>
The <js>"_type"</js> property name can be overridden using the
@@ -2113,7 +2113,7 @@
Reuse instances of serializers and parsers whenever possible.
<br>They are designed to be thread safe and maintain internal caches of bean metadata to increase performance.
<li>
- The {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_detectRecursions SERIALIZER_detectRecursions}
+ The {@link org.apache.juneau.serializer.Serializer#SERIALIZER_detectRecursions SERIALIZER_detectRecursions}
option on the {@link org.apache.juneau.serializer.Serializer} class can cause a performance penalty of
around 20%.
Therefore, it's recommended that this option be used only when necessary.
@@ -5753,7 +5753,7 @@
<li>
You are setting <l>XML_enableNamespaces</l> to <l>true</l> to enable XML namespaces.
By default, XML namespace support is disabled per
- {@link org.apache.juneau.xml.XmlSerializerContext#XML_enableNamespaces}, so you have to explicitly
+ {@link org.apache.juneau.xml.XmlSerializer#XML_enableNamespaces}, so you have to explicitly
enable it on our serializers.
<li>
The <l>XML_autoDetectNamespaces</l> setting is needed to get the XML serializer to add <l>xmlns</l>
@@ -8000,9 +8000,9 @@
<li>
New/modified settings in {@link org.apache.juneau.html.HtmlDocSerializerContext}:
<ul>
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_script HTMLDOC_script}
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_style HTMLDOC_style} - Was <jsf>HTMLDOC_css</jsf>.
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_stylesheet HTMLDOC_stylesheet} - Was <jsf>HTMLDOC_cssUrl</jsf>. Now an array.
+ <li><code><del>HTMLDOC_script</del></code>
+ <li><code><del>HTMLDOC_style</del></code> - Was <jsf>HTMLDOC_css</jsf>.
+ <li><code><del>HTMLDOC_stylesheet</del></code> - Was <jsf>HTMLDOC_cssUrl</jsf>. Now an array.
</ul>
<li>
New {@link org.apache.juneau.utils.ResourceFinder} utility class.
@@ -8291,10 +8291,10 @@
<li>{@link org.apache.juneau.UriResolver}
</ul>
<li>New configuration properties:
- <li>{@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_uriContext}
- <li>{@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_uriRelativity}
- <li>{@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_uriResolution}
- <li>{@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_maxIndent}
+ <li><code><del>SerializerContext.SERIALIZER_uriContext</del></code>
+ <li><code><del>SerializerContext.SERIALIZER_uriRelativity</del></code>
+ <li><code><del>SerializerContext.SERIALIZER_uriResolution</del></code>
+ <li><code><del>SerializerContext.SERIALIZER_maxIndent</del></code>
</ul>
<li>New annotation property: {@link org.apache.juneau.annotation.BeanProperty#value()}.
<br>The following two annotations are considered equivalent:
@@ -8304,7 +8304,7 @@
<ja>@BeanProperty</ja>(<js>"foo"</js>)
</p>
<li>Fixed a race condition in ClassMeta.
- <li><jsf>URLENC_paramFormat</jsf> has been moved to {@link org.apache.juneau.uon.UonSerializerContext#UON_paramFormat},
+ <li><jsf>URLENC_paramFormat</jsf> has been moved to <code><del>UonSerializer.UON_paramFormat</del></code>,
and the UON/URL-Encoding serializers will now always serialize all values as plain text.
<br>This means that arrays and maps are converted to simple comma-delimited lists.
<li>Listener APIs added to serializers and parsers:
@@ -8334,14 +8334,14 @@
<li><code><del>HtmlDocSerializerContext.HTMLDOC_title</del></code>
<li><code><del>HtmlDocSerializerContext.HTMLDOC_description</del></code>
<li><code><del>HtmlDocSerializerContext.HTMLDOC_branding</del></code>
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_header}
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_nav}
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_aside}
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_footer}
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_noResultsMessage}
+ <li><code><del>HtmlDocSerializerContext.HTMLDOC_header</del></code>
+ <li><code><del>HtmlDocSerializerContext.HTMLDOC_nav</del></code>
+ <li><code><del>HtmlDocSerializerContext.HTMLDOC_aside</del></code>
+ <li><code><del>HtmlDocSerializerContext.HTMLDOC_footer</del></code>
+ <li><code><del>HtmlDocSerializerContext.HTMLDOC_noResultsMessage</del></code>
<li><code><del>HtmlDocSerializerContext.HTMLDOC_cssUrl</del></code>
<li><code><del>HtmlDocSerializerContext.HTMLDOC_css</del></code>
- <li>{@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_template}
+ <li><code><del>HtmlDocSerializerContext.HTMLDOC_template</del></code>
</ul>
<li>New interface {@link org.apache.juneau.html.HtmlDocTemplate} that allows full control over rendering
of HTML produced by {@link org.apache.juneau.html.HtmlDocSerializer}.
@@ -8646,15 +8646,15 @@
<li>Revamped the config file API to use a build: {@link org.apache.juneau.ini.ConfigFileBuilder}.
<li>Removed the <code><del>Lockable</del></code> interface.
<li>New <code>addBeanTypeProperties</code> setting added to serializers to override the
- {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_addBeanTypeProperties} setting
+ <code><del>SerializerContext.SERIALIZER_addBeanTypeProperties</del></code> setting
for individual serializers in a serializer group:
<ul>
- <li>{@link org.apache.juneau.html.HtmlSerializerContext#HTML_addBeanTypeProperties}
- <li>{@link org.apache.juneau.json.JsonSerializerContext#JSON_addBeanTypeProperties}
- <li>{@link org.apache.juneau.msgpack.MsgPackSerializerContext#MSGPACK_addBeanTypeProperties}
- <li>{@link org.apache.juneau.uon.UonSerializerContext#UON_addBeanTypeProperties}
- <li>{@link org.apache.juneau.xml.XmlSerializerContext#XML_addBeanTypeProperties}
- <li>{@link org.apache.juneau.jena.RdfSerializerContext#RDF_addBeanTypeProperties}
+ <li><code><del>HtmlSerializerContext.HTML_addBeanTypeProperties</del></code>
+ <li><code><del>JsonSerializerContext.JSON_addBeanTypeProperties</del></code>
+ <li><code><del>MsgPackSerializerContext.MSGPACK_addBeanTypeProperties</del></code>
+ <li><code><del>UonSerializerContext.UON_addBeanTypeProperties</del></code>
+ <li><code><del>XmlSerializerContext.#XML_addBeanTypeProperties</del></code>
+ <li><code><del>RdfSerializerContext.RDF_addBeanTypeProperties</del></code>
</ul>
<li>UON notation serializers and parsers moved into the new <code>org.apache.juneau.uon</code> package.
<li>New {@link org.apache.juneau.xml.annotation.XmlFormat#VOID} format to identify HTML void elements.
@@ -8690,7 +8690,7 @@
<li>{@link org.apache.juneau.dto.html5.HtmlElementContainer#getChild(int...)}
<li>{@link org.apache.juneau.dto.html5.HtmlElementMixed#getChild(int...)}
</ul>
- <li>New common serializer setting: {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_abridged}.
+ <li>New common serializer setting: <code><del>SerializerContext.SERIALIZER_abridged</del></code>.
<li>Support for defining interface proxies against 3rd-party REST interfaces.
<br>New package {@link org.apache.juneau.remoteable} for all remoteable proxy interface annotations.
<br><ja>@Remoteable</ja> annotation has been moved to this package.
@@ -9102,9 +9102,9 @@
and replaced them with the ability to define subtypes using the existing {@link org.apache.juneau.annotation.Bean#beanDictionary() @Bean.beanDictionary()}
annotation on parent classes and interfaces.
<br>This has the added benefit of simplifying the overall code.
- <li>The {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_addBeanTypeProperties} setting is now enabled by default.
+ <li>The <code><del>SerializerContext.SERIALIZER_addBeanTypeProperties</del></code> setting is now enabled by default.
<li>Combined the <code>SERIALIZER_addIndentation</code>/<code>JSON_addWhitespace</code>/<code>UON_addWhitespace</code>
- properties into a single {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_useWhitespace} setting.
+ properties into a single <code><del>SerializerContext.SERIALIZER_useWhitespace</del></code> setting.
</ul>
<h6 class='topic'>org.apache.juneau.rest</h6>
@@ -9155,9 +9155,9 @@
</ul>
<li>New properties in {@link org.apache.juneau.parser.ParserContext}.
<ul>
- <li>{@link org.apache.juneau.parser.ParserContext#PARSER_strict}
- <li>{@link org.apache.juneau.parser.ParserContext#PARSER_inputStreamCharset}
- <li>{@link org.apache.juneau.parser.ParserContext#PARSER_fileCharset}
+ <li><code><del>ParserContext.PARSER_strict</del></code>
+ <li><code><del>ParserContext.PARSER_inputStreamCharset</del></code>
+ <li><code><del>ParserContext.PARSER_fileCharset</del></code>
</ul>
<li>Removed <code>JsonParserContext.JSON_strictMode</code>. Replaced by <code>PARSER_strict</code>.
<li><code><jk>byte[]</jk></code> arrays can now be passed to {@link org.apache.juneau.parser.Parser#parse(Object,Class)} for reader-based parsers.
@@ -9212,7 +9212,7 @@
<li>{@link org.apache.juneau.BeanContext#BEAN_beanTypePropertyName} - The overridable type property name. Default is <js>"_type"</js>.
<li>{@link org.apache.juneau.annotation.BeanProperty#beanDictionary() @BeanProperty.beanDictionary()} - Define a type dictionary
for a particular bean property value. This overrides the value specified using {@link org.apache.juneau.BeanContext#BEAN_beanDictionary}.
- <li>{@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_addBeanTypeProperties} - Controls whether type properties are serialized.
+ <li><code><del>SerializerContext.SERIALIZER_addBeanTypeProperties</del></code> - Controls whether type properties are serialized.
</ul>
In addition, the {@link org.apache.juneau.annotation.Bean#typeName() @Bean.typeName()} value replaces the <code>@Xml.name()</code> annotation, and the
<js>"type"</js> and <js>"_class"</js> attributes in the XML and HTML serializers have been standardized on a single <js>"_type"</js> attribute.
@@ -9249,10 +9249,10 @@
<li>Various enhancements to <code><del>BeanContext.convertToType(Object,Class)</del></code>.
<li>New properties on {@link org.apache.juneau.html.HtmlSerializer}:
<ul>
- <li>{@link org.apache.juneau.html.HtmlSerializerContext#HTML_detectLinksInStrings} - Automatically detect hyperlinks in strings.
- <li>{@link org.apache.juneau.html.HtmlSerializerContext#HTML_lookForLabelParameters} - Specify anchor text by appending <code>&label=MyLabel</code> to URL.
- <li>{@link org.apache.juneau.html.HtmlSerializerContext#HTML_labelParameter} - Specify what URL parameter to use as the anchor text label.
- <li>New {@link org.apache.juneau.html.HtmlSerializerContext#URI_ANCHOR} option for {@link org.apache.juneau.html.HtmlSerializerContext#HTML_uriAnchorText}.
+ <li><code><del>HtmlSerializerContext.HTML_detectLinksInStrings</del></code> - Automatically detect hyperlinks in strings.
+ <li><code><del>HtmlSerializerContext.HTML_lookForLabelParameters</del></code> - Specify anchor text by appending <code>&label=MyLabel</code> to URL.
+ <li><code><del>HtmlSerializerContext.HTML_labelParameter</del></code> - Specify what URL parameter to use as the anchor text label.
+ <li><code><del>HtmlSerializerContext.URI_ANCHOR</del></code> option for <code><del>HtmlSerializerContext.HTML_uriAnchorText</del></code>.
</ul>
</li>
<li>Removed generics from {@link org.apache.juneau.BeanPropertyMeta}.
@@ -9360,8 +9360,8 @@
<li>New <code>ClassFilter</code> class.
<li><del><code>ConfigFile.getResolving(StringVarResolver,boolean)</code></del> method.
<li><del><code>ConfigFile.getStringVar()</code></del> method.
- <li>New {@link org.apache.juneau.parser.ParserContext#PARSER_trimStrings} property.
- <li>New {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_trimStrings} property.
+ <li>New <code><del>ParserContext.PARSER_trimStrings</del></code> property.
+ <li>New <code><del>SerializerContext.SERIALIZER_trimStrings</del></code> property.
<li><del><code>Args.getStringVar()}</code></del> method.
<li>New {@link org.apache.juneau.utils.ManifestFile} class
<li>New {@link org.apache.juneau.utils.MessageBundle} class. Replaces <l>SafeResourceBundle</l>/<l>SafeResourceMultiBundle</l>/<l>RestNls</l>.
@@ -10010,7 +10010,7 @@
<li>Fixed bug in {@link org.apache.juneau.internal.MultiSet} where exception was being thrown if last set was empty.
<li>New {@link org.apache.juneau.utils.ZipFileList} class for providing efficiently zipped directories through the REST interface.
<li>New <code>RdfProperties.RDF_useXmlNamespaces</code> property.
- <li>New {@link org.apache.juneau.xml.XmlParserContext#XML_preserveRootElement} property.
+ <li>New <code><del>XmlParserContext.XML_preserveRootElement</del></code> property.
<li>Worked around bug in Sun VM on OS/X where XML parser was throwing an exception when trying to set a reporter.
</ul>
@@ -10018,7 +10018,7 @@
<h6 class='topic'>Server</h6>
<ul class='spaced-list'>
<li>New {@link org.apache.juneau.rest.response.ZipFileListResponseHandler} class.
- <li>Simplified lables in servlet resource bundles:
+ <li>Simplified labels in servlet resource bundles:
<ul>
<li><code>"[ClassName].ResourceDescription"</code> is now <code>"[ClassName].label"</code>.
<li><code>"[ClassName].MethodDescription.[methodName]"</code> is now <code>"[ClassName].[methodName]"</code>.
@@ -10115,7 +10115,7 @@
<li>New {@link org.apache.juneau.dto.jsonschema.JsonType#ANY} enum.
<li>New {@link org.apache.juneau.html.annotation.Html#asPlainText @Html.asPlainText()} annotation.
<li>New <code><del>HtmlDocSerializerContext.HTMLDOC_cssImports</del></code> property.
- <li>Signifant changes to RDF support.
+ <li>Significant changes to RDF support.
<ul>
<li>New {@link org.apache.juneau.jena.annotation.Rdf @Rdf} and {@link org.apache.juneau.jena.annotation.RdfSchema @RdfSchema}
annotations. These replace the use of defining namespaced through the XML annotations, and allows XML and RDF to be
@@ -10123,9 +10123,8 @@
<li>Support for serializing arrays/collections as RDF bags, RDF lists, and multi-valued properties.
<li>Fixed warning message about <js>"tab"</js> setting when using the N3/Turtle serializers.
</ul>
- <li>New {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_sortCollections} and
- {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_sortMaps} properties.
- <li>
+ <li>New <code><del>SerializerContext.SERIALIZER_sortCollections</del></code> and
+ <code><del>SerializerContext.SERIALIZER_sortMaps</del></code> properties.
<li>FindBug fixes.
</ul>
@@ -10253,7 +10252,7 @@
<li>{@link org.apache.juneau.ClassMeta#newInstance()} method can now create new instances of arrays.
<li>Arguments passed to <code><del>Link</del></code> are now serialized using {@link org.apache.juneau.urlencoding.UrlEncodingSerializer}, so arbitrary POJOs can now be passed as arguments.
<li>New date filters: <code>org.apache.juneau.transforms.Datefilter.ISO8601DTZP</code> and <code>org.apache.juneau.transforms.Datefilter.SimpleP</code>.
- <li>New {@link org.apache.juneau.html.HtmlDocSerializerContext#HTMLDOC_nowrap} setting for {@link org.apache.juneau.html.HtmlDocSerializer} class.
+ <li>New <code><del>HtmlDocSerializerContext.HTMLDOC_nowrap</del></code> setting for {@link org.apache.juneau.html.HtmlDocSerializer} class.
Adds <js>"* {white-space:nowrap}"</js> to the style header to prevent word wrapping.
<li>Fixed bug in {@link org.apache.juneau.uon.UonParser} where passing in a blank value on an array or collection type in a form post would cause a <code>ClassCastException</code>.
New behavior creates an empty array or <code>Collection</code>.
@@ -10323,13 +10322,13 @@
<ul>
<li>Improved whitespace handling in {@link org.apache.juneau.uon.UonParser}.
<li>New <code><del>UonParserContext.UON_whitespaceAware</del></code> property for controlling whether whitespace is ignored.
- <li>New {@link org.apache.juneau.urlencoding.UrlEncodingContext#URLENC_expandedParams} property for controlling whether arrays/Collections
+ <li>New <code><del>UrlEncodingContext.URLENC_expandedParams</del></code> property for controlling whether arrays/Collections
should be serialized/parsed as multi-part parameters.
<li>New {@link org.apache.juneau.urlencoding.annotation.UrlEncoding#expandedParams() @UrlEncoding.expandedParams()}
annotation that specifies that bean properties of type array/Collection be serialized as multi-part parameters (e.g. <code>&key=val1&key=val2</code>).
</ul>
</li>
- <li>New {@link org.apache.juneau.json.JsonSerializerContext#JSON_escapeSolidus} property for controlling whether slash characters should be escaped.
+ <li>New <code><del>JsonSerializerContext.JSON_escapeSolidus</del></code> property for controlling whether slash characters should be escaped.
<li>New {@link org.apache.juneau.internal.TeeOutputStream} and {@link org.apache.juneau.internal.TeeWriter} classes.
<li>New {@link org.apache.juneau.ClassMeta#isInstance(Object)} method.
<li>Performance improvements when using the {@link org.apache.juneau.BeanMap#add(String,Object)} method.
@@ -10530,7 +10529,7 @@
<li>Improved error handling.
<li>New <code><del>ParserContext.PARSER_debug</del></code> and <code><del>SerializerContext.SERIALIZER_debug</del></code>.
settings for logging additional information for debugging problems.
- <li>New {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_ignoreRecursions} setting for explicitely ignoring recursions when
+ <li>New {@link org.apache.juneau.serializer.Serializer#SERIALIZER_ignoreRecursions} setting for explicitely ignoring recursions when
serializing models. Previously, the <jsf>SERIALIZER_detectRecursions</jsf> setting did this, but now it simply looks for recursions
and throws exceptions when they occur.
<li>Improved handling of <code>StackOverflowErrors</code>. When <jsf>SERIALIZER_detectRecursions</jsf> is enabled, a useful error message
@@ -11326,8 +11325,8 @@
New Jena-based {@link org.apache.juneau.jena.RdfParser} for parsing RDF/XML, RDF/XML-ABBREV, N3, Turtle, and N-Triple back into POJOs.
</li>
<li>
- {@link org.apache.juneau.xml.XmlSerializerContext#XML_autoDetectNamespaces} default changed to <jk>true</jk>.<br>
- The old default value would cause XML with unmapped namespaces if you didn't manually specify them via the {@link org.apache.juneau.xml.XmlSerializerContext#XML_namespaces} annotation.<br>
+ <code><del>XmlSerializerContext.XML_autoDetectNamespaces</del></code> default changed to <jk>true</jk>.<br>
+ The old default value would cause XML with unmapped namespaces if you didn't manually specify them via the <code><del>XmlSerializerContext.XML_namespaces</del></code> annotation.<br>
While setting the default to <jk>true</jk> is somewhat slower (since the serializer must crawl the POJO tree to find namespaces), the benefits of having it work out-of-the-box outweighs the performance concerns.<br>
For developers concerned about performance, they can always change it back to false and specify the namespaces themselves.
</li>
@@ -11393,7 +11392,7 @@
</ul>
</li>
<li>
- <jsf>TRIM_NULLS</jsf> setting changed to {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_trimNullProperties}.<br>
+ <jsf>TRIM_NULLS</jsf> setting changed to <code><del>SerializerContext.SERIALIZER_trimNullProperties</del></code>.<br>
New property default is <jk>true</jk>.
Only applies to bean properties, not map or collection entries.
</li>
@@ -11608,7 +11607,7 @@
New {@link org.apache.juneau.annotation.URI @URI} annotation that allows you to specify classes and bean properties as URLs that aren't <code>java.net.URI</code> or <code>java.net.URL</code>.
</li>
<li>
- New {@link org.apache.juneau.html.HtmlSerializerContext#HTML_uriAnchorText} HTML serializer property for tailoring how anchor text is rendered.
+ New {@link org.apache.juneau.html.HtmlSerializer#HTML_uriAnchorText} HTML serializer property for tailoring how anchor text is rendered.
</li>
<li>
Renamed <code>BeanProperty#uri</code> annotation to <code>BeanProperty#beanUri</code> to make it clear that this property represents the URI of the bean itself instead of an arbitrary property containing a URI.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
index dc0decd..a2f73f5 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/AtomFeedResource.java
@@ -13,9 +13,9 @@
package org.apache.juneau.examples.rest;
import static org.apache.juneau.dto.atom.AtomBuilder.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
-import static org.apache.juneau.jena.RdfSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
+import static org.apache.juneau.jena.RdfCommon.*;
+import static org.apache.juneau.jena.RdfSerializer.*;
import static org.apache.juneau.http.HttpMethodName.*;
import java.net.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java
index 0dc280c..db1dfda 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java
@@ -15,7 +15,7 @@ package org.apache.juneau.examples.rest;
import static org.apache.juneau.rest.annotation.HookEvent.*;
import static java.util.logging.Level.*;
import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import static org.apache.juneau.http.HttpMethodName.*;
import java.io.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java
index 1252700..7b83e62 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java
@@ -13,7 +13,7 @@
package org.apache.juneau.examples.rest;
import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlSerializerContext.*;
+import static org.apache.juneau.html.HtmlSerializer.*;
import static org.apache.juneau.http.HttpMethodName.*;
import java.awt.image.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
index be758ae..716a7ff 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.examples.rest;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import javax.servlet.*;
import javax.servlet.http.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
index 20a48a6..2b8e8eb 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
@@ -13,7 +13,7 @@
package org.apache.juneau.examples.rest;
import static org.apache.juneau.dto.html5.HtmlBuilder.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import static org.apache.juneau.http.HttpMethodName.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
index a871628..769bf82 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
@@ -13,9 +13,9 @@
package org.apache.juneau.examples.rest.addressbook;
import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
-import static org.apache.juneau.jena.RdfCommonContext.*;
-import static org.apache.juneau.jena.RdfSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
+import static org.apache.juneau.jena.RdfCommon.*;
+import static org.apache.juneau.jena.RdfSerializer.*;
import static org.apache.juneau.http.HttpMethodName.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java b/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
index 99829f7..d4bb977 100644
--- a/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
+++ b/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
@@ -13,7 +13,7 @@
package org.apache.juneau.examples.rest;
import static org.apache.juneau.examples.rest.TestUtils.*;
-import static org.apache.juneau.xml.XmlSerializerContext.*;
+import static org.apache.juneau.xml.XmlSerializer.*;
import static org.junit.Assert.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java b/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
index 9fd8d5b..e1119bf 100644
--- a/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
+++ b/juneau-examples/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.examples.rest;
-import static org.apache.juneau.xml.XmlSerializerContext.*;
+import static org.apache.juneau.xml.XmlSerializer.*;
import static org.junit.Assert.*;
import java.text.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
index b131e2d..9db0c5e 100755
--- a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
+++ b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
@@ -14,7 +14,7 @@ package org.apache.juneau.microservice.resources;
import static java.util.logging.Level.*;
import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import static org.apache.juneau.http.HttpMethodName.*;
import java.io.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
index 811c928..69436cd 100755
--- a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
+++ b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
@@ -13,7 +13,7 @@
package org.apache.juneau.microservice.resources;
import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
import static org.apache.juneau.rest.annotation.HookEvent.*;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.http.HttpMethodName.*;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
----------------------------------------------------------------------
diff --git a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java b/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
index 794e75e..f8d02f9 100644
--- a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
+++ b/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
@@ -285,8 +285,8 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name=POST, path="/testFormPostsWithMultiParamsUsingProperty",
properties={
- @Property(name=UrlEncodingSerializerContext.URLENC_expandedParams, value="true"),
- @Property(name=UrlEncodingParserContext.URLENC_expandedParams, value="true")
+ @Property(name=UrlEncodingSerializer.URLENC_expandedParams, value="true"),
+ @Property(name=UrlEncodingParser.URLENC_expandedParams, value="true")
}
)
public DTO2s.B testFormPostsWithMultiParamsViaProperty(@Body DTO2s.B content) throws Exception {
[4/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
index e30d678..7aa8793 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
@@ -21,20 +21,21 @@ import org.apache.juneau.parser.*;
* <h5 class='section'>Media types:</h5>
*
* Handles <code>Content-Type</code> types: <code>octal/msgpack</code>
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link MsgPackParserContext}
- * </ul>
*/
public class MsgPackParser extends InputStreamParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final MsgPackParser DEFAULT = new MsgPackParser(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final MsgPackParserContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserContext.java
index dc56d25..a84f6aa 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserContext.java
@@ -16,27 +16,7 @@ import org.apache.juneau.*;
import org.apache.juneau.parser.*;
/**
- * Configurable properties on the {@link MsgPackParser} 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 MsgPackParser} class.
*/
public final class MsgPackParserContext extends ParserContext {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
index ab5442f..0c21be9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
@@ -21,24 +21,54 @@ import org.apache.juneau.serializer.*;
* <h5 class='section'>Media types:</h5>
*
* Handles <code>Accept</code> types: <code>octal/msgpack</code>
+ *
* <p>
* Produces <code>Content-Type</code> types: <code>octal/msgpack</code>
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link MsgPackSerializerContext}
- * <li>{@link SerializerContext}
- * <li>{@link BeanContext}
- * </ul>
*/
public class MsgPackSerializer extends OutputStreamSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "MsgPackSerializer.";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"MsgPackSerializer.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 MSGPACK_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings.*/
public static final MsgPackSerializer DEFAULT = new MsgPackSerializer(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final MsgPackSerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerContext.java
index 285b564..bad4ec8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerContext.java
@@ -12,59 +12,16 @@
// ***************************************************************************************************************************
package org.apache.juneau.msgpack;
+import static org.apache.juneau.msgpack.MsgPackSerializer.*;
+
import org.apache.juneau.*;
import org.apache.juneau.serializer.*;
/**
- * Configurable properties on the {@link MsgPackSerializer} 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 MsgPackSerializer} class.
*/
public final class MsgPackSerializerContext extends SerializerContext {
- static final String PREFIX = "MsgPackSerializer.";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"MsgPackSerializer.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 MSGPACK_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
final boolean
addBeanTypeProperties;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
index 7dac725..5bf892c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.msgpack;
-import static org.apache.juneau.msgpack.MsgPackSerializerContext.*;
+import static org.apache.juneau.msgpack.MsgPackSerializer.*;
import java.util.*;
@@ -60,9 +60,9 @@ public final class MsgPackSerializerSession extends OutputStreamSerializerSessio
}
/**
- * Returns the {@link MsgPackSerializerContext#MSGPACK_addBeanTypeProperties} setting value for this session.
+ * Returns the {@link MsgPackSerializer#MSGPACK_addBeanTypeProperties} setting value for this session.
*
- * @return The {@link MsgPackSerializerContext#MSGPACK_addBeanTypeProperties} setting value for this session.
+ * @return The {@link MsgPackSerializer#MSGPACK_addBeanTypeProperties} setting value for this session.
*/
@Override /* SerializerSession */
protected 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/parser/Parser.java
----------------------------------------------------------------------
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 c951683..9d78570 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
@@ -18,6 +18,7 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.json.*;
import org.apache.juneau.transform.*;
import org.apache.juneau.transforms.*;
import org.apache.juneau.utils.*;
@@ -132,6 +133,129 @@ import org.apache.juneau.utils.*;
*/
public abstract class Parser extends CoreObject {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "Parser.";
+
+ /**
+ * <b>Configuration property:</b> Trim parsed strings.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Parser.trimStrings"</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>, string values will be trimmed of whitespace using {@link String#trim()} before being added to
+ * the POJO.
+ */
+ public static final String PARSER_trimStrings = PREFIX + "trimStrings";
+
+ /**
+ * <b>Configuration property:</b> Strict mode.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Parser.strict"</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>, strict mode for the parser is enabled.
+ *
+ * <p>
+ * Strict mode can mean different things for different parsers.
+ *
+ * <table class='styled'>
+ * <tr><th>Parser class</th><th>Strict behavior</th></tr>
+ * <tr>
+ * <td>All reader-based parsers</td>
+ * <td>
+ * When enabled, throws {@link ParseException ParseExceptions} on malformed charset input.
+ * Otherwise, malformed input is ignored.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>{@link JsonParser}</td>
+ * <td>
+ * When enabled, throws exceptions on the following invalid JSON syntax:
+ * <ul>
+ * <li>Unquoted attributes.
+ * <li>Missing attribute values.
+ * <li>Concatenated strings.
+ * <li>Javascript comments.
+ * <li>Numbers and booleans when Strings are expected.
+ * <li>Numbers valid in Java but not JSON (e.g. octal notation, etc...)
+ * </ul>
+ * </td>
+ * </tr>
+ * </table>
+ */
+ public static final String PARSER_strict = PREFIX + "strict";
+
+ /**
+ * <b>Configuration property:</b> Input stream charset.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Parser.inputStreamCharset"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"UTF-8"</js>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * The character set to use for converting <code>InputStreams</code> and byte arrays to readers.
+ *
+ * <p>
+ * Used when passing in input streams and byte arrays to {@link Parser#parse(Object, Class)}.
+ */
+ public static final String PARSER_inputStreamCharset = PREFIX + "inputStreamCharset";
+
+ /**
+ * <b>Configuration property:</b> File charset.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Parser.fileCharset"</js>
+ * <li><b>Data type:</b> <code>String</code>
+ * <li><b>Default:</b> <js>"default"</js>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * The character set to use for reading <code>Files</code> from the file system.
+ *
+ * <p>
+ * Used when passing in files to {@link Parser#parse(Object, Class)}.
+ *
+ * <p>
+ * <js>"default"</js> can be used to indicate the JVM default file system charset.
+ */
+ public static final String PARSER_fileCharset = PREFIX + "fileCharset";
+
+ /**
+ * <b>Configuration property:</b> Parser listener.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Parser.listener"</js>
+ * <li><b>Data type:</b> <code>Class<? extends ParserListener></code>
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Class used to listen for errors and warnings that occur during parsing.
+ */
+ public static final String PARSER_listener = PREFIX + "listener";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
/** General parser properties currently set on this parser. */
private final MediaType[] consumes;
@@ -229,11 +353,11 @@ public abstract class Parser extends CoreObject {
* <li>{@link Reader}
* <li>{@link CharSequence}
* <li>{@link InputStream} containing UTF-8 encoded text (or charset defined by
- * {@link ParserContext#PARSER_inputStreamCharset} property value).
+ * {@link #PARSER_inputStreamCharset} property value).
* <li><code><jk>byte</jk>[]</code> containing UTF-8 encoded text (or charset defined by
- * {@link ParserContext#PARSER_inputStreamCharset} property value).
+ * {@link #PARSER_inputStreamCharset} property value).
* <li>{@link File} containing system encoded text (or charset defined by
- * {@link ParserContext#PARSER_fileCharset} property value).
+ * {@link #PARSER_fileCharset} property value).
* </ul>
* <br>Stream-based parsers can handle the following input class types:
* <ul>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java
index d0369c6..59d5f66 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.parser;
-import static org.apache.juneau.parser.ParserContext.*;
+import static org.apache.juneau.parser.Parser.*;
import java.util.*;
@@ -72,7 +72,7 @@ public class ParserBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_trimStrings
+ * @see Parser#PARSER_trimStrings
*/
public ParserBuilder trimStrings(boolean value) {
return property(PARSER_trimStrings, value);
@@ -126,7 +126,7 @@ public class ParserBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_strict
+ * @see Parser#PARSER_strict
*/
public ParserBuilder strict(boolean value) {
return property(PARSER_strict, value);
@@ -164,7 +164,7 @@ public class ParserBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_inputStreamCharset
+ * @see Parser#PARSER_inputStreamCharset
*/
public ParserBuilder inputStreamCharset(String value) {
return property(PARSER_inputStreamCharset, value);
@@ -196,7 +196,7 @@ public class ParserBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_fileCharset
+ * @see Parser#PARSER_fileCharset
*/
public ParserBuilder fileCharset(String value) {
return property(PARSER_fileCharset, value);
@@ -217,7 +217,7 @@ public class ParserBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_listener
+ * @see Parser#PARSER_listener
*/
public ParserBuilder listener(Class<? extends ParserListener> value) {
return property(PARSER_listener, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserContext.java
index 09a5e4c..cd03660 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserContext.java
@@ -12,133 +12,21 @@
// ***************************************************************************************************************************
package org.apache.juneau.parser;
+import static org.apache.juneau.parser.Parser.*;
+
import org.apache.juneau.*;
-import org.apache.juneau.json.*;
/**
- * Configurable properties common to all parsers.
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link Parser} class.
*/
public class ParserContext extends BeanContext {
- static final String PREFIX = "Parser.";
-
/**
* Default context with all default values.
*/
@SuppressWarnings("hiding")
- protected static final ParserContext DEFAULT = new ParserContext(PropertyStore.create());
-
- /**
- * <b>Configuration property:</b> Trim parsed strings.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Parser.trimStrings"</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>, string values will be trimmed of whitespace using {@link String#trim()} before being added to
- * the POJO.
- */
- public static final String PARSER_trimStrings = PREFIX + "trimStrings";
-
- /**
- * <b>Configuration property:</b> Strict mode.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Parser.strict"</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>, strict mode for the parser is enabled.
- *
- * <p>
- * Strict mode can mean different things for different parsers.
- *
- * <table class='styled'>
- * <tr><th>Parser class</th><th>Strict behavior</th></tr>
- * <tr>
- * <td>All reader-based parsers</td>
- * <td>
- * When enabled, throws {@link ParseException ParseExceptions} on malformed charset input.
- * Otherwise, malformed input is ignored.
- * </td>
- * </tr>
- * <tr>
- * <td>{@link JsonParser}</td>
- * <td>
- * When enabled, throws exceptions on the following invalid JSON syntax:
- * <ul>
- * <li>Unquoted attributes.
- * <li>Missing attribute values.
- * <li>Concatenated strings.
- * <li>Javascript comments.
- * <li>Numbers and booleans when Strings are expected.
- * <li>Numbers valid in Java but not JSON (e.g. octal notation, etc...)
- * </ul>
- * </td>
- * </tr>
- * </table>
- */
- public static final String PARSER_strict = PREFIX + "strict";
-
- /**
- * <b>Configuration property:</b> Input stream charset.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Parser.inputStreamCharset"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"UTF-8"</js>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * The character set to use for converting <code>InputStreams</code> and byte arrays to readers.
- *
- * <p>
- * Used when passing in input streams and byte arrays to {@link Parser#parse(Object, Class)}.
- */
- public static final String PARSER_inputStreamCharset = PREFIX + "inputStreamCharset";
+ static final ParserContext DEFAULT = new ParserContext(PropertyStore.create());
- /**
- * <b>Configuration property:</b> File charset.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Parser.fileCharset"</js>
- * <li><b>Data type:</b> <code>String</code>
- * <li><b>Default:</b> <js>"default"</js>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * The character set to use for reading <code>Files</code> from the file system.
- *
- * <p>
- * Used when passing in files to {@link Parser#parse(Object, Class)}.
- *
- * <p>
- * <js>"default"</js> can be used to indicate the JVM default file system charset.
- */
- public static final String PARSER_fileCharset = PREFIX + "fileCharset";
-
- /**
- * <b>Configuration property:</b> Parser listener.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Parser.listener"</js>
- * <li><b>Data type:</b> <code>Class<? extends ParserListener></code>
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Class used to listen for errors and warnings that occur during parsing.
- */
- public static final String PARSER_listener = PREFIX + "listener";
final boolean trimStrings, strict;
final String inputStreamCharset, fileCharset;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
index 8bed46a..a9b6d29 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
@@ -15,7 +15,7 @@ package org.apache.juneau.parser;
import static org.apache.juneau.BeanContext.*;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.parser.ParserContext.*;
+import static org.apache.juneau.parser.Parser.*;
import java.util.*;
@@ -207,55 +207,55 @@ public class ParserGroupBuilder {
}
/**
- * Sets the {@link ParserContext#PARSER_trimStrings} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_trimStrings} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_trimStrings
+ * @see Parser#PARSER_trimStrings
*/
public ParserGroupBuilder trimStrings(boolean value) {
return property(PARSER_trimStrings, value);
}
/**
- * Sets the {@link ParserContext#PARSER_strict} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_strict} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_strict
+ * @see Parser#PARSER_strict
*/
public ParserGroupBuilder strict(boolean value) {
return property(PARSER_strict, value);
}
/**
- * Sets the {@link ParserContext#PARSER_inputStreamCharset} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_inputStreamCharset} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_inputStreamCharset
+ * @see Parser#PARSER_inputStreamCharset
*/
public ParserGroupBuilder inputStreamCharset(String value) {
return property(PARSER_inputStreamCharset, value);
}
/**
- * Sets the {@link ParserContext#PARSER_fileCharset} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_fileCharset} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_fileCharset
+ * @see Parser#PARSER_fileCharset
*/
public ParserGroupBuilder fileCharset(String value) {
return property(PARSER_fileCharset, value);
}
/**
- * Sets the {@link ParserContext#PARSER_listener} property on all parsers in this group.
+ * Sets the {@link Parser#PARSER_listener} property on all parsers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see ParserContext#PARSER_listener
+ * @see Parser#PARSER_listener
*/
public ParserGroupBuilder listener(Class<? extends ParserListener> value) {
return property(PARSER_listener, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
----------------------------------------------------------------------
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 44e4718..a449387 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
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.parser;
-import static org.apache.juneau.parser.ParserContext.*;
+import static org.apache.juneau.parser.Parser.*;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
@@ -126,11 +126,11 @@ public abstract class ParserSession extends BeanSession {
* <li>{@link Reader}
* <li>{@link CharSequence}
* <li>{@link InputStream} containing UTF-8 encoded text (or whatever the encoding specified by
- * {@link ParserContext#PARSER_inputStreamCharset}).
+ * {@link Parser#PARSER_inputStreamCharset}).
* <li><code><jk>byte</jk>[]</code> containing UTF-8 encoded text (or whatever the encoding specified by
- * {@link ParserContext#PARSER_inputStreamCharset}).
+ * {@link Parser#PARSER_inputStreamCharset}).
* <li>{@link File} containing system encoded text (or whatever the encoding specified by
- * {@link ParserContext#PARSER_fileCharset}).
+ * {@link Parser#PARSER_fileCharset}).
* </ul>
* <br>For byte-based parsers, this can be any of the following types:
* <ul>
@@ -204,18 +204,18 @@ public abstract class ParserSession extends BeanSession {
}
/**
- * Returns the {@link ParserContext#PARSER_trimStrings} setting value for this session.
+ * Returns the {@link Parser#PARSER_trimStrings} setting value for this session.
*
- * @return The {@link ParserContext#PARSER_trimStrings} setting value for this session.
+ * @return The {@link Parser#PARSER_trimStrings} setting value for this session.
*/
protected final boolean isTrimStrings() {
return trimStrings;
}
/**
- * Returns the {@link ParserContext#PARSER_strict} setting value for this session.
+ * Returns the {@link Parser#PARSER_strict} setting value for this session.
*
- * @return The {@link ParserContext#PARSER_strict} setting value for this session.
+ * @return The {@link Parser#PARSER_strict} setting value for this session.
*/
protected final boolean isStrict() {
return strict;
@@ -391,11 +391,11 @@ public abstract class ParserSession extends BeanSession {
* <li>{@link Reader}
* <li>{@link CharSequence}
* <li>{@link InputStream} containing UTF-8 encoded text (or charset defined by
- * {@link ParserContext#PARSER_inputStreamCharset} property value).
+ * {@link Parser#PARSER_inputStreamCharset} property value).
* <li><code><jk>byte</jk>[]</code> containing UTF-8 encoded text (or charset defined by
- * {@link ParserContext#PARSER_inputStreamCharset} property value).
+ * {@link Parser#PARSER_inputStreamCharset} property value).
* <li>{@link File} containing system encoded text (or charset defined by
- * {@link ParserContext#PARSER_fileCharset} property value).
+ * {@link Parser#PARSER_fileCharset} property value).
* </ul>
* <br>Stream-based parsers can handle the following input class types:
* <ul>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
index 76fd0a4..1f34d23 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
@@ -35,20 +35,21 @@ import org.apache.juneau.transform.*;
* <p>
* Also parses objects using a transform if the object class has an {@link PojoSwap PojoSwap<?,String>} transform
* defined on it.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link ParserContext}
- * </ul>
*/
public class PlainTextParser extends ReaderParser {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined subclasses
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default parser, all default settings.*/
public static final PlainTextParser DEFAULT = new PlainTextParser(PropertyStore.create());
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
/**
* Constructor.
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
index a813865..110623d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
@@ -33,20 +33,21 @@ import org.apache.juneau.transform.*;
* <p>
* Also serializes objects using a transform if the object class has an {@link PojoSwap PojoSwap<?,String>}
* transform defined on it.
- *
- * <h5 class='section'>Configurable properties:</h5>
- *
- * This class has the following properties associated with it:
- * <ul>
- * <li>{@link SerializerContext}
- * <li>{@link BeanContext}
- * </ul>
*/
public class PlainTextSerializer extends WriterSerializer {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Predefined instances
+ //-------------------------------------------------------------------------------------------------------------------
+
/** Default serializer, all default settings.*/
public static final PlainTextSerializer DEFAULT = new PlainTextSerializer(PropertyStore.create());
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final SerializerContext ctx;
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
index f04e615..6aea5f7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
@@ -15,6 +15,7 @@ package org.apache.juneau.serializer;
import java.io.*;
import org.apache.juneau.*;
+import org.apache.juneau.annotation.*;
import org.apache.juneau.http.*;
/**
@@ -38,6 +39,402 @@ import org.apache.juneau.http.*;
*/
public abstract class Serializer extends CoreObject {
+ //-------------------------------------------------------------------------------------------------------------------
+ // Configurable properties
+ //-------------------------------------------------------------------------------------------------------------------
+
+ private static final String PREFIX = "Serializer.";
+
+ /**
+ * <b>Configuration property:</b> Max serialization depth.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.maxDepth"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>100</code>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Abort serialization if specified depth is reached in the POJO tree.
+ * If this depth is exceeded, an exception is thrown.
+ * This prevents stack overflows from occurring when trying to serialize models with recursive references.
+ */
+ public static final String SERIALIZER_maxDepth = PREFIX + "maxDepth";
+
+ /**
+ * <b>Configuration property:</b> Initial depth.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.initialDepth"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>0</code>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * The initial indentation level at the root.
+ * Useful when constructing document fragments that need to be indented at a certain level.
+ */
+ public static final String SERIALIZER_initialDepth = PREFIX + "initialDepth";
+
+ /**
+ * <b>Configuration property:</b> Automatically detect POJO recursions.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.detectRecursions"</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>
+ * Specifies that recursions should be checked for during serialization.
+ *
+ * <p>
+ * Recursions can occur when serializing models that aren't true trees, but rather contain loops.
+ *
+ * <p>
+ * The behavior when recursions are detected depends on the value for {@link #SERIALIZER_ignoreRecursions}.
+ *
+ * <p>
+ * For example, if a model contains the links A->B->C->A, then the JSON generated will look like
+ * the following when <jsf>SERIALIZER_ignoreRecursions</jsf> is <jk>true</jk>...
+ * <code>{A:{B:{C:null}}}</code>
+ *
+ * <h5 class='section'>Notes:</h5>
+ * <ul>
+ * <li>Checking for recursion can cause a small performance penalty.
+ * </ul>
+ */
+ public static final String SERIALIZER_detectRecursions = PREFIX + "detectRecursions";
+
+ /**
+ * <b>Configuration property:</b> Ignore recursion errors.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.ignoreRecursions"</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>
+ * Used in conjunction with {@link #SERIALIZER_detectRecursions}.
+ * Setting is ignored if <jsf>SERIALIZER_detectRecursions</jsf> is <jk>false</jk>.
+ *
+ * <p>
+ * If <jk>true</jk>, when we encounter the same object when serializing a tree, we set the value to <jk>null</jk>.
+ * Otherwise, an exception is thrown.
+ */
+ public static final String SERIALIZER_ignoreRecursions = PREFIX + "ignoreRecursions";
+
+ /**
+ * <b>Configuration property:</b> Use whitespace.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.useWhitespace"</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>, whitespace is added to the output to improve readability.
+ *
+ * <p>
+ * This setting does not apply to the MessagePack serializer.
+ */
+ public static final String SERIALIZER_useWhitespace = PREFIX + "useWhitespace";
+
+ /**
+ * <b>Configuration property:</b> Maximum indentation.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.maxIndent"</js>
+ * <li><b>Data type:</b> <code>Integer</code>
+ * <li><b>Default:</b> <code>100</code>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Specifies the maximum indentation level in the serialized document.
+ *
+ * <p>
+ * This setting does not apply to the MessagePack or RDF serializers.
+ */
+ public static final String SERIALIZER_maxIndent = PREFIX + "maxIndent";
+
+ /**
+ * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.addBeanTypeProperties"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</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.
+ */
+ public static final String SERIALIZER_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
+
+ /**
+ * <b>Configuration property:</b> Quote character.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.quoteChar"</js>
+ * <li><b>Data type:</b> <code>Character</code>
+ * <li><b>Default:</b> <js>'"'</js>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * This is the character used for quoting attributes and values.
+ *
+ * <p>
+ * This setting does not apply to the MessagePack or RDF serializers.
+ */
+ public static final String SERIALIZER_quoteChar = PREFIX + "quoteChar";
+
+ /**
+ * <b>Configuration property:</b> Trim null bean property values.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.trimNullProperties"</js>
+ * <li><b>Data type:</b> <code>Boolean</code>
+ * <li><b>Default:</b> <jk>true</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * If <jk>true</jk>, null bean values will not be serialized to the output.
+ *
+ * <p>
+ * Note that enabling this setting has the following effects on parsing:
+ * <ul class='spaced-list'>
+ * <li>
+ * Map entries with <jk>null</jk> values will be lost.
+ * </ul>
+ */
+ public static final String SERIALIZER_trimNullProperties = PREFIX + "trimNullProperties";
+
+ /**
+ * <b>Configuration property:</b> Trim empty lists and arrays.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.trimEmptyLists"</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>, empty list values will not be serialized to the output.
+ *
+ * <p>
+ * Note that enabling this setting has the following effects on parsing:
+ * <ul class='spaced-list'>
+ * <li>
+ * Map entries with empty list values will be lost.
+ * <li>
+ * Bean properties with empty list values will not be set.
+ * </ul>
+ */
+ public static final String SERIALIZER_trimEmptyCollections = PREFIX + "trimEmptyLists";
+
+ /**
+ * <b>Configuration property:</b> Trim empty maps.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.trimEmptyMaps"</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>, empty map values will not be serialized to the output.
+ *
+ * <p>
+ * Note that enabling this setting has the following effects on parsing:
+ * <ul class='spaced-list'>
+ * <li>
+ * Bean properties with empty map values will not be set.
+ * </ul>
+ */
+ public static final String SERIALIZER_trimEmptyMaps = PREFIX + "trimEmptyMaps";
+
+ /**
+ * <b>Configuration property:</b> Trim strings.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.trimStrings"</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>, string values will be trimmed of whitespace using {@link String#trim()} before being serialized.
+ */
+ public static final String SERIALIZER_trimStrings = PREFIX + "trimStrings";
+
+ /**
+ * <b>Configuration property:</b> URI context bean.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.uriContext"</js>
+ * <li><b>Data type:</b> {@link UriContext}
+ * <li><b>Default:</b> {@link UriContext#DEFAULT}
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Bean used for resolution of URIs to absolute or root-relative form.
+ *
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * <js>"{authority:'http://localhost:10000',contextRoot:'/myContext',servletPath:'/myServlet',pathInfo:'/foo'}"</js>
+ * </p>
+ */
+ public static final String SERIALIZER_uriContext = PREFIX + "uriContext";
+
+ /**
+ * <b>Configuration property:</b> URI resolution.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.uriResolution"</js>
+ * <li><b>Data type:</b> {@link UriResolution}
+ * <li><b>Default:</b> {@link UriResolution#NONE}
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Defines the resolution level for URIs when serializing any of the following:
+ * <ul>
+ * <li>{@link java.net.URI}
+ * <li>{@link java.net.URL}
+ * <li>Properties annotated with {@link org.apache.juneau.annotation.URI @URI}
+ * </ul>
+ *
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li>{@link UriResolution#ABSOLUTE}
+ * - Resolve to an absolute URL (e.g. <js>"http://host:port/context-root/servlet-path/path-info"</js>).
+ * <li>{@link UriResolution#ROOT_RELATIVE}
+ * - Resolve to a root-relative URL (e.g. <js>"/context-root/servlet-path/path-info"</js>).
+ * <li>{@link UriResolution#NONE}
+ * - Don't do any URL resolution.
+ * </ul>
+ */
+ public static final String SERIALIZER_uriResolution = PREFIX + "uriResolution";
+
+ /**
+ * <b>Configuration property:</b> URI relativity.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.uriRelativity"</js>
+ * <li><b>Data type:</b> {@link UriRelativity}
+ * <li><b>Default:</b> {@link UriRelativity#RESOURCE}
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Defines what relative URIs are relative to when serializing any of the following:
+ * <ul>
+ * <li>{@link java.net.URI}
+ * <li>{@link java.net.URL}
+ * <li>Properties annotated with {@link org.apache.juneau.annotation.URI @URI}
+ * </ul>
+ *
+ * <p>
+ * Possible values are:
+ * <ul>
+ * <li>{@link UriRelativity#RESOURCE}
+ * - Relative URIs should be considered relative to the servlet URI.
+ * <li>{@link UriRelativity#PATH_INFO}
+ * - Relative URIs should be considered relative to the request URI.
+ * </ul>
+ */
+ public static final String SERIALIZER_uriRelativity = PREFIX + "uriRelativity";
+
+ /**
+ * <b>Configuration property:</b> Sort arrays and collections alphabetically.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.sortCollections"</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>
+ * Note that this introduces a performance penalty.
+ */
+ public static final String SERIALIZER_sortCollections = PREFIX + "sortCollections";
+
+ /**
+ * <b>Configuration property:</b> Sort maps alphabetically.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.sortMaps"</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>
+ * Note that this introduces a performance penalty.
+ */
+ public static final String SERIALIZER_sortMaps = PREFIX + "sortMaps";
+
+ /**
+ * <b>Configuration property:</b> Abridged output.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.abridged"</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>
+ * When enabled, it is assumed that the parser knows the exact Java POJO type being parsed, and therefore top-level
+ * type information that might normally be included to determine the data type will not be serialized.
+ *
+ * <p>
+ * For example, when serializing a POJO with a {@link Bean#typeName()} value, a <js>"_type"</js> will be added when
+ * this setting is disabled, but not added when it is enabled.
+ */
+ public static final String SERIALIZER_abridged = PREFIX + "abridged";
+
+ /**
+ * <b>Configuration property:</b> Serializer listener.
+ *
+ * <ul>
+ * <li><b>Name:</b> <js>"Serializer.listener"</js>
+ * <li><b>Data type:</b> <code>Class<? extends SerializerListener></code>
+ * <li><b>Default:</b> <jk>null</jk>
+ * <li><b>Session-overridable:</b> <jk>true</jk>
+ * </ul>
+ *
+ * <p>
+ * Class used to listen for errors and warnings that occur during serialization.
+ */
+ public static final String SERIALIZER_listener = PREFIX + "listener";
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-------------------------------------------------------------------------------------------------------------------
+
private final MediaType[] accept;
private final MediaType produces;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
index 10fb1bb..c46b813 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.serializer;
-import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.serializer.Serializer.*;
import java.util.*;
@@ -73,7 +73,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_maxDepth
+ * @see Serializer#SERIALIZER_maxDepth
*/
public SerializerBuilder maxDepth(int value) {
return property(SERIALIZER_maxDepth, value);
@@ -100,7 +100,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_initialDepth
+ * @see Serializer#SERIALIZER_initialDepth
*/
public SerializerBuilder initialDepth(int value) {
return property(SERIALIZER_initialDepth, value);
@@ -124,7 +124,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* <p>
* The behavior when recursions are detected depends on the value for
- * {@link SerializerContext#SERIALIZER_ignoreRecursions}.
+ * {@link Serializer#SERIALIZER_ignoreRecursions}.
*
* <p>
* For example, if a model contains the links A->B->C->A, then the JSON generated will look like
@@ -139,7 +139,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_detectRecursions
+ * @see Serializer#SERIALIZER_detectRecursions
*/
public SerializerBuilder detectRecursions(boolean value) {
return property(SERIALIZER_detectRecursions, value);
@@ -156,7 +156,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
* </ul>
*
* <p>
- * Used in conjunction with {@link SerializerContext#SERIALIZER_detectRecursions}.
+ * Used in conjunction with {@link Serializer#SERIALIZER_detectRecursions}.
* Setting is ignored if <jsf>SERIALIZER_detectRecursions</jsf> is <jk>false</jk>.
*
* <p>
@@ -171,7 +171,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_ignoreRecursions
+ * @see Serializer#SERIALIZER_ignoreRecursions
*/
public SerializerBuilder ignoreRecursions(boolean value) {
return property(SERIALIZER_ignoreRecursions, value);
@@ -197,7 +197,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_useWhitespace
+ * @see Serializer#SERIALIZER_useWhitespace
*/
public SerializerBuilder useWhitespace(boolean value) {
return property(SERIALIZER_useWhitespace, value);
@@ -232,7 +232,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_maxIndent
+ * @see Serializer#SERIALIZER_maxIndent
*/
public SerializerBuilder maxIndent(int value) {
return property(SERIALIZER_maxIndent, value);
@@ -263,7 +263,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_addBeanTypeProperties
+ * @see Serializer#SERIALIZER_addBeanTypeProperties
*/
public SerializerBuilder addBeanTypeProperties(boolean value) {
return property(SERIALIZER_addBeanTypeProperties, value);
@@ -289,7 +289,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_quoteChar
+ * @see Serializer#SERIALIZER_quoteChar
*/
public SerializerBuilder quoteChar(char value) {
return property(SERIALIZER_quoteChar, value);
@@ -328,7 +328,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimNullProperties
+ * @see Serializer#SERIALIZER_trimNullProperties
*/
public SerializerBuilder trimNullProperties(boolean value) {
return property(SERIALIZER_trimNullProperties, value);
@@ -359,7 +359,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimEmptyCollections
+ * @see Serializer#SERIALIZER_trimEmptyCollections
*/
public SerializerBuilder trimEmptyCollections(boolean value) {
return property(SERIALIZER_trimEmptyCollections, value);
@@ -389,7 +389,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimEmptyMaps
+ * @see Serializer#SERIALIZER_trimEmptyMaps
*/
public SerializerBuilder trimEmptyMaps(boolean value) {
return property(SERIALIZER_trimEmptyMaps, value);
@@ -415,7 +415,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimStrings
+ * @see Serializer#SERIALIZER_trimStrings
*/
public SerializerBuilder trimStrings(boolean value) {
return property(SERIALIZER_trimStrings, value);
@@ -446,7 +446,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriContext
+ * @see Serializer#SERIALIZER_uriContext
*/
public SerializerBuilder uriContext(UriContext value) {
return property(SERIALIZER_uriContext, value);
@@ -488,7 +488,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriResolution
+ * @see Serializer#SERIALIZER_uriResolution
*/
public SerializerBuilder uriResolution(UriResolution value) {
return property(SERIALIZER_uriResolution, value);
@@ -528,7 +528,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriRelativity
+ * @see Serializer#SERIALIZER_uriRelativity
*/
public SerializerBuilder uriRelativity(UriRelativity value) {
return property(SERIALIZER_uriRelativity, value);
@@ -552,7 +552,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortCollections
+ * @see Serializer#SERIALIZER_sortCollections
*/
public SerializerBuilder sortCollections(boolean value) {
return property(SERIALIZER_sortCollections, value);
@@ -576,7 +576,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortMaps
+ * @see Serializer#SERIALIZER_sortMaps
*/
public SerializerBuilder sortMaps(boolean value) {
return property(SERIALIZER_sortMaps, value);
@@ -602,7 +602,7 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortMaps
+ * @see Serializer#SERIALIZER_sortMaps
*/
public SerializerBuilder abridged(boolean value) {
return property(SERIALIZER_abridged, value);
@@ -623,7 +623,6 @@ public class SerializerBuilder extends CoreObjectBuilder {
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_listener
*/
public SerializerBuilder listener(Class<? extends SerializerListener> value) {
return property(SERIALIZER_listener, value);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerContext.java
index a2a01bc..da5cea0 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerContext.java
@@ -12,406 +12,20 @@
// ***************************************************************************************************************************
package org.apache.juneau.serializer;
+import static org.apache.juneau.serializer.Serializer.*;
+
import org.apache.juneau.*;
-import org.apache.juneau.annotation.*;
/**
- * Configurable properties common to all serializers.
+ * Contains a snapshot-in-time read-only copy of the settings on the {@link Serializer} class.
*/
public class SerializerContext extends BeanContext {
- static final String PREFIX = "Serializer.";
-
/**
* Default context with all default values.
*/
@SuppressWarnings("hiding")
- protected static final SerializerContext DEFAULT = new SerializerContext(PropertyStore.create());
-
- /**
- * <b>Configuration property:</b> Max serialization depth.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.maxDepth"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>100</code>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Abort serialization if specified depth is reached in the POJO tree.
- * If this depth is exceeded, an exception is thrown.
- * This prevents stack overflows from occurring when trying to serialize models with recursive references.
- */
- public static final String SERIALIZER_maxDepth = PREFIX + "maxDepth";
-
- /**
- * <b>Configuration property:</b> Initial depth.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.initialDepth"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>0</code>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * The initial indentation level at the root.
- * Useful when constructing document fragments that need to be indented at a certain level.
- */
- public static final String SERIALIZER_initialDepth = PREFIX + "initialDepth";
-
- /**
- * <b>Configuration property:</b> Automatically detect POJO recursions.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.detectRecursions"</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>
- * Specifies that recursions should be checked for during serialization.
- *
- * <p>
- * Recursions can occur when serializing models that aren't true trees, but rather contain loops.
- *
- * <p>
- * The behavior when recursions are detected depends on the value for {@link #SERIALIZER_ignoreRecursions}.
- *
- * <p>
- * For example, if a model contains the links A->B->C->A, then the JSON generated will look like
- * the following when <jsf>SERIALIZER_ignoreRecursions</jsf> is <jk>true</jk>...
- * <code>{A:{B:{C:null}}}</code>
- *
- * <h5 class='section'>Notes:</h5>
- * <ul>
- * <li>Checking for recursion can cause a small performance penalty.
- * </ul>
- */
- public static final String SERIALIZER_detectRecursions = PREFIX + "detectRecursions";
-
- /**
- * <b>Configuration property:</b> Ignore recursion errors.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.ignoreRecursions"</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>
- * Used in conjunction with {@link #SERIALIZER_detectRecursions}.
- * Setting is ignored if <jsf>SERIALIZER_detectRecursions</jsf> is <jk>false</jk>.
- *
- * <p>
- * If <jk>true</jk>, when we encounter the same object when serializing a tree, we set the value to <jk>null</jk>.
- * Otherwise, an exception is thrown.
- */
- public static final String SERIALIZER_ignoreRecursions = PREFIX + "ignoreRecursions";
-
- /**
- * <b>Configuration property:</b> Use whitespace.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.useWhitespace"</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>, whitespace is added to the output to improve readability.
- *
- * <p>
- * This setting does not apply to the MessagePack serializer.
- */
- public static final String SERIALIZER_useWhitespace = PREFIX + "useWhitespace";
-
- /**
- * <b>Configuration property:</b> Maximum indentation.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.maxIndent"</js>
- * <li><b>Data type:</b> <code>Integer</code>
- * <li><b>Default:</b> <code>100</code>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Specifies the maximum indentation level in the serialized document.
- *
- * <p>
- * This setting does not apply to the MessagePack or RDF serializers.
- */
- public static final String SERIALIZER_maxIndent = PREFIX + "maxIndent";
-
- /**
- * <b>Configuration property:</b> Add <js>"_type"</js> properties when needed.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.addBeanTypeProperties"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</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.
- */
- public static final String SERIALIZER_addBeanTypeProperties = PREFIX + "addBeanTypeProperties";
-
- /**
- * <b>Configuration property:</b> Quote character.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.quoteChar"</js>
- * <li><b>Data type:</b> <code>Character</code>
- * <li><b>Default:</b> <js>'"'</js>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * This is the character used for quoting attributes and values.
- *
- * <p>
- * This setting does not apply to the MessagePack or RDF serializers.
- */
- public static final String SERIALIZER_quoteChar = PREFIX + "quoteChar";
-
- /**
- * <b>Configuration property:</b> Trim null bean property values.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.trimNullProperties"</js>
- * <li><b>Data type:</b> <code>Boolean</code>
- * <li><b>Default:</b> <jk>true</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * If <jk>true</jk>, null bean values will not be serialized to the output.
- *
- * <p>
- * Note that enabling this setting has the following effects on parsing:
- * <ul class='spaced-list'>
- * <li>
- * Map entries with <jk>null</jk> values will be lost.
- * </ul>
- */
- public static final String SERIALIZER_trimNullProperties = PREFIX + "trimNullProperties";
-
- /**
- * <b>Configuration property:</b> Trim empty lists and arrays.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.trimEmptyLists"</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>, empty list values will not be serialized to the output.
- *
- * <p>
- * Note that enabling this setting has the following effects on parsing:
- * <ul class='spaced-list'>
- * <li>
- * Map entries with empty list values will be lost.
- * <li>
- * Bean properties with empty list values will not be set.
- * </ul>
- */
- public static final String SERIALIZER_trimEmptyCollections = PREFIX + "trimEmptyLists";
-
- /**
- * <b>Configuration property:</b> Trim empty maps.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.trimEmptyMaps"</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>, empty map values will not be serialized to the output.
- *
- * <p>
- * Note that enabling this setting has the following effects on parsing:
- * <ul class='spaced-list'>
- * <li>
- * Bean properties with empty map values will not be set.
- * </ul>
- */
- public static final String SERIALIZER_trimEmptyMaps = PREFIX + "trimEmptyMaps";
-
- /**
- * <b>Configuration property:</b> Trim strings.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.trimStrings"</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>, string values will be trimmed of whitespace using {@link String#trim()} before being serialized.
- */
- public static final String SERIALIZER_trimStrings = PREFIX + "trimStrings";
-
- /**
- * <b>Configuration property:</b> URI context bean.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.uriContext"</js>
- * <li><b>Data type:</b> {@link UriContext}
- * <li><b>Default:</b> {@link UriContext#DEFAULT}
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Bean used for resolution of URIs to absolute or root-relative form.
- *
- * <h6 class='figure'>Example:</h6>
- * <p class='bcode'>
- * <js>"{authority:'http://localhost:10000',contextRoot:'/myContext',servletPath:'/myServlet',pathInfo:'/foo'}"</js>
- * </p>
- */
- public static final String SERIALIZER_uriContext = PREFIX + "uriContext";
-
- /**
- * <b>Configuration property:</b> URI resolution.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.uriResolution"</js>
- * <li><b>Data type:</b> {@link UriResolution}
- * <li><b>Default:</b> {@link UriResolution#NONE}
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Defines the resolution level for URIs when serializing any of the following:
- * <ul>
- * <li>{@link java.net.URI}
- * <li>{@link java.net.URL}
- * <li>Properties annotated with {@link org.apache.juneau.annotation.URI @URI}
- * </ul>
- *
- * <p>
- * Possible values are:
- * <ul>
- * <li>{@link UriResolution#ABSOLUTE}
- * - Resolve to an absolute URL (e.g. <js>"http://host:port/context-root/servlet-path/path-info"</js>).
- * <li>{@link UriResolution#ROOT_RELATIVE}
- * - Resolve to a root-relative URL (e.g. <js>"/context-root/servlet-path/path-info"</js>).
- * <li>{@link UriResolution#NONE}
- * - Don't do any URL resolution.
- * </ul>
- */
- public static final String SERIALIZER_uriResolution = PREFIX + "uriResolution";
-
- /**
- * <b>Configuration property:</b> URI relativity.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.uriRelativity"</js>
- * <li><b>Data type:</b> {@link UriRelativity}
- * <li><b>Default:</b> {@link UriRelativity#RESOURCE}
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Defines what relative URIs are relative to when serializing any of the following:
- * <ul>
- * <li>{@link java.net.URI}
- * <li>{@link java.net.URL}
- * <li>Properties annotated with {@link org.apache.juneau.annotation.URI @URI}
- * </ul>
- *
- * <p>
- * Possible values are:
- * <ul>
- * <li>{@link UriRelativity#RESOURCE}
- * - Relative URIs should be considered relative to the servlet URI.
- * <li>{@link UriRelativity#PATH_INFO}
- * - Relative URIs should be considered relative to the request URI.
- * </ul>
- */
- public static final String SERIALIZER_uriRelativity = PREFIX + "uriRelativity";
-
- /**
- * <b>Configuration property:</b> Sort arrays and collections alphabetically.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.sortCollections"</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>
- * Note that this introduces a performance penalty.
- */
- public static final String SERIALIZER_sortCollections = PREFIX + "sortCollections";
-
- /**
- * <b>Configuration property:</b> Sort maps alphabetically.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.sortMaps"</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>
- * Note that this introduces a performance penalty.
- */
- public static final String SERIALIZER_sortMaps = PREFIX + "sortMaps";
-
- /**
- * <b>Configuration property:</b> Abridged output.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.abridged"</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>
- * When enabled, it is assumed that the parser knows the exact Java POJO type being parsed, and therefore top-level
- * type information that might normally be included to determine the data type will not be serialized.
- *
- * <p>
- * For example, when serializing a POJO with a {@link Bean#typeName()} value, a <js>"_type"</js> will be added when
- * this setting is disabled, but not added when it is enabled.
- */
- public static final String SERIALIZER_abridged = PREFIX + "abridged";
-
- /**
- * <b>Configuration property:</b> Serializer listener.
- *
- * <ul>
- * <li><b>Name:</b> <js>"Serializer.listener"</js>
- * <li><b>Data type:</b> <code>Class<? extends SerializerListener></code>
- * <li><b>Default:</b> <jk>null</jk>
- * <li><b>Session-overridable:</b> <jk>true</jk>
- * </ul>
- *
- * <p>
- * Class used to listen for errors and warnings that occur during serialization.
- */
- public static final String SERIALIZER_listener = PREFIX + "listener";
+ static final SerializerContext DEFAULT = new SerializerContext(PropertyStore.create());
final int maxDepth, initialDepth, maxIndent;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/d22f1b26/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
index e6992f0..77a8f3b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
@@ -15,7 +15,7 @@ package org.apache.juneau.serializer;
import static org.apache.juneau.BeanContext.*;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.serializer.Serializer.*;
import java.util.*;
@@ -207,55 +207,55 @@ public class SerializerGroupBuilder {
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_maxDepth} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_maxDepth} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_maxDepth
+ * @see Serializer#SERIALIZER_maxDepth
*/
public SerializerGroupBuilder maxDepth(int value) {
return property(SERIALIZER_maxDepth, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_initialDepth} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_initialDepth} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_initialDepth
+ * @see Serializer#SERIALIZER_initialDepth
*/
public SerializerGroupBuilder initialDepth(int value) {
return property(SERIALIZER_initialDepth, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_detectRecursions} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_detectRecursions} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_detectRecursions
+ * @see Serializer#SERIALIZER_detectRecursions
*/
public SerializerGroupBuilder detectRecursions(boolean value) {
return property(SERIALIZER_detectRecursions, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_ignoreRecursions} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_ignoreRecursions} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_ignoreRecursions
+ * @see Serializer#SERIALIZER_ignoreRecursions
*/
public SerializerGroupBuilder ignoreRecursions(boolean value) {
return property(SERIALIZER_ignoreRecursions, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_useWhitespace} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_useWhitespace} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_useWhitespace
+ * @see Serializer#SERIALIZER_useWhitespace
*/
public SerializerGroupBuilder useWhitespace(boolean value) {
return property(SERIALIZER_useWhitespace, value);
@@ -271,33 +271,33 @@ public class SerializerGroupBuilder {
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_maxIndent} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_maxIndent} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_maxIndent
+ * @see Serializer#SERIALIZER_maxIndent
*/
public SerializerGroupBuilder maxIndent(boolean value) {
return property(SERIALIZER_maxIndent, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_addBeanTypeProperties} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_addBeanTypeProperties} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_addBeanTypeProperties
+ * @see Serializer#SERIALIZER_addBeanTypeProperties
*/
public SerializerGroupBuilder addBeanTypeProperties(boolean value) {
return property(SERIALIZER_addBeanTypeProperties, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_quoteChar} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_quoteChar} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_quoteChar
+ * @see Serializer#SERIALIZER_quoteChar
*/
public SerializerGroupBuilder quoteChar(char value) {
return property(SERIALIZER_quoteChar, value);
@@ -313,121 +313,121 @@ public class SerializerGroupBuilder {
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimNullProperties} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimNullProperties} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimNullProperties
+ * @see Serializer#SERIALIZER_trimNullProperties
*/
public SerializerGroupBuilder trimNullProperties(boolean value) {
return property(SERIALIZER_trimNullProperties, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimEmptyCollections} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimEmptyCollections} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimEmptyCollections
+ * @see Serializer#SERIALIZER_trimEmptyCollections
*/
public SerializerGroupBuilder trimEmptyCollections(boolean value) {
return property(SERIALIZER_trimEmptyCollections, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimEmptyMaps} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimEmptyMaps} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimEmptyMaps
+ * @see Serializer#SERIALIZER_trimEmptyMaps
*/
public SerializerGroupBuilder trimEmptyMaps(boolean value) {
return property(SERIALIZER_trimEmptyMaps, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_trimStrings} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_trimStrings} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_trimStrings
+ * @see Serializer#SERIALIZER_trimStrings
*/
public SerializerGroupBuilder trimStrings(boolean value) {
return property(SERIALIZER_trimStrings, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_uriContext} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_uriContext} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriContext
+ * @see Serializer#SERIALIZER_uriContext
*/
public SerializerGroupBuilder uriContext(UriContext value) {
return property(SERIALIZER_uriContext, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_uriResolution} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_uriResolution} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriResolution
+ * @see Serializer#SERIALIZER_uriResolution
*/
public SerializerGroupBuilder uriResolution(UriResolution value) {
return property(SERIALIZER_uriResolution, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_uriRelativity} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_uriRelativity} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_uriRelativity
+ * @see Serializer#SERIALIZER_uriRelativity
*/
public SerializerGroupBuilder uriRelativity(UriRelativity value) {
return property(SERIALIZER_uriRelativity, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_sortCollections} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_sortCollections} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortCollections
+ * @see Serializer#SERIALIZER_sortCollections
*/
public SerializerGroupBuilder sortCollections(boolean value) {
return property(SERIALIZER_sortCollections, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_sortMaps} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_sortMaps} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_sortMaps
+ * @see Serializer#SERIALIZER_sortMaps
*/
public SerializerGroupBuilder sortMaps(boolean value) {
return property(SERIALIZER_sortMaps, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_abridged} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_abridged} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_abridged
+ * @see Serializer#SERIALIZER_abridged
*/
public SerializerGroupBuilder abridged(boolean value) {
return property(SERIALIZER_abridged, value);
}
/**
- * Sets the {@link SerializerContext#SERIALIZER_listener} property on all serializers in this group.
+ * Sets the {@link Serializer#SERIALIZER_listener} property on all serializers in this group.
*
* @param value The new value for this property.
* @return This object (for method chaining).
- * @see SerializerContext#SERIALIZER_listener
+ * @see Serializer#SERIALIZER_listener
*/
public SerializerGroupBuilder listener(Class<? extends SerializerListener> value) {
return property(SERIALIZER_listener, value);
[3/7] incubator-juneau git commit: Move configuration properties to
serializer and parser classes.
Posted by ja...@apache.org.
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 */