This is an automated email from the ASF dual-hosted git repository. jamesbognar pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push: new b11351c Add convenience methods to Context. b11351c is described below commit b11351cd3076484d71309750b5b75e620e2081ef Author: JamesBognar <jamesbog...@apache.org> AuthorDate: Wed Feb 14 20:11:28 2018 -0500 Add convenience methods to Context. --- .../java/org/apache/juneau/ContextCacheTest.java | 6 +- .../java/org/apache/juneau/jena/RdfParser.java | 6 +- .../java/org/apache/juneau/jena/RdfSerializer.java | 20 +-- .../main/java/org/apache/juneau/BeanContext.java | 30 ++--- .../src/main/java/org/apache/juneau/Context.java | 44 ++++++ .../org/apache/juneau/html/HtmlDocSerializer.java | 4 +- .../org/apache/juneau/html/HtmlSerializer.java | 10 +- .../java/org/apache/juneau/json/JsonParser.java | 2 +- .../org/apache/juneau/json/JsonSerializer.java | 6 +- .../apache/juneau/msgpack/MsgPackSerializer.java | 2 +- .../main/java/org/apache/juneau/parser/Parser.java | 12 +- .../org/apache/juneau/serializer/Serializer.java | 30 ++--- .../org/apache/juneau/soap/SoapXmlSerializer.java | 2 +- .../main/java/org/apache/juneau/uon/UonParser.java | 4 +- .../java/org/apache/juneau/uon/UonSerializer.java | 4 +- .../juneau/urlencoding/UrlEncodingParser.java | 2 +- .../juneau/urlencoding/UrlEncodingSerializer.java | 2 +- .../main/java/org/apache/juneau/xml/XmlParser.java | 4 +- .../java/org/apache/juneau/xml/XmlSerializer.java | 8 +- .../apache/juneau/yaml/proto/YamlSerializer.java | 6 +- juneau-doc/src/main/javadoc/overview.html | 149 ++++++++++++--------- .../org/apache/juneau/rest/client/RestClient.java | 12 +- .../java/org/apache/juneau/rest/RestContext.java | 18 +-- 23 files changed, 227 insertions(+), 156 deletions(-) diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java index 81deb98..afd4a9e 100644 --- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java +++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java @@ -128,7 +128,7 @@ public class ContextCacheTest { public A(PropertyStore ps) { super(ps); - f1 = getProperty("A.f1", String.class, "xxx"); + f1 = getStringProperty("A.f1", "xxx"); } @Override @@ -147,7 +147,7 @@ public class ContextCacheTest { public B(PropertyStore ps) { super(ps); - f2 = getProperty("B.f2.i", Integer.class, -1); + f2 = getIntegerProperty("B.f2.i", -1); } } @@ -156,7 +156,7 @@ public class ContextCacheTest { public boolean f3; public C(PropertyStore ps) { super(ps); - f3 = getProperty("C.f3.b", boolean.class, false); + f3 = getBooleanProperty("C.f3.b", false); } } 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 505f92a..4126ce9 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 @@ -205,9 +205,9 @@ public class RdfParser extends ReaderParser implements RdfCommon { */ public RdfParser(PropertyStore ps, String...consumes) { super(ps, consumes); - trimWhitespace = getProperty(RDF_trimWhitespace, boolean.class, false); - looseCollections = getProperty(RDF_looseCollections, boolean.class, false); - rdfLanguage = getProperty(RDF_language, String.class, "RDF/XML-ABBREV"); + trimWhitespace = getBooleanProperty(RDF_trimWhitespace, false); + looseCollections = getBooleanProperty(RDF_looseCollections, false); + rdfLanguage = getStringProperty(RDF_language, "RDF/XML-ABBREV"); juneauNs = getInstanceProperty(RDF_juneauNs, Namespace.class, DEFAULT_JUNEAU_NS); juneauBpNs = getInstanceProperty(RDF_juneauBpNs, Namespace.class, DEFAULT_JUNEAUBP_NS); collectionFormat = getProperty(RDF_collectionFormat, RdfCollectionFormat.class, RdfCollectionFormat.DEFAULT); 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 aa2aae2..a0addab 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 @@ -336,17 +336,17 @@ public class RdfSerializer extends WriterSerializer implements RdfCommon { */ public RdfSerializer(PropertyStore ps, String produces, String...accept) { super(ps, produces, accept); - addLiteralTypes = getProperty(RDF_addLiteralTypes, boolean.class, false); - addRootProperty = getProperty(RDF_addRootProperty, boolean.class, false); - useXmlNamespaces = getProperty(RDF_useXmlNamespaces, boolean.class, true); - looseCollections = getProperty(RDF_looseCollections, boolean.class, false); - autoDetectNamespaces = getProperty(RDF_autoDetectNamespaces, boolean.class, true); - rdfLanguage = getProperty(RDF_language, String.class, "RDF/XML-ABBREV"); - juneauNs = ps.getProperty(RDF_juneauNs, Namespace.class, DEFAULT_JUNEAU_NS); - juneauBpNs = ps.getProperty(RDF_juneauBpNs, Namespace.class, DEFAULT_JUNEAUBP_NS); + addLiteralTypes = getBooleanProperty(RDF_addLiteralTypes, false); + addRootProperty = getBooleanProperty(RDF_addRootProperty, false); + useXmlNamespaces = getBooleanProperty(RDF_useXmlNamespaces, true); + looseCollections = getBooleanProperty(RDF_looseCollections, false); + autoDetectNamespaces = getBooleanProperty(RDF_autoDetectNamespaces, true); + rdfLanguage = getStringProperty(RDF_language, "RDF/XML-ABBREV"); + juneauNs = getProperty(RDF_juneauNs, Namespace.class, DEFAULT_JUNEAU_NS); + juneauBpNs = getProperty(RDF_juneauBpNs, Namespace.class, DEFAULT_JUNEAUBP_NS); collectionFormat = getProperty(RDF_collectionFormat, RdfCollectionFormat.class, RdfCollectionFormat.DEFAULT); - namespaces = ps.getProperty(RDF_namespaces, Namespace[].class, new Namespace[0]); - addBeanTypeProperties = getProperty(RDF_addBeanTypeProperties, boolean.class, getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + namespaces = getProperty(RDF_namespaces, Namespace[].class, new Namespace[0]); + addBeanTypeProperties = getBooleanProperty(RDF_addBeanTypeProperties, getBooleanProperty(SERIALIZER_addBeanTypeProperties, true)); Map<String,Object> m = new LinkedHashMap<>(); for (String k : getPropertyKeys("RdfCommon")) 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 89a1225..36952be 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 @@ -1787,21 +1787,21 @@ public class BeanContext extends Context { beanHashCode = ps.hashCode("BeanContext"); - beansRequireDefaultConstructor = getProperty(BEAN_beansRequireDefaultConstructor, boolean.class, false); - beansRequireSerializable = getProperty(BEAN_beansRequireSerializable, boolean.class, false); - beansRequireSettersForGetters = getProperty(BEAN_beansRequireSettersForGetters, boolean.class, false); - beansRequireSomeProperties = getProperty(BEAN_beansRequireSomeProperties, boolean.class, true); - beanMapPutReturnsOldValue = getProperty(BEAN_beanMapPutReturnsOldValue, boolean.class, false); - useInterfaceProxies = getProperty(BEAN_useInterfaceProxies, boolean.class, true); - ignoreUnknownBeanProperties = getProperty(BEAN_ignoreUnknownBeanProperties, boolean.class, false); - ignoreUnknownNullBeanProperties = getProperty(BEAN_ignoreUnknownNullBeanProperties, boolean.class, true); - ignorePropertiesWithoutSetters = getProperty(BEAN_ignorePropertiesWithoutSetters, boolean.class, true); - ignoreInvocationExceptionsOnGetters = getProperty(BEAN_ignoreInvocationExceptionsOnGetters, boolean.class, false); - ignoreInvocationExceptionsOnSetters = getProperty(BEAN_ignoreInvocationExceptionsOnSetters, boolean.class, false); - useJavaBeanIntrospector = getProperty(BEAN_useJavaBeanIntrospector, boolean.class, false); - sortProperties = getProperty(BEAN_sortProperties, boolean.class, false); - beanTypePropertyName = getProperty(BEAN_beanTypePropertyName, String.class, "_type"); - debug = getProperty(BEAN_debug, boolean.class, false); + beansRequireDefaultConstructor = getBooleanProperty(BEAN_beansRequireDefaultConstructor, false); + beansRequireSerializable = getBooleanProperty(BEAN_beansRequireSerializable, false); + beansRequireSettersForGetters = getBooleanProperty(BEAN_beansRequireSettersForGetters, false); + beansRequireSomeProperties = getBooleanProperty(BEAN_beansRequireSomeProperties, true); + beanMapPutReturnsOldValue = getBooleanProperty(BEAN_beanMapPutReturnsOldValue, false); + useInterfaceProxies = getBooleanProperty(BEAN_useInterfaceProxies, true); + ignoreUnknownBeanProperties = getBooleanProperty(BEAN_ignoreUnknownBeanProperties, false); + ignoreUnknownNullBeanProperties = getBooleanProperty(BEAN_ignoreUnknownNullBeanProperties, true); + ignorePropertiesWithoutSetters = getBooleanProperty(BEAN_ignorePropertiesWithoutSetters, true); + ignoreInvocationExceptionsOnGetters = getBooleanProperty(BEAN_ignoreInvocationExceptionsOnGetters, false); + ignoreInvocationExceptionsOnSetters = getBooleanProperty(BEAN_ignoreInvocationExceptionsOnSetters, false); + useJavaBeanIntrospector = getBooleanProperty(BEAN_useJavaBeanIntrospector, false); + sortProperties = getBooleanProperty(BEAN_sortProperties, false); + beanTypePropertyName = getStringProperty(BEAN_beanTypePropertyName, "_type"); + debug = getBooleanProperty(BEAN_debug, false); beanConstructorVisibility = getProperty(BEAN_beanConstructorVisibility, Visibility.class, PUBLIC); beanClassVisibility = getProperty(BEAN_beanClassVisibility, Visibility.class, PUBLIC); diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java index 16a7fe3..81a5626 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java @@ -81,6 +81,50 @@ public abstract class Context { } /** + * Shortcut for calling <code>getProperty(key, Boolean.<jk>class</jk>, def)</code>. + * + * @param key The property name. + * @param def The default value. + * @return The property value, or the default value if it doesn't exist. + */ + public final Boolean getBooleanProperty(String key, Boolean def) { + return getProperty(key, Boolean.class, def); + } + + /** + * Shortcut for calling <code>getProperty(key, Integer.<jk>class</jk>, def)</code>. + * + * @param key The property name. + * @param def The default value. + * @return The property value, or the default value if it doesn't exist. + */ + public final Integer getIntegerProperty(String key, Integer def) { + return getProperty(key, Integer.class, def); + } + + /** + * Shortcut for calling <code>getProperty(key, Long.<jk>class</jk>, def)</code>. + * + * @param key The property name. + * @param def The default value. + * @return The property value, or the default value if it doesn't exist. + */ + public final Long getLongProperty(String key, Long def) { + return getProperty(key, Long.class, def); + } + + /** + * Shortcut for calling <code>getProperty(key, String.<jk>class</jk>, def)</code>. + * + * @param key The property name. + * @param def The default value. + * @return The property value, or the default value if it doesn't exist. + */ + public final String getStringProperty(String key, String def) { + return getProperty(key, String.class, def); + } + + /** * Returns the class property with the specified name. * * @param key The property name. 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 98c9205..763690a 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 @@ -568,9 +568,9 @@ public class HtmlDocSerializer extends HtmlStrippedDocSerializer { nav = getArrayProperty(HTMLDOC_nav, String.class); aside = getArrayProperty(HTMLDOC_aside, String.class); footer = getArrayProperty(HTMLDOC_footer, String.class); - nowrap = getProperty(HTMLDOC_nowrap, boolean.class, false); + nowrap = getBooleanProperty(HTMLDOC_nowrap, false); navlinks = getArrayProperty(HTMLDOC_navlinks, String.class); - noResultsMessage = getProperty(HTMLDOC_noResultsMessage, String.class, "<p>no results</p>"); + noResultsMessage = getStringProperty(HTMLDOC_noResultsMessage, "<p>no results</p>"); template = getInstanceProperty(HTMLDOC_template, HtmlDocTemplate.class, HtmlDocTemplateBasic.class); } 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 be9a9ce..123845b 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 @@ -675,11 +675,11 @@ public class HtmlSerializer extends XmlSerializer { public HtmlSerializer(PropertyStore ps, String produces, String...accept) { super(ps, produces, accept); uriAnchorText = getProperty(HTML_uriAnchorText, AnchorText.class, AnchorText.TO_STRING); - lookForLabelParameters = getProperty(HTML_detectLabelParameters, boolean.class, true); - detectLinksInStrings = getProperty(HTML_detectLinksInStrings, boolean.class, true); - labelParameter = getProperty(HTML_labelParameter, String.class, "label"); - addKeyValueTableHeaders = getProperty(HTML_addKeyValueTableHeaders, boolean.class, false); - addBeanTypeProperties = getProperty(HTML_addBeanTypeProperties, boolean.class, getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + lookForLabelParameters = getBooleanProperty(HTML_detectLabelParameters, true); + detectLinksInStrings = getBooleanProperty(HTML_detectLinksInStrings, true); + labelParameter = getStringProperty(HTML_labelParameter, "label"); + addKeyValueTableHeaders = getBooleanProperty(HTML_addKeyValueTableHeaders, false); + addBeanTypeProperties = getBooleanProperty(HTML_addBeanTypeProperties, getBooleanProperty(SERIALIZER_addBeanTypeProperties, true)); } @Override /* Context */ 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 776d7c7..5a4bdd3 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 @@ -200,7 +200,7 @@ public class JsonParser extends ReaderParser { */ public JsonParser(PropertyStore ps, String...consumes) { super(ps, consumes); - validateEnd = getProperty(JSON_validateEnd, boolean.class, false); + validateEnd = getBooleanProperty(JSON_validateEnd, false); } @Override /* Context */ 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 2490c62..8081465 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 @@ -403,9 +403,9 @@ public class JsonSerializer extends WriterSerializer { public JsonSerializer(PropertyStore ps, String produces, String...accept) { super(ps, produces, accept); - simpleMode = getProperty(JSON_simpleMode, boolean.class, false); - escapeSolidus = getProperty(JSON_escapeSolidus, boolean.class, false); - addBeanTypeProperties = getProperty(JSON_addBeanTypeProperties, boolean.class, getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + simpleMode = getBooleanProperty(JSON_simpleMode, false); + escapeSolidus = getBooleanProperty(JSON_escapeSolidus, false); + addBeanTypeProperties = getBooleanProperty(JSON_addBeanTypeProperties, getBooleanProperty(SERIALIZER_addBeanTypeProperties, true)); } @Override /* Context */ 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 1ad61e9..611f8c6 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 @@ -81,7 +81,7 @@ public class MsgPackSerializer extends OutputStreamSerializer { */ public MsgPackSerializer(PropertyStore ps) { super(ps, "octal/msgpack"); - this.addBeanTypeProperties = getProperty(MSGPACK_addBeanTypeProperties, boolean.class, getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + this.addBeanTypeProperties = getBooleanProperty(MSGPACK_addBeanTypeProperties, getBooleanProperty(SERIALIZER_addBeanTypeProperties, true)); } @Override /* Context */ 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 5fd5448..f7d4538 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 @@ -527,12 +527,12 @@ public abstract class Parser extends BeanContext { Parser(PropertyStore ps, String...consumes) { super(ps); - trimStrings = getProperty(PARSER_trimStrings, boolean.class, false); - strict = getProperty(PARSER_strict, boolean.class, false); - autoCloseStreams = getProperty(PARSER_autoCloseStreams, boolean.class, false); - unbuffered = getProperty(PARSER_unbuffered, boolean.class, false); - inputStreamCharset = getProperty(PARSER_inputStreamCharset, String.class, "UTF-8"); - fileCharset = getProperty(PARSER_fileCharset, String.class, "DEFAULT"); + trimStrings = getBooleanProperty(PARSER_trimStrings, false); + strict = getBooleanProperty(PARSER_strict, false); + autoCloseStreams = getBooleanProperty(PARSER_autoCloseStreams, false); + unbuffered = getBooleanProperty(PARSER_unbuffered, false); + inputStreamCharset = getStringProperty(PARSER_inputStreamCharset, "UTF-8"); + fileCharset = getStringProperty(PARSER_fileCharset, "DEFAULT"); listener = getClassProperty(PARSER_listener, ParserListener.class, null); this.consumes = new MediaType[consumes.length]; for (int i = 0; i < consumes.length; i++) { 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 8abebf9..18433ef 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 @@ -994,21 +994,21 @@ public abstract class Serializer extends BeanContext { Serializer(PropertyStore ps, String produces, String...accept) { super(ps); - maxDepth = getProperty(SERIALIZER_maxDepth, Integer.class, 100); - initialDepth = getProperty(SERIALIZER_initialDepth, Integer.class, 0); - detectRecursions = getProperty(SERIALIZER_detectRecursions, boolean.class, false); - ignoreRecursions = getProperty(SERIALIZER_ignoreRecursions, boolean.class, false); - useWhitespace = getProperty(SERIALIZER_useWhitespace, boolean.class, false); - maxIndent = getProperty(SERIALIZER_maxIndent, Integer.class, 100); - addBeanTypeProperties = getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true); - trimNulls = getProperty(SERIALIZER_trimNullProperties, boolean.class, true); - trimEmptyCollections = getProperty(SERIALIZER_trimEmptyCollections, boolean.class, false); - trimEmptyMaps = getProperty(SERIALIZER_trimEmptyMaps, boolean.class, false); - trimStrings = getProperty(SERIALIZER_trimStrings, boolean.class, false); - sortCollections = getProperty(SERIALIZER_sortCollections, boolean.class, false); - sortMaps = getProperty(SERIALIZER_sortMaps, boolean.class, false); - abridged = getProperty(SERIALIZER_abridged, boolean.class, false); - quoteChar = getProperty(SERIALIZER_quoteChar, String.class, "\"").charAt(0); + maxDepth = getIntegerProperty(SERIALIZER_maxDepth, 100); + initialDepth = getIntegerProperty(SERIALIZER_initialDepth, 0); + detectRecursions = getBooleanProperty(SERIALIZER_detectRecursions, false); + ignoreRecursions = getBooleanProperty(SERIALIZER_ignoreRecursions, false); + useWhitespace = getBooleanProperty(SERIALIZER_useWhitespace, false); + maxIndent = getIntegerProperty(SERIALIZER_maxIndent, 100); + addBeanTypeProperties = getBooleanProperty(SERIALIZER_addBeanTypeProperties, true); + trimNulls = getBooleanProperty(SERIALIZER_trimNullProperties, true); + trimEmptyCollections = getBooleanProperty(SERIALIZER_trimEmptyCollections, false); + trimEmptyMaps = getBooleanProperty(SERIALIZER_trimEmptyMaps, false); + trimStrings = getBooleanProperty(SERIALIZER_trimStrings, false); + sortCollections = getBooleanProperty(SERIALIZER_sortCollections, false); + sortMaps = getBooleanProperty(SERIALIZER_sortMaps, false); + abridged = getBooleanProperty(SERIALIZER_abridged, false); + quoteChar = getStringProperty(SERIALIZER_quoteChar, "\"").charAt(0); uriContext = getProperty(SERIALIZER_uriContext, UriContext.class, UriContext.DEFAULT); uriResolution = getProperty(SERIALIZER_uriResolution, UriResolution.class, UriResolution.NONE); uriRelativity = getProperty(SERIALIZER_uriRelativity, UriRelativity.class, UriRelativity.RESOURCE); 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 9e6b32d..c7cd919 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 @@ -67,7 +67,7 @@ public final class SoapXmlSerializer extends XmlSerializer { */ public SoapXmlSerializer(PropertyStore ps) { super(ps, "text/xml", "text/xml+soap"); - soapAction = getProperty(SOAPXML_SOAPAction, String.class, "http://www.w3.org/2003/05/soap-envelope"); + soapAction = getStringProperty(SOAPXML_SOAPAction, "http://www.w3.org/2003/05/soap-envelope"); } @Override /* Serializer */ 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 c41cf99..92fe38f 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 @@ -174,8 +174,8 @@ public class UonParser extends ReaderParser { */ public UonParser(PropertyStore ps, String...consumes) { super(ps, consumes); - this.decodeChars = getProperty(UON_decoding, boolean.class, false); - this.validateEnd = getProperty(UON_validateEnd, boolean.class, false); + this.decodeChars = getBooleanProperty(UON_decoding, false); + this.validateEnd = getBooleanProperty(UON_validateEnd, false); } @Override /* Context */ 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 73a3109..0edfcf7 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 @@ -347,8 +347,8 @@ public class UonSerializer extends WriterSerializer { */ public UonSerializer(PropertyStore ps, String produces, String...accept) { super(ps, produces, accept); - encodeChars = getProperty(UON_encoding, boolean.class, false); - addBeanTypeProperties = getProperty(UON_addBeanTypeProperties, boolean.class, getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + encodeChars = getBooleanProperty(UON_encoding, false); + addBeanTypeProperties = getBooleanProperty(UON_addBeanTypeProperties, getBooleanProperty(SERIALIZER_addBeanTypeProperties, true)); paramFormat = getProperty(UON_paramFormat, ParamFormat.class, ParamFormat.UON); } 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 88cd2ca..8110c3a 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 @@ -123,7 +123,7 @@ public class UrlEncodingParser extends UonParser { .build(), "application/x-www-form-urlencoded" ); - expandedParams = getProperty(URLENC_expandedParams, boolean.class, false); + expandedParams = getBooleanProperty(URLENC_expandedParams, false); } @Override /* Context */ 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 c38a43c..af0a939 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 @@ -292,7 +292,7 @@ public class UrlEncodingSerializer extends UonSerializer { produces, accept ); - expandedParams = getProperty(URLENC_expandedParams, boolean.class, false); + expandedParams = getBooleanProperty(URLENC_expandedParams, false); } @Override /* Context */ 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 4a6838d..f7d951e 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 @@ -217,8 +217,8 @@ public class XmlParser extends ReaderParser { */ public XmlParser(PropertyStore ps, String...consumes) { super(ps, consumes); - validating = getProperty(XML_validating, boolean.class, false); - preserveRootElement = getProperty(XML_preserveRootElement, boolean.class, false); + validating = getBooleanProperty(XML_validating, false); + preserveRootElement = getBooleanProperty(XML_preserveRootElement, false); reporter = getInstanceProperty(XML_reporter, XMLReporter.class, null); resolver = getInstanceProperty(XML_resolver, XMLResolver.class, null); eventAllocator = getInstanceProperty(XML_eventAllocator, XMLEventAllocator.class, null); 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 6751407..7a542b6 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 @@ -501,11 +501,11 @@ public class XmlSerializer extends WriterSerializer { */ public XmlSerializer(PropertyStore ps, String produces, String...accept) { super(ps, produces, accept); - autoDetectNamespaces = getProperty(XML_autoDetectNamespaces, boolean.class, true); - enableNamespaces = getProperty(XML_enableNamespaces, boolean.class, false); - addNamespaceUrlsToRoot = getProperty(XML_addNamespaceUrisToRoot, boolean.class, false); + autoDetectNamespaces = getBooleanProperty(XML_autoDetectNamespaces, true); + enableNamespaces = getBooleanProperty(XML_enableNamespaces, false); + addNamespaceUrlsToRoot = getBooleanProperty(XML_addNamespaceUrisToRoot, false); defaultNamespace = getInstanceProperty(XML_defaultNamespace, Namespace.class, DEFAULT_JUNEAU_NAMESPACE); - addBeanTypeProperties = getProperty(XML_addBeanTypeProperties, boolean.class, getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + addBeanTypeProperties = getBooleanProperty(XML_addBeanTypeProperties, getBooleanProperty(SERIALIZER_addBeanTypeProperties, true)); xsNamespace = getInstanceProperty(XML_xsNamespace, Namespace.class, DEFAULT_XS_NAMESPACE); namespaces = getInstanceArrayProperty(XML_namespaces, Namespace.class, new Namespace[0]); } 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 ad5fadd..0e107be 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 @@ -295,9 +295,9 @@ public class YamlSerializer extends WriterSerializer { */ public YamlSerializer(PropertyStore ps, String produces, String...accept) { super(ps, produces, accept); - simpleMode = getProperty(YAML_simpleMode, boolean.class, false); - escapeSolidus = getProperty(YAML_escapeSolidus, boolean.class, false); - addBeanTypeProperties = getProperty(YAML_addBeanTypeProperties, boolean.class, getProperty(SERIALIZER_addBeanTypeProperties, boolean.class, true)); + simpleMode = getBooleanProperty(YAML_simpleMode, false); + escapeSolidus = getBooleanProperty(YAML_escapeSolidus, false); + addBeanTypeProperties = getBooleanProperty(YAML_addBeanTypeProperties, getBooleanProperty(SERIALIZER_addBeanTypeProperties, true)); } @Override /* Context */ diff --git a/juneau-doc/src/main/javadoc/overview.html b/juneau-doc/src/main/javadoc/overview.html index 388d3bd..e22fb66 100644 --- a/juneau-doc/src/main/javadoc/overview.html +++ b/juneau-doc/src/main/javadoc/overview.html @@ -145,6 +145,8 @@ <li><p><a class='doclink' href='#juneau-config'><i>juneau-config</i></a></p> <ol> <li><p><a class='doclink' href='#juneau-config.Overview'>Overview</a></p> + <li><p><a class='doclink' href='#juneau-config.SectionBeans'>Section Beans</a></p> + <li><p><a class='doclink' href='#juneau-config.SectionInterfaces'>Section Interfaces</a></p> <li><p><a class='doclink' href='#juneau-config.Variables'>Variables</a></p> <li><p><a class='doclink' href='#juneau-config.EncodedEntries'>Encoded Entries</a></p> <li><p><a class='doclink' href='#juneau-config.Listeners'>Listeners</a></p> @@ -3145,7 +3147,7 @@ address.setState(StateEnum.<jsf>NY</jsf>); </p> <p> - Getter and setter values can be any parsable values, even other virtual beans. + Getter and setter values can be any <a class='doclink' href='#juneau-marshall.PojoCategories'>parsable</a> values, even other virtual beans. </p> <p> Under-the-covers, a virtual bean is simply a proxy interface on top of an existing <code>BeanMap</code> @@ -4655,7 +4657,7 @@ The <code>juneau-config</code> library contains a powerful API for creating and using INI-style config files. </p> <p> - An example of an INI file: + An example of the cotents of a config file: </p> <p class='bcode'> <cc># Default section</cc> @@ -4699,7 +4701,7 @@ The interface also allows a config file to be easily constructed programmatically: </p> <p class='bcode'> - <jc>// Construct the sample INI file programmatically</jc> + <jc>// Construct the sample config file programmatically</jc> ConfigFile cf = ConfigFile.<jsm>create</jsm>().build(<js>"MyConfig.cfg"</js>) .addLines(<jk>null</jk>, <js>"# Default section"</js>, @@ -4722,7 +4724,7 @@ to set values: </p> <p class='bcode'> - <jc>// Construct the sample INI file programmatically</jc> + <jc>// Construct the sample config file programmatically</jc> ConfigFile cf = ConfigFile.<jsm>create</jsm>().build(<js>"MyConfig.cfg"</js>) .addLines(<jk>null</jk>, <js>"# Default section"</js>) @@ -4741,7 +4743,7 @@ <p> Values are LAX JSON (i.e. unquoted attributes, single quotes) except for top-level strings which are left unquoted. - Any parsable object types are supported as values (e.g. arrays, collections, beans, swappable objects, + <br>Any <a class='doclink' href='#juneau-marshall.PojoCategories'>parsable</a> types are supported as values (e.g. arrays, collections, beans, swappable objects, enums, etc...). </p> <p> @@ -4753,7 +4755,7 @@ The ability to use variables to reference environment variables, system properties, other config file entries, and a host of other types. <li> - APIs for updating, modifying, and saving configuration files <b style='text-decoration: underline;'>without losing comments or formatting</b>. + APIs for updating, modifying, and saving configuration files <b style='text-decoration: underline;'>without losing comments or formatting</b>! <li> Extensive listener APIs. </ul> @@ -4779,47 +4781,23 @@ <cc># A POJO that can be converted from JSON</cc> <ck>aBean</ck> = <cv>{foo:'bar',baz:123}</cv> - - <cc># A system property</cc> - <ck>locale</ck> = <cv>$S{java.locale, en_US}</cv> - - <cc># An environment variable</cc> - <ck>path</ck> = <cv>$E{PATH, unknown}</cv> - - <cc># A manifest file entry</cc> - <ck>mainClass</ck> = <cv>$MF{Main-Class}</cv> - - <cc># Another value in this config file</cc> - <ck>sameAsAnInt</ck> = <cv>$C{MySection/anInt}</cv> - - <cc># A command-line argument in the form "myarg=foo"</cc> - <ck>myArg</ck> = <cv>$ARG{myarg}</cv> - - <cc># The first command-line argument</cc> - <ck>firstArg</ck> = <cv>$ARG{0}</cv> - - <cc># Look for system property, or env var if that doesn't exist, or command-line arg if that doesn't exist.</cc> - <ck>nested</ck> = <cv>$S{mySystemProperty,$E{MY_ENV_VAR,$ARG{0}}}</cv> - - <cc># A POJO with embedded variables</cc> - <ck>aBean2</ck> = <cv>{foo:'$ARG{0}',baz:$C{MySection/anInt}}</cv> </p> <p class='bcode'> <jc>// Java code for accessing config entries above.</jc> - ConfigFile cf = Microservice.<jsm>getConfig</jsm>(); + ConfigFile cf = ConfigFile.<jsf>create</jsf>().build(<js>"MyConfig.cfg"</js>); <jk>int</jk> anInt = cf.getInt(<js>"MySection/anInt"</js>); <jk>boolean</jk> aBoolean = cf.getBoolean(<js>"MySection/aBoolean"</js>); <jk>int</jk>[] anIntArray = cf.getObject(<jk>int</jk>[].<jk>class</jk>, <js>"MySection/anIntArray"</js>); URL aURL = cf.getObject(URL.<jk>class</jk>, <js>"MySection/aURL"</js>); MyBean aBean = cf.getObject(MyBean.<jk>class</jk>, <js>"MySection/aBean"</js>); - Locale locale = cf.getObject(Locale.<jk>class</jk>, <js>"MySection/locale"</js>); - String path = cf.getString(<js>"MySection/path"</js>); - String mainClass = cf.getString(<js>"MySection/mainClass"</js>); - <jk>int</jk> sameAsAnInt = cf.getInt(<js>"MySection/sameAsAnInt"</js>); - String myArg = cf.getString(<js>"MySection/myArg"</js>); - String firstArg = cf.getString(<js>"MySection/firstArg"</js>); </p> + </div> + + <!-- ======================================================================================================== --> + <a id="juneau-config.SectionBeans"></a> + <h3 class='topic' onclick='toggle(this)'>6.2 - Section Beans</h3> + <div class='topic'> <p> Config files can also be used to directly populate beans using the {@link org.apache.juneau.config.ConfigFile#getSectionAsBean(String,Class,boolean)}: @@ -4844,6 +4822,12 @@ ConfigFile cf = ConfigFile.<jsm>create</jsm>().build(<js>"MyConfig.cfg"</js>); Address myAddress = cf.getSectionAsBean(<js>"MySection"</js>, Address.<jk>class</jk>); </p> + </div> + + <!-- ======================================================================================================== --> + <a id="juneau-config.SectionInterfaces"></a> + <h3 class='topic' onclick='toggle(this)'>6.3 - Section Interfaces</h3> + <div class='topic'> <p> Config file sections can also be accessed via interface proxies using {@link org.apache.juneau.config.ConfigFile#getSectionAsInterface(String,Class)}: @@ -4858,7 +4842,8 @@ <ck>int3dArray</ck> = <cv>[[[123,null],null],null]</cv> <ck>bean1d3dListMap</ck> = <cv>{key:[[[[{foo:'bar',baz:123}]]]]}</cv> - <jc>// Example interface</jc> + <jc>// Example interface.</jc> + <jc>// Setters are optional.</jc> <jk>public interface</jk> MyConfigInterface { String getString(); @@ -4880,33 +4865,77 @@ <jk>void</jk> setBean1d3dListMap(Map<String,List<MyBean[][][]>> x); } - <jc>// Example usage</jc> + <jc>// Example usage.</jc> ConfigFile cf = ConfigFile.<jsm>create</jsm>().build(<js>"MyConfig.cfg"</js>); MyConfigInterface ci = cf.getSectionAsInterface(<js>"MySection"</js>, MyConfigInterface.<jk>class</jk>); + + <jc>// Read a value.</jc> <jk>int</jk> myInt = ci.getInt(); + + <jc>// Write a value.</jc> ci.setBean(<jk>new</jk> MyBean()); + + <jc>// Save your changes.</jc> cf.save(); </p> </div> - + <!-- ======================================================================================================== --> <a id="juneau-config.Variables"></a> - <h3 class='topic' onclick='toggle(this)'>6.2 - Variables</h3> + <h3 class='topic' onclick='toggle(this)'>6.4 - Variables</h3> <div class='topic'> <p> Config files can contain variables that get resolved dynamically using the {@link org.apache.juneau.svl.VarResolver} API. </p> + <h5 class='figure'>Example:</h5> + <p class='bcode'> + <cc>#--------------------------</cc> + <cc># My section</cc> + <cc>#--------------------------</cc> + <cs>[MySection]</cs> + + <cc># A system property</cc> + <ck>locale</ck> = <cv>$S{java.locale, en_US}</cv> + + <cc># An environment variable</cc> + <ck>path</ck> = <cv>$E{PATH, unknown}</cv> + + <cc># A manifest file entry</cc> + <ck>mainClass</ck> = <cv>$MF{Main-Class}</cv> + + <cc># Another value in this config file</cc> + <ck>sameAsAnInt</ck> = <cv>$C{MySection/anInt}</cv> + + <cc># A command-line argument in the form "myarg=foo"</cc> + <ck>myArg</ck> = <cv>$ARG{myarg}</cv> + + <cc># The first command-line argument</cc> + <ck>firstArg</ck> = <cv>$ARG{0}</cv> + + <cc># Look for system property, or env var if that doesn't exist, or command-line arg if that doesn't exist.</cc> + <ck>nested</ck> = <cv>$S{mySystemProperty,$E{MY_ENV_VAR,$ARG{0}}}</cv> + + <cc># A POJO with embedded variables</cc> + <ck>aBean2</ck> = <cv>{foo:'$ARG{0}',baz:$C{MySection/anInt}}</cv> + </p> + <p class='bcode'> + <jc>// Java code for accessing config entries above.</jc> + ConfigFile cf = Microservice.<jsm>getInstance</jsm>().getConfig(); + + Locale locale = cf.getObject(Locale.<jk>class</jk>, <js>"MySection/locale"</js>); + String path = cf.getString(<js>"MySection/path"</js>); + String mainClass = cf.getString(<js>"MySection/mainClass"</js>); + <jk>int</jk> sameAsAnInt = cf.getInt(<js>"MySection/sameAsAnInt"</js>); + String myArg = cf.getString(<js>"MySection/myArg"</js>); + String firstArg = cf.getString(<js>"MySection/firstArg"</js>); + </p> <p> Resolving config files can be retrieved through the following methods: </p> <ul class='spaced-list'> - <li> - {@link org.apache.juneau.config.ConfigFile#getResolving()} - Returns a config file that resolves a default - set of variables. - <li> - {@link org.apache.juneau.config.ConfigFile#getResolving(VarResolver)} - Returns a config file that resolves - a custom set of variables. + <li class='jm'>{@link org.apache.juneau.config.ConfigFile#getResolving()} - Returns a config file that resolves a default set of variables. + <li class='jm'>{@link org.apache.juneau.config.ConfigFile#getResolving(VarResolver)} - Returns a config file that resolves a custom set of variables. </ul> <p> The default {@link org.apache.juneau.config.ConfigFile#getResolving()} method returns a config file that resolves @@ -4954,7 +4983,7 @@ <!-- ======================================================================================================== --> <a id="juneau-config.EncodedEntries"></a> - <h3 class='topic' onclick='toggle(this)'>6.3 - Encoded Entries</h3> + <h3 class='topic' onclick='toggle(this)'>6.5 - Encoded Entries</h3> <div class='topic'> <p> If a config file contains sensitive information such as passwords, those values can be @@ -4989,7 +5018,7 @@ <!-- ======================================================================================================== --> <a id="juneau-config.Listeners"></a> - <h3 class='topic' onclick='toggle(this)'>6.4 - Listeners</h3> + <h3 class='topic' onclick='toggle(this)'>6.6 - Listeners</h3> <div class='topic'> <p> The following method is provided for listening to changes made on config files: @@ -5028,7 +5057,7 @@ <!-- ======================================================================================================== --> <a id="juneau-config.CommandLine"></a> - <h3 class='topic' onclick='toggle(this)'>6.5 - Command Line API</h3> + <h3 class='topic' onclick='toggle(this)'>6.7 - Command Line API</h3> <div class='topic'> <p> The {@link org.apache.juneau.config.ConfigFileBuilder} class contains a @@ -5071,7 +5100,7 @@ <!-- ======================================================================================================== --> <a id="juneau-config.Serializing"></a> - <h3 class='topic' onclick='toggle(this)'>6.6 - Serializing Config Files</h3> + <h3 class='topic' onclick='toggle(this)'>6.8 - Serializing Config Files</h3> <div class='topic'> <p> Instances of {@link org.apache.juneau.config.ConfigFile} are POJOs that can be serialized to and parsed from @@ -5283,7 +5312,7 @@ <!-- ======================================================================================================== --> <a id="juneau-config.Merging"></a> - <h3 class='topic' onclick='toggle(this)'>6.7 - Merging Config Files</h3> + <h3 class='topic' onclick='toggle(this)'>6.9 - Merging Config Files</h3> <div class='topic'> <p> In the previous example, an edit page was shown that allows you to edit config files through @@ -5295,7 +5324,7 @@ trigger listeners when the values are different. </p> <p> - The edit page is implemented with this method which is a simple PUT with the contents of the new INI file as + The edit page is implemented with this method which is a simple PUT with the contents of the new config file as the body of the HTTP request: </p> <p class='bcode'> @@ -6604,7 +6633,7 @@ } </p> <p> - Annotations are provided for easy access to URL parameters with automatic conversion to any parsable object type. + Annotations are provided for easy access to URL parameters with automatic conversion to any <a class='doclink' href='#juneau-marshall.PojoCategories'>parsable</a> type. <br>For example, the following example can process the URL <l>"/urlWithParams?foo=foo&bar=[1,2,3]&baz=067e6162-3b6f-4ae2-a171-2470b63dff00"</l>... </p> <p class='bcode'> @@ -6969,8 +6998,7 @@ <h3 class='topic' onclick='toggle(this)'>7.7 - @Body</h3> <div class='topic'> <p> - The {@link org.apache.juneau.rest.annotation.Body @Body} annotation provides easy access to the HTTP body content as any parsable POJO type - (See <a class='doclink' href='#juneau-marshall.PojoCategories'>POJO Categories</a>). + The {@link org.apache.juneau.rest.annotation.Body @Body} annotation provides easy access to the HTTP body content as any <a class='doclink' href='#juneau-marshall.PojoCategories'>parsable</a> POJO type <br>In the example below, we're POSTing beans. </p> <p class='bcode'> @@ -9517,7 +9545,7 @@ <li> The method must be public. <li> - The parameter and return types must be <a href='#juneau-marshall.PojoCategories'>serializable and parsable</a>. + The parameter and return types must be <a class='doclink' href='#juneau-marshall.PojoCategories'>serializable and parsable</a>. </ul> <p> Juneau provides the capability of calling methods on POJOs on a server through client-side proxy interfaces. @@ -9645,8 +9673,7 @@ a browser with no coding involved. </p> <p> - The parameters and return types of the Java methods can be any of the supported serializable and parsable types - in <a class='doclink' href='#juneau-marshall.PojoCategories'>POJO Categories</a>. + The parameters and return types of the Java methods can be any of the supported <a class='doclink' href='#juneau-marshall.PojoCategories'>serializable and parsable types</a>. This ends up being WAY more flexible than other proxy interfaces since Juneau can handle so may POJO types out-of-the-box. Most of the time you don't even need to modify your existing Java implementation code. @@ -10547,7 +10574,7 @@ - Don't parse any response. <br>Note that the method will still throw a runtime exception if an error HTTP status is returned. <li> - Any parsable POJO + Any <a class='doclink' href='#juneau-marshall.PojoCategories'>parsable</a> POJO - The body of the response will be converted to the POJO using the parser defined on the <code>RestClient</code>. <li> @@ -11250,7 +11277,7 @@ <li> The method must be public. <li> - The parameter and return types must be <a href='#juneau-marshall.PojoCategories'>serializable and parsable</a>. + The parameter and return types must be <a class='doclink' href='#juneau-marshall.PojoCategories'>serializable and parsable</a>. </ul> <p> One significant feature is that the remoteable services servlet is a full-blown REST interface. diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java index 4928fc4..e5b92d9 100644 --- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java +++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java @@ -451,15 +451,15 @@ public class RestClient extends BeanContext implements Closeable { super(ps); this.httpClientBuilder = httpClientBuilder; this.httpClient = httpClient; - this.keepHttpClientOpen = getProperty(RESTCLIENT_keepHttpClientOpen, boolean.class, false); + this.keepHttpClientOpen = getBooleanProperty(RESTCLIENT_keepHttpClientOpen, false); this.headers = getMapProperty(RESTCLIENT_headers, String.class); this.query = getMapProperty(RESTCLIENT_query, String.class); - this.retries = getProperty(RESTCLIENT_retries, int.class, 1); - this.retryInterval = getProperty(RESTCLIENT_retryInterval, int.class, -1); + this.retries = getIntegerProperty(RESTCLIENT_retries, 1); + this.retryInterval = getIntegerProperty(RESTCLIENT_retryInterval, -1); this.retryOn = getInstanceProperty(RESTCLIENT_retryOn, RetryOn.class, RetryOn.DEFAULT); - this.debug = getProperty(RESTCLIENT_debug, boolean.class, false); - this.executorServiceShutdownOnClose = getProperty(RESTCLIENT_executorServiceShutdownOnClose, boolean.class, false); - this.rootUrl = StringUtils.nullIfEmpty(getProperty(RESTCLIENT_rootUri, String.class, "").replaceAll("\\/$", "")); + this.debug = getBooleanProperty(RESTCLIENT_debug, false); + this.executorServiceShutdownOnClose = getBooleanProperty(RESTCLIENT_executorServiceShutdownOnClose, false); + this.rootUrl = StringUtils.nullIfEmpty(getStringProperty(RESTCLIENT_rootUri, "").replaceAll("\\/$", "")); Object o = getProperty(RESTCLIENT_serializer, Object.class, JsonSerializer.class); if (o instanceof Serializer) { diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java index 3c48a83..a0a1640 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java @@ -2834,15 +2834,15 @@ public final class RestContext extends BeanContext { PropertyStore ps = getPropertyStore().builder().add(builder.properties).build(); Class<?> resourceClass = resource.getClass(); - contextPath = nullIfEmpty(getProperty(REST_contextPath, String.class, null)); - allowHeaderParams = getProperty(REST_allowHeaderParams, boolean.class, true); - allowBodyParam = getProperty(REST_allowBodyParam, boolean.class, true); - allowedMethodParams = Collections.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(StringUtils.split(getProperty(REST_allowedMethodParams, String.class, "HEAD,OPTIONS"))))); - renderResponseStackTraces = getProperty(REST_renderResponseStackTraces, boolean.class, false); - useStackTraceHashes = getProperty(REST_useStackTraceHashes, boolean.class, true); - defaultCharset = getProperty(REST_defaultCharset, String.class, "utf-8"); - maxInput = getProperty(REST_maxInput, long.class, 100_000_000l); - clientVersionHeader = getProperty(REST_clientVersionHeader, String.class, "X-Client-Version"); + contextPath = nullIfEmpty(getStringProperty(REST_contextPath, null)); + allowHeaderParams = getBooleanProperty(REST_allowHeaderParams, true); + allowBodyParam = getBooleanProperty(REST_allowBodyParam, true); + allowedMethodParams = Collections.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(StringUtils.split(getStringProperty(REST_allowedMethodParams, "HEAD,OPTIONS"))))); + renderResponseStackTraces = getBooleanProperty(REST_renderResponseStackTraces, false); + useStackTraceHashes = getBooleanProperty(REST_useStackTraceHashes, true); + defaultCharset = getStringProperty(REST_defaultCharset, "utf-8"); + maxInput = getLongProperty(REST_maxInput, 100_000_000l); + clientVersionHeader = getStringProperty(REST_clientVersionHeader, "X-Client-Version"); converters = getInstanceArrayProperty(REST_converters, resource, RestConverter.class, new RestConverter[0], true, this); guards = getInstanceArrayProperty(REST_guards, resource, RestGuard.class, new RestGuard[0], true, this); -- To stop receiving notification emails like this one, please contact jamesbog...@apache.org.