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 2019/04/29 18:15:42 UTC
[juneau] branch master updated: [JUNEAU-102] Expanded REST
annotations
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 709930b [JUNEAU-102] Expanded REST annotations
709930b is described below
commit 709930baac32a4d8e8ab24005caad46ce3e3fbbf
Author: JamesBognar <ja...@apache.org>
AuthorDate: Mon Apr 29 14:14:23 2019 -0400
[JUNEAU-102] Expanded REST annotations
---
.../apache/juneau/annotation/BeanConfigTest.java | 296 +++++
.../juneau/csv/annotation/CsvConfigTest.java} | 77 +-
.../juneau/html/annotation/HtmlConfigTest.java | 143 +++
.../juneau/html/annotation/HtmlDocConfigTest.java | 155 +++
.../juneau/jena/annotation/RdfConfigTest.java | 296 +++++
.../juneau/jso/annotation/JsoConfigTest.java} | 77 +-
.../juneau/json/annotation/JsonConfigTest.java | 135 +++
.../juneau/jsonschema/JsonSchemaGeneratorTest.java | 4 +-
.../annotation/JsonSchemaConfigTest.java | 121 ++
.../msgpack/annotation/MsgPackConfigTest.java | 118 ++
.../juneau/oapi/annotation/OpenApiConfigTest.java | 72 ++
.../juneau/parser/annotation/ParserConfigTest.java | 166 +++
.../plaintext/annotation/PlainTextConfigTest.java | 72 ++
.../apache/juneau/reflection/ClassInfoTest.java | 79 +-
.../apache/juneau/reflection/MethodInfoTest.java | 135 ++-
.../annotation/SerializerConfigTest.java | 201 ++++
.../juneau/soap/annotation/SoapXmlConfigTest.java | 97 ++
.../juneau/uon/annotation/UonConfigTest.java | 132 +++
.../annotation/UrlEncodingConfigTest.java | 117 ++
.../juneau/xml/annotation/XmlConfigTest.java | 184 +++
.../org/apache/juneau/jena/RdfParserBuilder.java | 621 ++++++++++-
.../apache/juneau/jena/RdfSerializerBuilder.java | 643 ++++++++++-
.../apache/juneau/jena/annotation/RdfConfig.java | 638 +++++++++++
.../main/java/org/apache/juneau/BeanContext.java | 20 +-
.../java/org/apache/juneau/BeanContextBuilder.java | 457 ++++++--
.../org/apache/juneau/BeanTraverseBuilder.java | 143 ++-
.../main/java/org/apache/juneau/PropertyNamer.java | 5 +
.../org/apache/juneau/annotation/BeanConfig.java | 1057 ++++++++++++++++++
.../BeanDefMapper.java => annotation/CCEntry.java} | 36 +-
.../BeanDefMapper.java => annotation/CSEntry.java} | 36 +-
.../BeanDefMapper.java => annotation/SCEntry.java} | 36 +-
.../BeanDefMapper.java => annotation/SSEntry.java} | 36 +-
.../org/apache/juneau/csv/CsvParserBuilder.java | 128 ++-
.../apache/juneau/csv/CsvSerializerBuilder.java | 128 ++-
.../annotation/CsvConfig.java} | 45 +-
.../org/apache/juneau/html/HtmlDocSerializer.java | 21 +
.../juneau/html/HtmlDocSerializerBuilder.java | 1172 ++++++++++++++++++++
.../org/apache/juneau/html/HtmlDocTemplate.java | 5 +
.../org/apache/juneau/html/HtmlParserBuilder.java | 127 ++-
.../juneau/html/HtmlSchemaSerializerBuilder.java | 98 +-
.../apache/juneau/html/HtmlSerializerBuilder.java | 147 ++-
.../juneau/html/HtmlStrippedDocSerializer.java | 21 +
.../html/HtmlStrippedDocSerializerBuilder.java | 783 +++++++++++++
.../apache/juneau/html/annotation/HtmlConfig.java | 246 ++++
.../juneau/html/annotation/HtmlDocConfig.java | 376 +++++++
.../ClassTreeSet.java} | 44 +-
.../org/apache/juneau/internal/ObjectResolver.java | 120 ++
.../org/apache/juneau/jso/JsoParserBuilder.java | 127 ++-
.../apache/juneau/jso/JsoSerializerBuilder.java | 128 ++-
.../annotation/JsoConfig.java} | 45 +-
.../org/apache/juneau/json/JsonParserBuilder.java | 136 ++-
.../juneau/json/JsonSchemaSerializerBuilder.java | 128 ++-
.../apache/juneau/json/JsonSerializerBuilder.java | 141 ++-
.../apache/juneau/json/annotation/JsonConfig.java | 149 +++
.../apache/juneau/jsonschema/BeanDefMapper.java | 5 +
.../juneau/jsonschema/JsonSchemaGenerator.java | 4 +-
.../jsonschema/JsonSchemaGeneratorBuilder.java | 242 +++-
.../jsonschema/annotation/JsonSchemaConfig.java | 229 ++++
.../juneau/msgpack/MsgPackParserBuilder.java | 127 ++-
.../juneau/msgpack/MsgPackSerializerBuilder.java | 137 ++-
.../juneau/msgpack/annotation/MsgPackConfig.java | 65 ++
.../apache/juneau/oapi/OpenApiParserBuilder.java | 127 ++-
.../juneau/oapi/OpenApiSerializerBuilder.java | 128 ++-
.../annotation/OpenApiConfig.java} | 45 +-
.../juneau/parser/InputStreamParserBuilder.java | 158 ++-
.../org/apache/juneau/parser/ParserBuilder.java | 147 ++-
.../apache/juneau/parser/ParserGroupBuilder.java | 128 ++-
.../apache/juneau/parser/ReaderParserBuilder.java | 138 ++-
.../juneau/parser/annotation/ParserConfig.java | 266 +++++
.../juneau/plaintext/PlainTextParserBuilder.java | 127 ++-
.../plaintext/PlainTextSerializerBuilder.java | 128 ++-
.../annotation/PlainTextConfig.java} | 45 +-
.../AnnotationsMap.java} | 68 +-
.../java/org/apache/juneau/reflect/ClassInfo.java | 92 ++
.../ConfigAnnotationsMap.java} | 37 +-
.../java/org/apache/juneau/reflect/MethodInfo.java | 126 ++-
.../java/org/apache/juneau/reflect/ParamInfo.java | 7 +-
.../serializer/OutputStreamSerializerBuilder.java | 157 ++-
.../juneau/serializer/SerializerBuilder.java | 161 ++-
.../juneau/serializer/SerializerGroupBuilder.java | 128 ++-
.../juneau/serializer/WriterSerializerBuilder.java | 139 ++-
.../serializer/annotation/SerializerConfig.java | 421 +++++++
.../org/apache/juneau/soap/SoapXmlSerializer.java | 21 +
.../juneau/soap/SoapXmlSerializerBuilder.java | 137 ++-
.../annotation/SoapXmlConfig.java} | 83 +-
.../java/org/apache/juneau/transform/PojoSwap.java | 4 +-
.../org/apache/juneau/uon/UonParserBuilder.java | 138 ++-
.../apache/juneau/uon/UonSerializerBuilder.java | 161 ++-
.../apache/juneau/uon/annotation/UonConfig.java | 161 +++
.../urlencoding/UrlEncodingParserBuilder.java | 136 ++-
.../urlencoding/UrlEncodingSerializerBuilder.java | 137 ++-
.../urlencoding/annotation/UrlEncodingConfig.java | 72 ++
.../StringResolver.java} | 38 +-
.../main/java/org/apache/juneau/xml/Namespace.java | 8 +
.../XmlEventAllocator.java} | 33 +-
.../org/apache/juneau/xml/XmlParserBuilder.java | 198 +++-
.../BeanDefMapper.java => xml/XmlReporter.java} | 33 +-
.../BeanDefMapper.java => xml/XmlResolver.java} | 33 +-
.../apache/juneau/xml/XmlSerializerBuilder.java | 188 +++-
.../apache/juneau/xml/annotation/XmlConfig.java | 289 +++++
.../xmlschema/XmlSchemaSerializerBuilder.java | 128 ++-
.../juneau/rest/client/RestClientBuilder.java | 129 ++-
.../java/org/apache/juneau/rest/RestContext.java | 24 +-
.../org/apache/juneau/rest/RestContextBuilder.java | 335 ++++--
104 files changed, 15253 insertions(+), 1535 deletions(-)
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/annotation/BeanConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/annotation/BeanConfigTest.java
new file mode 100644
index 0000000..4e55e58
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/annotation/BeanConfigTest.java
@@ -0,0 +1,296 @@
+// ***************************************************************************************************************************
+// * 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.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.BeanContext.*;
+import static org.apache.juneau.BeanTraverseContext.*;
+
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.transform.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @BeanConfig annotation.
+ */
+public class BeanConfigTest {
+
+ private static void check(String expected, Object o) {
+ if (o instanceof Set) {
+ Set<String> s2 = new TreeSet<>();
+ for (Object o2 : (Set<?>)o)
+ s2.add(TO_STRING.apply(o2));
+ String actual = s2
+ .stream()
+ .collect(Collectors.joining(","));
+ assertEquals(expected, actual);
+ } else if (o instanceof List) {
+ List<?> l = (List<?>)o;
+ String actual = l
+ .stream()
+ .map(TO_STRING)
+ .collect(Collectors.joining(","));
+ assertEquals(expected, actual);
+ } else if (o instanceof Map) {
+ Map<?,?> m = (Map<?,?>)o;
+ String actual = m
+ .entrySet()
+ .stream()
+ .map(TO_STRING)
+ .collect(Collectors.joining(","));
+ assertEquals(expected, actual);
+ } else {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @SuppressWarnings({ "rawtypes" })
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ if (t instanceof Map.Entry) {
+ Map.Entry e = (Map.Entry)t;
+ return apply(e.getKey()) + "=" + apply(e.getValue());
+ }
+ if (t instanceof A1)
+ return "A1";
+ if (t instanceof Class)
+ return ((Class<?>)t).getSimpleName();
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input != null && input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Bean(typeName="A1")
+ public static class A1 {
+ public int foo;
+ }
+ @Bean(typeName="A2")
+ public static class A2 {
+ public int foo;
+ }
+ @Bean(typeName="A3")
+ public static class A3 {
+ public int foo;
+ }
+ public static class AB1 extends PojoSwap<String,Integer> {
+ }
+ public static class AB2 extends PojoSwap<String,Integer> {
+ }
+ public static class AB3 extends PojoSwap<String,Integer> {
+ }
+
+ @BeanConfig(
+ beanClassVisibility="$PRIVATE",
+ beanConstructorVisibility="$PRIVATE",
+ beanDictionary={A1.class,A2.class},
+ beanDictionary_replace={A1.class,A2.class,A3.class},
+ beanDictionary_remove=A2.class,
+ beanFieldVisibility="$PRIVATE",
+ beanFilters={A1.class,A2.class},
+ beanFilters_replace={A1.class,A2.class,A3.class},
+ beanFilters_remove=A2.class,
+ beanMapPutReturnsOldValue="$true",
+ beanMethodVisibility="$PRIVATE",
+ beansRequireDefaultConstructor="$true",
+ beansRequireSerializable="$true",
+ beansRequireSettersForGetters="$true",
+ beansRequireSomeProperties="$true",
+ beanTypePropertyName="$foo",
+ debug="$true",
+ detectRecursions="$true",
+ examples=@CSEntry(key=A1.class,value="${}"),
+ excludeProperties=@CSEntry(key=A1.class,value="$foo"),
+ fluentSetters="$true",
+ ignoreInvocationExceptionsOnGetters="$true",
+ ignoreInvocationExceptionsOnSetters="$true",
+ ignorePropertiesWithoutSetters="$true",
+ ignoreRecursions="$true",
+ ignoreUnknownBeanProperties="$true",
+ ignoreUnknownNullBeanProperties="$true",
+ implClasses=@CCEntry(key=A1.class,value=A1.class),
+ includeProperties=@CSEntry(key=A1.class,value="$foo"),
+ initialDepth="$1",
+ locale="$en-US",
+ maxDepth="$1",
+ mediaType="$text/foo",
+ notBeanClasses={A1.class,A2.class},
+ notBeanClasses_replace={A1.class,A2.class,A3.class},
+ notBeanClasses_remove=A2.class,
+ notBeanPackages={"$foo1","$foo2"},
+ notBeanPackages_replace={"$foo1","$foo2","$foo3"},
+ notBeanPackages_remove={"$foo2"},
+ pojoSwaps={AB1.class,AB2.class},
+ pojoSwaps_replace={AB1.class,AB2.class,AB3.class},
+ pojoSwaps_remove=AB2.class,
+ propertyNamer=PropertyNamerULC.class,
+ sortProperties="$true",
+ timeZone="$z",
+ useEnumNames="$true",
+ useInterfaceProxies="$true",
+ useJavaBeanIntrospector="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basic() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ JsonSerializer bc = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check("PRIVATE", bc.getProperty(BEAN_beanClassVisibility));
+ check("PRIVATE", bc.getProperty(BEAN_beanConstructorVisibility));
+ check("A1,A3", bc.getProperty(BEAN_beanDictionary));
+ check(null, bc.getProperty(BEAN_beanDictionary_add));
+ check(null, bc.getProperty(BEAN_beanDictionary_remove));
+ check("PRIVATE", bc.getProperty(BEAN_beanFieldVisibility));
+ check("A1,A3", bc.getProperty(BEAN_beanFilters));
+ check(null, bc.getProperty(BEAN_beanFilters_add));
+ check(null, bc.getProperty(BEAN_beanFilters_remove));
+ check("true", bc.getProperty(BEAN_beanMapPutReturnsOldValue));
+ check("PRIVATE", bc.getProperty(BEAN_beanMethodVisibility));
+ check("true", bc.getProperty(BEAN_beansRequireDefaultConstructor));
+ check("true", bc.getProperty(BEAN_beansRequireSerializable));
+ check("true", bc.getProperty(BEAN_beansRequireSettersForGetters));
+ check("true", bc.getProperty(BEAN_beansRequireSomeProperties));
+ check("foo", bc.getProperty(BEAN_beanTypePropertyName));
+ check("true", bc.getProperty(BEAN_debug));
+ check("true", bc.getProperty(BEANTRAVERSE_detectRecursions));
+ check("org.apache.juneau.annotation.BeanConfigTest$A1=A1", bc.getProperty(BEAN_examples));
+ check("org.apache.juneau.annotation.BeanConfigTest$A1=foo", bc.getProperty(BEAN_excludeProperties));
+ check("true", bc.getProperty(BEAN_fluentSetters));
+ check("true", bc.getProperty(BEAN_ignoreInvocationExceptionsOnGetters));
+ check("true", bc.getProperty(BEAN_ignoreInvocationExceptionsOnSetters));
+ check("true", bc.getProperty(BEAN_ignorePropertiesWithoutSetters));
+ check("true", bc.getProperty(BEANTRAVERSE_ignoreRecursions));
+ check("true", bc.getProperty(BEAN_ignoreUnknownBeanProperties));
+ check("true", bc.getProperty(BEAN_ignoreUnknownNullBeanProperties));
+ check("org.apache.juneau.annotation.BeanConfigTest$A1=A1", bc.getProperty(BEAN_implClasses));
+ check("org.apache.juneau.annotation.BeanConfigTest$A1=foo", bc.getProperty(BEAN_includeProperties));
+ check("1", bc.getProperty(BEANTRAVERSE_initialDepth));
+ check("en-US", bc.getProperty(BEAN_locale));
+ check("1", bc.getProperty(BEANTRAVERSE_maxDepth));
+ check("text/foo", bc.getProperty(BEAN_mediaType));
+ check("A1,A3", bc.getProperty(BEAN_notBeanClasses));
+ check(null, bc.getProperty(BEAN_notBeanClasses_add));
+ check(null, bc.getProperty(BEAN_notBeanClasses_remove));
+ check("foo1,foo3", bc.getProperty(BEAN_notBeanPackages));
+ check(null, bc.getProperty(BEAN_notBeanPackages_add));
+ check(null, bc.getProperty(BEAN_notBeanPackages_remove));
+ check("AB1,AB3", bc.getProperty(BEAN_pojoSwaps));
+ check(null, bc.getProperty(BEAN_pojoSwaps_add));
+ check(null, bc.getProperty(BEAN_pojoSwaps_remove));
+ check("PropertyNamerULC", bc.getProperty(BEAN_propertyNamer));
+ check("true", bc.getProperty(BEAN_sortProperties));
+ check("GMT", bc.getProperty(BEAN_timeZone));
+ check("true", bc.getProperty(BEAN_useEnumNames));
+ check("true", bc.getProperty(BEAN_useInterfaceProxies));
+ check("true", bc.getProperty(BEAN_useJavaBeanIntrospector));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @BeanConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValues() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsonSerializer bc = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, bc.getProperty(BEAN_beanClassVisibility));
+ check(null, bc.getProperty(BEAN_beanConstructorVisibility));
+ check(null, bc.getProperty(BEAN_beanDictionary));
+ check(null, bc.getProperty(BEAN_beanDictionary_add));
+ check(null, bc.getProperty(BEAN_beanDictionary_remove));
+ check(null, bc.getProperty(BEAN_beanFieldVisibility));
+ check(null, bc.getProperty(BEAN_beanFilters));
+ check(null, bc.getProperty(BEAN_beanFilters_add));
+ check(null, bc.getProperty(BEAN_beanFilters_remove));
+ check(null, bc.getProperty(BEAN_beanMapPutReturnsOldValue));
+ check(null, bc.getProperty(BEAN_beanMethodVisibility));
+ check(null, bc.getProperty(BEAN_beansRequireDefaultConstructor));
+ check(null, bc.getProperty(BEAN_beansRequireSerializable));
+ check(null, bc.getProperty(BEAN_beansRequireSettersForGetters));
+ check(null, bc.getProperty(BEAN_beansRequireSomeProperties));
+ check(null, bc.getProperty(BEAN_beanTypePropertyName));
+ check(null, bc.getProperty(BEAN_debug));
+ check(null, bc.getProperty(BEANTRAVERSE_detectRecursions));
+ check(null, bc.getProperty(BEAN_examples));
+ check(null, bc.getProperty(BEAN_excludeProperties));
+ check(null, bc.getProperty(BEAN_fluentSetters));
+ check(null, bc.getProperty(BEAN_ignoreInvocationExceptionsOnGetters));
+ check(null, bc.getProperty(BEAN_ignoreInvocationExceptionsOnSetters));
+ check(null, bc.getProperty(BEAN_ignorePropertiesWithoutSetters));
+ check(null, bc.getProperty(BEANTRAVERSE_ignoreRecursions));
+ check(null, bc.getProperty(BEAN_ignoreUnknownBeanProperties));
+ check(null, bc.getProperty(BEAN_ignoreUnknownNullBeanProperties));
+ check(null, bc.getProperty(BEAN_implClasses));
+ check(null, bc.getProperty(BEAN_includeProperties));
+ check(null, bc.getProperty(BEANTRAVERSE_initialDepth));
+ check(null, bc.getProperty(BEAN_locale));
+ check(null, bc.getProperty(BEANTRAVERSE_maxDepth));
+ check(null, bc.getProperty(BEAN_mediaType));
+ check(null, bc.getProperty(BEAN_notBeanClasses));
+ check(null, bc.getProperty(BEAN_notBeanClasses_add));
+ check(null, bc.getProperty(BEAN_notBeanClasses_remove));
+ check(null, bc.getProperty(BEAN_notBeanPackages));
+ check(null, bc.getProperty(BEAN_notBeanPackages_add));
+ check(null, bc.getProperty(BEAN_notBeanPackages_remove));
+ check(null, bc.getProperty(BEAN_pojoSwaps));
+ check(null, bc.getProperty(BEAN_pojoSwaps_add));
+ check(null, bc.getProperty(BEAN_pojoSwaps_remove));
+ check(null, bc.getProperty(BEAN_propertyNamer));
+ check(null, bc.getProperty(BEAN_sortProperties));
+ check(null, bc.getProperty(BEAN_timeZone));
+ check(null, bc.getProperty(BEAN_useEnumNames));
+ check(null, bc.getProperty(BEAN_useInterfaceProxies));
+ check(null, bc.getProperty(BEAN_useJavaBeanIntrospector));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotation() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsonSerializer bc = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, bc.getProperty(BEAN_beanClassVisibility));
+ }
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/csv/annotation/CsvConfigTest.java
similarity index 50%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
copy to juneau-core/juneau-core-test/src/test/java/org/apache/juneau/csv/annotation/CsvConfigTest.java
index 8e7b2c4..aed8d6d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/csv/annotation/CsvConfigTest.java
@@ -10,38 +10,53 @@
// * "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.jsonschema;
+package org.apache.juneau.csv.annotation;
-import java.net.*;
-
-import org.apache.juneau.*;
+import org.apache.juneau.csv.*;
+import org.apache.juneau.reflect.*;
+import org.junit.*;
/**
- * Interface used to retrieve identifiers and URIs for bean classes.
+ * Tests the @CsvConfig annotation.
*/
-public interface BeanDefMapper {
-
- /**
- * Returns the ID for the specified class.
- *
- * @param cm The class.
- * @return The ID for the specified class.
- */
- String getId(ClassMeta<?> cm);
-
- /**
- * Returns the URI for the specified class.
- *
- * @param cm The class.
- * @return The URI for the specified class.
- */
- URI getURI(ClassMeta<?> cm);
-
- /**
- * Returns the URI for the specified class by its ID.
- *
- * @param id The class ID.
- * @return The URI for the specified class.
- */
- URI getURI(String id);
-}
+public class CsvConfigTest {
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @CsvConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void defaultsSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ CsvSerializer.create().applyAnnotations(m, null).build();
+ }
+
+ @Test
+ public void defaultsParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ CsvParser.create().applyAnnotations(m, null).build();
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ CsvSerializer.create().applyAnnotations(m, null).build();
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ CsvParser.create().applyAnnotations(m, null).build();
+ }
+}
\ No newline at end of file
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/html/annotation/HtmlConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/html/annotation/HtmlConfigTest.java
new file mode 100644
index 0000000..b8ba548
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/html/annotation/HtmlConfigTest.java
@@ -0,0 +1,143 @@
+// ***************************************************************************************************************************
+// * 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.html.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.html.HtmlSerializer.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.html.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @HtmlConfig annotation.
+ */
+public class HtmlConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @HtmlConfig(
+ addBeanTypes="$true",
+ addKeyValueTableHeaders="$true",
+ detectLabelParameters="$true",
+ detectLinksInStrings="$true",
+ labelParameter="$foo",
+ uriAnchorText="$TO_STRING"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ HtmlSerializer x = HtmlSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ check("true", x.getProperty(HTML_addKeyValueTableHeaders));
+ check("true", x.getProperty(HTML_detectLabelParameters));
+ check("true", x.getProperty(HTML_detectLinksInStrings));
+ check("foo", x.getProperty(HTML_labelParameter));
+ check("TO_STRING", x.getProperty(HTML_uriAnchorText));
+ }
+
+ @Test
+ public void basicParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ HtmlParser x = HtmlParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(HTML_addKeyValueTableHeaders));
+ check(null, x.getProperty(HTML_detectLabelParameters));
+ check(null, x.getProperty(HTML_detectLinksInStrings));
+ check(null, x.getProperty(HTML_labelParameter));
+ check(null, x.getProperty(HTML_uriAnchorText));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @HtmlConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void defaultsSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ HtmlSerializer x = HtmlSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(HTML_addKeyValueTableHeaders));
+ check(null, x.getProperty(HTML_detectLabelParameters));
+ check(null, x.getProperty(HTML_detectLinksInStrings));
+ check(null, x.getProperty(HTML_labelParameter));
+ check(null, x.getProperty(HTML_uriAnchorText));
+ }
+
+ @Test
+ public void defaultsParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ HtmlParser x = HtmlParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(HTML_addKeyValueTableHeaders));
+ check(null, x.getProperty(HTML_detectLabelParameters));
+ check(null, x.getProperty(HTML_detectLinksInStrings));
+ check(null, x.getProperty(HTML_labelParameter));
+ check(null, x.getProperty(HTML_uriAnchorText));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ HtmlSerializer x = HtmlSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ HtmlParser x = HtmlParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/html/annotation/HtmlDocConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/html/annotation/HtmlDocConfigTest.java
new file mode 100644
index 0000000..8942a0c
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/html/annotation/HtmlDocConfigTest.java
@@ -0,0 +1,155 @@
+// ***************************************************************************************************************************
+// * 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.html.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.html.HtmlDocSerializer.*;
+
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+import org.apache.juneau.html.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @HtmlDocConfig annotation.
+ */
+public class HtmlDocConfigTest {
+
+ private static void check(String expected, Object o) {
+ if (o instanceof List) {
+ List<?> l = (List<?>)o;
+ String actual = l
+ .stream()
+ .map(TO_STRING)
+ .collect(Collectors.joining(","));
+ assertEquals(expected, actual);
+ } else {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ if (t instanceof Class)
+ return ((Class<?>)t).getSimpleName();
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @HtmlDocConfig(
+ aside="$foo",
+ footer="$foo",
+ head="$foo",
+ header="$foo",
+ nav="$foo",
+ navlinks="$foo1",
+ navlinks_replace="$foo2",
+ noResultsMessage="$foo",
+ nowrap="$true",
+ script="$foo1",
+ script_replace="$foo2",
+ style="$foo1",
+ style_replace="$foo2",
+ stylesheet="$foo1",
+ stylesheet_replace="$foo2",
+ template=BasicHtmlDocTemplate.class
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basic() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ HtmlDocSerializer x = HtmlDocSerializer.create().applyAnnotations(m, sr).build();
+ check("foo", x.getProperty(HTMLDOC_aside));
+ check("foo", x.getProperty(HTMLDOC_footer));
+ check("foo", x.getProperty(HTMLDOC_head));
+ check("foo", x.getProperty(HTMLDOC_header));
+ check("foo", x.getProperty(HTMLDOC_nav));
+ check("foo2", x.getProperty(HTMLDOC_navlinks));
+ check(null, x.getProperty(HTMLDOC_navlinks_add));
+ check("foo", x.getProperty(HTMLDOC_noResultsMessage));
+ check("true", x.getProperty(HTMLDOC_nowrap));
+ check("foo2", x.getProperty(HTMLDOC_script));
+ check(null, x.getProperty(HTMLDOC_script_add));
+ check("foo2", x.getProperty(HTMLDOC_style));
+ check(null, x.getProperty(HTMLDOC_style_add));
+ check("foo2", x.getProperty(HTMLDOC_stylesheet));
+ check(null, x.getProperty(HTMLDOC_stylesheet_add));
+ check("BasicHtmlDocTemplate", x.getProperty(HTMLDOC_template));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @HtmlDocConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void defaults() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ HtmlDocSerializer x = HtmlDocSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(HTMLDOC_aside));
+ check(null, x.getProperty(HTMLDOC_footer));
+ check(null, x.getProperty(HTMLDOC_head));
+ check(null, x.getProperty(HTMLDOC_header));
+ check(null, x.getProperty(HTMLDOC_nav));
+ check(null, x.getProperty(HTMLDOC_navlinks));
+ check(null, x.getProperty(HTMLDOC_navlinks_add));
+ check(null, x.getProperty(HTMLDOC_noResultsMessage));
+ check(null, x.getProperty(HTMLDOC_nowrap));
+ check(null, x.getProperty(HTMLDOC_script));
+ check(null, x.getProperty(HTMLDOC_script_add));
+ check(null, x.getProperty(HTMLDOC_style));
+ check(null, x.getProperty(HTMLDOC_style_add));
+ check(null, x.getProperty(HTMLDOC_stylesheet));
+ check(null, x.getProperty(HTMLDOC_stylesheet_add));
+ check(null, x.getProperty(HTMLDOC_template));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotation() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ HtmlDocSerializer x = HtmlDocSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(HTMLDOC_aside));
+ }
+}
\ No newline at end of file
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/annotation/RdfConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/annotation/RdfConfigTest.java
new file mode 100644
index 0000000..aa5cab7
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jena/annotation/RdfConfigTest.java
@@ -0,0 +1,296 @@
+// ***************************************************************************************************************************
+// * 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.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.serializer.Serializer.*;
+import static org.apache.juneau.jena.RdfSerializer.*;
+import static org.apache.juneau.jena.RdfParser.*;
+
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+import org.apache.juneau.jena.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @RdfConfig annotation.
+ */
+public class RdfConfigTest {
+
+ private static void check(String expected, Object o) {
+ if (o instanceof List) {
+ List<?> l = (List<?>)o;
+ String actual = l
+ .stream()
+ .map(TO_STRING)
+ .collect(Collectors.joining(","));
+ assertEquals(expected, actual);
+ } else {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @RdfConfig(
+ addBeanTypes="$true",
+ addLiteralTypes="$true",
+ addRootProperty="$true",
+ arp_embedding="$true",
+ arp_errorMode="$strict",
+ arp_iriRules="$strict",
+ autoDetectNamespaces="$true",
+ collectionFormat="$SEQ",
+ juneauBpNs="$foo",
+ juneauNs="$foo",
+ language="$N3",
+ looseCollections="$true",
+ n3_abbrevBaseUri="$true",
+ n3_indentProperty="$1",
+ n3_minGap="$1",
+ n3_objectLists="$true",
+ n3_propertyColumn="$1",
+ n3_subjectColumn="$1",
+ n3_useDoubles="$true",
+ n3_usePropertySymbols="$true",
+ n3_useTripleQuotedStrings="$true",
+ n3_widePropertyLen="$1",
+ namespaces="$foo",
+ rdfxml_allowBadUris="$true",
+ rdfxml_attributeQuoteChar="$'",
+ rdfxml_blockRules="$foo",
+ rdfxml_longId="$true",
+ rdfxml_relativeUris="$absolute",
+ rdfxml_showDoctypeDeclaration="$true",
+ rdfxml_showXmlDeclaration="$true",
+ rdfxml_tab="$1",
+ rdfxml_xmlBase="$foo",
+ trimWhitespace="$true",
+ useXmlNamespaces="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ RdfSerializer x = RdfSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ check("true", x.getProperty(RDF_addLiteralTypes));
+ check("true", x.getProperty(RDF_addRootProperty));
+ check("true", x.getProperty(RDF_arp_embedding));
+ check("strict", x.getProperty(RDF_arp_errorMode));
+ check("strict", x.getProperty(RDF_arp_iriRules));
+ check("true", x.getProperty(RDF_autoDetectNamespaces));
+ check("SEQ", x.getProperty(RDF_collectionFormat));
+ check("foo", x.getProperty(RDF_juneauBpNs));
+ check("foo", x.getProperty(RDF_juneauNs));
+ check("N3", x.getProperty(RDF_language));
+ check("true", x.getProperty(RDF_looseCollections));
+ check("true", x.getProperty(RDF_n3_abbrevBaseUri));
+ check("1", x.getProperty(RDF_n3_indentProperty));
+ check("1", x.getProperty(RDF_n3_minGap));
+ check("true", x.getProperty(RDF_n3_objectLists));
+ check("1", x.getProperty(RDF_n3_propertyColumn));
+ check("1", x.getProperty(RDF_n3_subjectColumn));
+ check("true", x.getProperty(RDF_n3_useDoubles));
+ check("true", x.getProperty(RDF_n3_usePropertySymbols));
+ check("true", x.getProperty(RDF_n3_useTripleQuotedStrings));
+ check("1", x.getProperty(RDF_n3_widePropertyLen));
+ check("foo", x.getProperty(RDF_namespaces));
+ check("true", x.getProperty(RDF_rdfxml_allowBadUris));
+ check("'", x.getProperty(RDF_rdfxml_attributeQuoteChar));
+ check("foo", x.getProperty(RDF_rdfxml_blockRules));
+ check("true", x.getProperty(RDF_rdfxml_longId));
+ check("absolute", x.getProperty(RDF_rdfxml_relativeUris));
+ check("true", x.getProperty(RDF_rdfxml_showDoctypeDeclaration));
+ check("true", x.getProperty(RDF_rdfxml_showXmlDeclaration));
+ check("1", x.getProperty(RDF_rdfxml_tab));
+ check("foo", x.getProperty(RDF_rdfxml_xmlBase));
+ check(null, x.getProperty(RDF_trimWhitespace));
+ check("true", x.getProperty(RDF_useXmlNamespaces));
+ }
+
+ @Test
+ public void basicParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ RdfParser x = RdfParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(RDF_addLiteralTypes));
+ check(null, x.getProperty(RDF_addRootProperty));
+ check("true", x.getProperty(RDF_arp_embedding));
+ check("strict", x.getProperty(RDF_arp_errorMode));
+ check("strict", x.getProperty(RDF_arp_iriRules));
+ check(null, x.getProperty(RDF_autoDetectNamespaces));
+ check("SEQ", x.getProperty(RDF_collectionFormat));
+ check("foo", x.getProperty(RDF_juneauBpNs));
+ check("foo", x.getProperty(RDF_juneauNs));
+ check("N3", x.getProperty(RDF_language));
+ check("true", x.getProperty(RDF_looseCollections));
+ check("true", x.getProperty(RDF_n3_abbrevBaseUri));
+ check("1", x.getProperty(RDF_n3_indentProperty));
+ check("1", x.getProperty(RDF_n3_minGap));
+ check("true", x.getProperty(RDF_n3_objectLists));
+ check("1", x.getProperty(RDF_n3_propertyColumn));
+ check("1", x.getProperty(RDF_n3_subjectColumn));
+ check("true", x.getProperty(RDF_n3_useDoubles));
+ check("true", x.getProperty(RDF_n3_usePropertySymbols));
+ check("true", x.getProperty(RDF_n3_useTripleQuotedStrings));
+ check("1", x.getProperty(RDF_n3_widePropertyLen));
+ check(null, x.getProperty(RDF_namespaces));
+ check("true", x.getProperty(RDF_rdfxml_allowBadUris));
+ check("'", x.getProperty(RDF_rdfxml_attributeQuoteChar));
+ check("foo", x.getProperty(RDF_rdfxml_blockRules));
+ check("true", x.getProperty(RDF_rdfxml_longId));
+ check("absolute", x.getProperty(RDF_rdfxml_relativeUris));
+ check("true", x.getProperty(RDF_rdfxml_showDoctypeDeclaration));
+ check("true", x.getProperty(RDF_rdfxml_showXmlDeclaration));
+ check("1", x.getProperty(RDF_rdfxml_tab));
+ check("foo", x.getProperty(RDF_rdfxml_xmlBase));
+ check("true", x.getProperty(RDF_trimWhitespace));
+ check("true", x.getProperty(RDF_useXmlNamespaces));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @RdfConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ RdfSerializer x = RdfSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(RDF_addLiteralTypes));
+ check(null, x.getProperty(RDF_addRootProperty));
+ check(null, x.getProperty(RDF_arp_embedding));
+ check(null, x.getProperty(RDF_arp_errorMode));
+ check(null, x.getProperty(RDF_arp_iriRules));
+ check(null, x.getProperty(RDF_autoDetectNamespaces));
+ check(null, x.getProperty(RDF_collectionFormat));
+ check(null, x.getProperty(RDF_juneauBpNs));
+ check(null, x.getProperty(RDF_juneauNs));
+ check(null, x.getProperty(RDF_language));
+ check(null, x.getProperty(RDF_looseCollections));
+ check(null, x.getProperty(RDF_n3_abbrevBaseUri));
+ check(null, x.getProperty(RDF_n3_indentProperty));
+ check(null, x.getProperty(RDF_n3_minGap));
+ check(null, x.getProperty(RDF_n3_objectLists));
+ check(null, x.getProperty(RDF_n3_propertyColumn));
+ check(null, x.getProperty(RDF_n3_subjectColumn));
+ check(null, x.getProperty(RDF_n3_useDoubles));
+ check(null, x.getProperty(RDF_n3_usePropertySymbols));
+ check(null, x.getProperty(RDF_n3_useTripleQuotedStrings));
+ check(null, x.getProperty(RDF_n3_widePropertyLen));
+ check(null, x.getProperty(RDF_namespaces));
+ check(null, x.getProperty(RDF_rdfxml_allowBadUris));
+ check(null, x.getProperty(RDF_rdfxml_attributeQuoteChar));
+ check(null, x.getProperty(RDF_rdfxml_blockRules));
+ check(null, x.getProperty(RDF_rdfxml_longId));
+ check(null, x.getProperty(RDF_rdfxml_relativeUris));
+ check(null, x.getProperty(RDF_rdfxml_showDoctypeDeclaration));
+ check(null, x.getProperty(RDF_rdfxml_showXmlDeclaration));
+ check(null, x.getProperty(RDF_rdfxml_tab));
+ check(null, x.getProperty(RDF_rdfxml_xmlBase));
+ check(null, x.getProperty(RDF_trimWhitespace));
+ check(null, x.getProperty(RDF_useXmlNamespaces));
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ RdfParser x = RdfParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(RDF_addLiteralTypes));
+ check(null, x.getProperty(RDF_addRootProperty));
+ check(null, x.getProperty(RDF_arp_embedding));
+ check(null, x.getProperty(RDF_arp_errorMode));
+ check(null, x.getProperty(RDF_arp_iriRules));
+ check(null, x.getProperty(RDF_autoDetectNamespaces));
+ check(null, x.getProperty(RDF_collectionFormat));
+ check(null, x.getProperty(RDF_juneauBpNs));
+ check(null, x.getProperty(RDF_juneauNs));
+ check(null, x.getProperty(RDF_language));
+ check(null, x.getProperty(RDF_looseCollections));
+ check(null, x.getProperty(RDF_n3_abbrevBaseUri));
+ check(null, x.getProperty(RDF_n3_indentProperty));
+ check(null, x.getProperty(RDF_n3_minGap));
+ check(null, x.getProperty(RDF_n3_objectLists));
+ check(null, x.getProperty(RDF_n3_propertyColumn));
+ check(null, x.getProperty(RDF_n3_subjectColumn));
+ check(null, x.getProperty(RDF_n3_useDoubles));
+ check(null, x.getProperty(RDF_n3_usePropertySymbols));
+ check(null, x.getProperty(RDF_n3_useTripleQuotedStrings));
+ check(null, x.getProperty(RDF_n3_widePropertyLen));
+ check(null, x.getProperty(RDF_namespaces));
+ check(null, x.getProperty(RDF_rdfxml_allowBadUris));
+ check(null, x.getProperty(RDF_rdfxml_attributeQuoteChar));
+ check(null, x.getProperty(RDF_rdfxml_blockRules));
+ check(null, x.getProperty(RDF_rdfxml_longId));
+ check(null, x.getProperty(RDF_rdfxml_relativeUris));
+ check(null, x.getProperty(RDF_rdfxml_showDoctypeDeclaration));
+ check(null, x.getProperty(RDF_rdfxml_showXmlDeclaration));
+ check(null, x.getProperty(RDF_rdfxml_tab));
+ check(null, x.getProperty(RDF_rdfxml_xmlBase));
+ check(null, x.getProperty(RDF_trimWhitespace));
+ check(null, x.getProperty(RDF_useXmlNamespaces));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ RdfSerializer x = RdfSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ RdfParser x = RdfParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jso/annotation/JsoConfigTest.java
similarity index 50%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
copy to juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jso/annotation/JsoConfigTest.java
index 8e7b2c4..9fa16ab 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jso/annotation/JsoConfigTest.java
@@ -10,38 +10,53 @@
// * "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.jsonschema;
+package org.apache.juneau.jso.annotation;
-import java.net.*;
-
-import org.apache.juneau.*;
+import org.apache.juneau.jso.*;
+import org.apache.juneau.reflect.*;
+import org.junit.*;
/**
- * Interface used to retrieve identifiers and URIs for bean classes.
+ * Tests the @JsoConfig annotation.
*/
-public interface BeanDefMapper {
-
- /**
- * Returns the ID for the specified class.
- *
- * @param cm The class.
- * @return The ID for the specified class.
- */
- String getId(ClassMeta<?> cm);
-
- /**
- * Returns the URI for the specified class.
- *
- * @param cm The class.
- * @return The URI for the specified class.
- */
- URI getURI(ClassMeta<?> cm);
-
- /**
- * Returns the URI for the specified class by its ID.
- *
- * @param id The class ID.
- * @return The URI for the specified class.
- */
- URI getURI(String id);
-}
+public class JsoConfigTest {
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @JsoConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void defaultsSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsoSerializer.create().applyAnnotations(m, null).build();
+ }
+
+ @Test
+ public void defaultsParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsoParser.create().applyAnnotations(m, null).build();
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsoSerializer.create().applyAnnotations(m, null).build();
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsoParser.create().applyAnnotations(m, null).build();
+ }
+}
\ No newline at end of file
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/json/annotation/JsonConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/json/annotation/JsonConfigTest.java
new file mode 100644
index 0000000..c7c7ff7
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/json/annotation/JsonConfigTest.java
@@ -0,0 +1,135 @@
+// ***************************************************************************************************************************
+// * 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.json.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.serializer.Serializer.*;
+import static org.apache.juneau.json.JsonSerializer.*;
+import static org.apache.juneau.json.JsonParser.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @JsonConfig annotation.
+ */
+public class JsonConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @JsonConfig(
+ addBeanTypes="$true",
+ escapeSolidus="$true",
+ simpleMode="$true",
+ validateEnd="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ JsonSerializer x = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ check("true", x.getProperty(JSON_escapeSolidus));
+ check("true", x.getProperty(JSON_simpleMode));
+ check(null, x.getProperty(JSON_validateEnd));
+ }
+
+ @Test
+ public void basicParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ JsonParser x = JsonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(JSON_escapeSolidus));
+ check(null, x.getProperty(JSON_simpleMode));
+ check("true", x.getProperty(JSON_validateEnd));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @JsonConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsonSerializer x = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(JSON_escapeSolidus));
+ check(null, x.getProperty(JSON_simpleMode));
+ check(null, x.getProperty(JSON_validateEnd));
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsonParser x = JsonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(JSON_escapeSolidus));
+ check(null, x.getProperty(JSON_simpleMode));
+ check(null, x.getProperty(JSON_validateEnd));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsonSerializer x = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(JSON_escapeSolidus));
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsonParser x = JsonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(JSON_validateEnd));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
index 207e944..863a6ee 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
@@ -686,7 +686,7 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_STRING_wDefault() throws Exception {
JsonSchemaGeneratorSession s = JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("string")
- .example(String.class, "bar1")
+ .exampleJson(String.class, "bar1")
.example(StringBuilder.class, new StringBuilder("bar2"))
.example(Character.class, 'b')
.example(char.class, 'c')
@@ -709,7 +709,7 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_STRING_2darray_wDefault() throws Exception {
JsonSchemaGeneratorSession s = JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("string")
- .example(String.class, "bar1")
+ .exampleJson(String.class, "bar1")
.example(StringBuilder.class, new StringBuilder("bar2"))
.example(Character.class, 'b')
.example(char.class, 'c')
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigTest.java
new file mode 100644
index 0000000..99d75ea
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigTest.java
@@ -0,0 +1,121 @@
+// ***************************************************************************************************************************
+// * 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.jsonschema.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.jsonschema.JsonSchemaGenerator.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.jsonschema.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @JsonSchemaConfig annotation.
+ */
+public class JsonSchemaConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ if (t instanceof Class)
+ return ((Class<?>)t).getSimpleName();
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @JsonSchemaConfig(
+ addDescriptionsTo="$BEAN",
+ addExamplesTo="$BEAN",
+ allowNestedDescriptions="$true",
+ allowNestedExamples="$true",
+ beanDefMapper=BasicBeanDefMapper.class,
+ defaultSchemas=@CSEntry(key=A.class,value="${foo:'bar'}"),
+ ignoreTypes="$foo",
+ useBeanDefs="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basic() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ JsonSchemaGenerator x = JsonSchemaGenerator.create().applyAnnotations(m, sr).build();
+ check("BEAN", x.getProperty(JSONSCHEMA_addDescriptionsTo));
+ check("BEAN", x.getProperty(JSONSCHEMA_addExamplesTo));
+ check("true", x.getProperty(JSONSCHEMA_allowNestedDescriptions));
+ check("true", x.getProperty(JSONSCHEMA_allowNestedExamples));
+ check("BasicBeanDefMapper", x.getProperty(JSONSCHEMA_beanDefMapper));
+ check("{org.apache.juneau.jsonschema.annotation.JsonSchemaConfigTest$A={foo:'bar'}}", x.getProperty(JSONSCHEMA_defaultSchemas));
+ check("foo", x.getProperty(JSONSCHEMA_ignoreTypes));
+ check("true", x.getProperty(JSONSCHEMA_useBeanDefs));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @JsonSchemaConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValues() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsonSchemaGenerator x = JsonSchemaGenerator.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(JSONSCHEMA_addDescriptionsTo));
+ check(null, x.getProperty(JSONSCHEMA_addExamplesTo));
+ check(null, x.getProperty(JSONSCHEMA_allowNestedDescriptions));
+ check(null, x.getProperty(JSONSCHEMA_allowNestedExamples));
+ check(null, x.getProperty(JSONSCHEMA_beanDefMapper));
+ check(null, x.getProperty(JSONSCHEMA_defaultSchemas));
+ check(null, x.getProperty(JSONSCHEMA_ignoreTypes));
+ check(null, x.getProperty(JSONSCHEMA_useBeanDefs));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotation() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsonSchemaGenerator x = JsonSchemaGenerator.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(JSONSCHEMA_addDescriptionsTo));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/msgpack/annotation/MsgPackConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/msgpack/annotation/MsgPackConfigTest.java
new file mode 100644
index 0000000..090d8e0
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/msgpack/annotation/MsgPackConfigTest.java
@@ -0,0 +1,118 @@
+// ***************************************************************************************************************************
+// * 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.msgpack.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.serializer.Serializer.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.msgpack.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @MsgPackConfig annotation.
+ */
+public class MsgPackConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @MsgPackConfig(
+ addBeanTypes="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ MsgPackSerializer x = MsgPackSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void basicParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ MsgPackParser x = MsgPackParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @MsgPackConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ MsgPackSerializer x = MsgPackSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ MsgPackParser x = MsgPackParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ MsgPackSerializer x = MsgPackSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ MsgPackParser x = MsgPackParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/oapi/annotation/OpenApiConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/oapi/annotation/OpenApiConfigTest.java
new file mode 100644
index 0000000..6e50d08
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/oapi/annotation/OpenApiConfigTest.java
@@ -0,0 +1,72 @@
+// ***************************************************************************************************************************
+// * 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.oapi.annotation;
+
+import org.apache.juneau.oapi.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @OpenApiConfig annotation.
+ */
+public class OpenApiConfigTest {
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @OpenApiConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ OpenApiSerializer.create().applyAnnotations(m, sr).build();
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ OpenApiParser.create().applyAnnotations(m, sr).build();
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ OpenApiSerializer.create().applyAnnotations(m, sr).build();
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ OpenApiParser.create().applyAnnotations(m, sr).build();
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/annotation/ParserConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/annotation/ParserConfigTest.java
new file mode 100644
index 0000000..5f33659
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/parser/annotation/ParserConfigTest.java
@@ -0,0 +1,166 @@
+// ***************************************************************************************************************************
+// * 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.parser.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.parser.Parser.*;
+import static org.apache.juneau.parser.InputStreamParser.*;
+import static org.apache.juneau.parser.ReaderParser.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.msgpack.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @ParserConfig annotation.
+ */
+public class ParserConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ if (t instanceof Class)
+ return ((Class<?>)t).getSimpleName();
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class AA extends ParserListener {}
+
+ @ParserConfig(
+ autoCloseStreams="$true",
+ binaryFormat="HEX",
+ debugOutputLines="$1",
+ fileCharset="$foo",
+ inputStreamCharset="$foo",
+ listener=AA.class,
+ strict="$true",
+ trimStrings="$true",
+ unbuffered="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicReaderParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ JsonParser x = JsonParser.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(PARSER_autoCloseStreams));
+ check(null, x.getProperty(ISPARSER_binaryFormat));
+ check("1", x.getProperty(PARSER_debugOutputLines));
+ check("foo", x.getProperty(RPARSER_fileCharset));
+ check("foo", x.getProperty(RPARSER_inputStreamCharset));
+ check("AA", x.getProperty(PARSER_listener));
+ check("true", x.getProperty(PARSER_strict));
+ check("true", x.getProperty(PARSER_trimStrings));
+ check("true", x.getProperty(PARSER_unbuffered));
+ }
+
+ @Test
+ public void basicInputStreamParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ MsgPackParser x = MsgPackParser.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(PARSER_autoCloseStreams));
+ check("HEX", x.getProperty(ISPARSER_binaryFormat));
+ check("1", x.getProperty(PARSER_debugOutputLines));
+ check(null, x.getProperty(RPARSER_fileCharset));
+ check(null, x.getProperty(RPARSER_inputStreamCharset));
+ check("AA", x.getProperty(PARSER_listener));
+ check("true", x.getProperty(PARSER_strict));
+ check("true", x.getProperty(PARSER_trimStrings));
+ check("true", x.getProperty(PARSER_unbuffered));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @ParserConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesReaderParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsonParser x = JsonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(PARSER_autoCloseStreams));
+ check(null, x.getProperty(ISPARSER_binaryFormat));
+ check(null, x.getProperty(PARSER_debugOutputLines));
+ check(null, x.getProperty(RPARSER_fileCharset));
+ check(null, x.getProperty(RPARSER_inputStreamCharset));
+ check(null, x.getProperty(PARSER_listener));
+ check(null, x.getProperty(PARSER_strict));
+ check(null, x.getProperty(PARSER_trimStrings));
+ check(null, x.getProperty(PARSER_unbuffered));
+ }
+
+ @Test
+ public void noValuesInputStreamParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ MsgPackParser x = MsgPackParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(PARSER_autoCloseStreams));
+ check(null, x.getProperty(ISPARSER_binaryFormat));
+ check(null, x.getProperty(PARSER_debugOutputLines));
+ check(null, x.getProperty(RPARSER_fileCharset));
+ check(null, x.getProperty(RPARSER_inputStreamCharset));
+ check(null, x.getProperty(PARSER_listener));
+ check(null, x.getProperty(PARSER_strict));
+ check(null, x.getProperty(PARSER_trimStrings));
+ check(null, x.getProperty(PARSER_unbuffered));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationReaderParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsonParser x = JsonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(PARSER_autoCloseStreams));
+ }
+
+ @Test
+ public void noAnnotationInputStreamParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ MsgPackParser x = MsgPackParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(PARSER_autoCloseStreams));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/plaintext/annotation/PlainTextConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/plaintext/annotation/PlainTextConfigTest.java
new file mode 100644
index 0000000..324b09c
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/plaintext/annotation/PlainTextConfigTest.java
@@ -0,0 +1,72 @@
+// ***************************************************************************************************************************
+// * 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.plaintext.annotation;
+
+import org.apache.juneau.plaintext.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @PlainTextConfig annotation.
+ */
+public class PlainTextConfigTest {
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @PlainTextConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ PlainTextSerializer.create().applyAnnotations(m, sr).build();
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ PlainTextParser.create().applyAnnotations(m, sr).build();
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ PlainTextSerializer.create().applyAnnotations(m, sr).build();
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ PlainTextParser.create().applyAnnotations(m, sr).build();
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
index 640b1c0..a3b8ab4 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
@@ -26,6 +26,7 @@ import java.util.function.*;
import java.util.stream.*;
import org.apache.juneau.*;
+import org.apache.juneau.internal.*;
import org.apache.juneau.reflect.*;
import org.apache.juneau.utils.*;
import org.junit.*;
@@ -48,6 +49,14 @@ public class ClassInfoTest {
int value();
}
+ @Documented
+ @Target(TYPE)
+ @Retention(RUNTIME)
+ @Inherited
+ static @interface AConfig {
+ int value();
+ }
+
private static void check(String expected, Object o) {
if (o instanceof List) {
List<?> l = (List<?>)o;
@@ -67,6 +76,7 @@ public class ClassInfoTest {
}
private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public String apply(Object t) {
if (t == null)
@@ -87,8 +97,14 @@ public class ClassInfoTest {
return "@A(" + ((A)t).value() + ")";
if (t instanceof PA)
return "@PA(" + ((PA)t).value() + ")";
+ if (t instanceof AConfig)
+ return "@AConfig(" + ((AConfig)t).value() + ")";
if (t instanceof AnnotationInfo)
return apply(((AnnotationInfo<?>)t).getAnnotation());
+ if (t instanceof AnnotationsMap) {
+ AnnotationsMap m = (AnnotationsMap)t;
+ return new ClassTreeSet((Set)m.keySet()).stream().map(x -> x.getSimpleName() + "=[" + (m.get(x).stream().map(y -> apply(y))).collect(Collectors.joining(",")) +"]").collect(Collectors.joining(","));
+ }
return t.toString();
}
};
@@ -790,23 +806,14 @@ public class ClassInfoTest {
// Annotations
//-----------------------------------------------------------------------------------------------------------------
- @A(1)
- static interface GI1 {}
- @A(2)
- static interface GI2 extends GI1 {}
- @A(3)
- static interface GI3 {}
- @A(4)
- static interface GI4 {}
- @A(5)
- static class G1 implements GI1, GI2 {}
- @A(6)
- static class G2 extends G1 implements GI3 {}
- @A(7)
- static class G3 extends G2 {}
-
+ @A(1) static interface GI1 {}
+ @A(2) static interface GI2 extends GI1 {}
+ @A(3) static interface GI3 {}
+ @A(4) static interface GI4 {}
+ @A(5) static class G1 implements GI1, GI2 {}
+ @A(6) static class G2 extends G1 implements GI3 {}
+ @A(7) static class G3 extends G2 {}
static class G4 extends G3 {}
-
static class G5 implements GI3 {}
static ClassInfo g3=of(G3.class), g4=of(G4.class), g5=of(G5.class);
@@ -918,6 +925,46 @@ public class ClassInfoTest {
check("@PA(10)", g3.getPackageAnnotationInfo(PA.class));
}
+ @Test
+ public void getAnnotationsMap() {
+ check("A=[@A(7),@A(6),@A(5),@A(3),@A(1),@A(2)],PA=[@PA(10)]", g3.getAnnotationsMap());
+ check("A=[@A(7),@A(6),@A(5),@A(3),@A(1),@A(2)],PA=[@PA(10)]", g4.getAnnotationsMap());
+ check("A=[@A(3)],PA=[@PA(10)]", g5.getAnnotationsMap());
+ }
+
+ @Test
+ public void getAnnotationsMapParentFirst() {
+ check("A=[@A(2),@A(1),@A(3),@A(5),@A(6),@A(7)],PA=[@PA(10)]", g3.getAnnotationsMapParentFirst());
+ check("A=[@A(2),@A(1),@A(3),@A(5),@A(6),@A(7)],PA=[@PA(10)]", g4.getAnnotationsMapParentFirst());
+ check("A=[@A(3)],PA=[@PA(10)]", g5.getAnnotationsMapParentFirst());
+ }
+
+ @A(1) @AConfig(1) static interface GBI1 {}
+ @A(2) @AConfig(2) static interface GBI2 extends GBI1 {}
+ @A(3) @AConfig(3) static interface GBI3 {}
+ @A(4) @AConfig(4) static interface GBI4 {}
+ @A(5) @AConfig(5) static class GB1 implements GBI1, GBI2 {}
+ @A(6) @AConfig(6) static class GB2 extends GB1 implements GBI3 {}
+ @A(7) @AConfig(7) static class GB3 extends GB2 {}
+ static class GB4 extends GB3 {}
+ static class GB5 implements GBI3 {}
+
+ static ClassInfo gb3=of(GB3.class), gb4=of(GB4.class), gb5=of(GB5.class);
+
+ @Test
+ public void getConfigAnnotationsMap() {
+ check("AConfig=[@AConfig(7),@AConfig(6),@AConfig(5),@AConfig(3),@AConfig(1),@AConfig(2)]", gb3.getConfigAnnotationsMap());
+ check("AConfig=[@AConfig(7),@AConfig(6),@AConfig(5),@AConfig(3),@AConfig(1),@AConfig(2)]", gb4.getConfigAnnotationsMap());
+ check("AConfig=[@AConfig(3)]", gb5.getConfigAnnotationsMap());
+ }
+
+ @Test
+ public void getConfigAnnotationsMapParentFirst() {
+ check("AConfig=[@AConfig(2),@AConfig(1),@AConfig(3),@AConfig(5),@AConfig(6),@AConfig(7)]", gb3.getConfigAnnotationsMapParentFirst());
+ check("AConfig=[@AConfig(2),@AConfig(1),@AConfig(3),@AConfig(5),@AConfig(6),@AConfig(7)]", gb4.getConfigAnnotationsMapParentFirst());
+ check("AConfig=[@AConfig(3)]", gb5.getConfigAnnotationsMapParentFirst());
+ }
+
//-----------------------------------------------------------------------------------------------------------------
// Characteristics
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
index 88ebecf..a67e2cb 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
@@ -23,13 +23,14 @@ import java.util.*;
import java.util.function.*;
import java.util.stream.*;
+import org.apache.juneau.internal.*;
import org.apache.juneau.reflect.*;
import org.junit.*;
public class MethodInfoTest {
@Documented
- @Target(METHOD)
+ @Target({METHOD,TYPE})
@Retention(RUNTIME)
@Inherited
public static @interface A {
@@ -37,18 +38,27 @@ public class MethodInfoTest {
}
@Documented
- @Target(METHOD)
+ @Target({METHOD,TYPE})
@Retention(RUNTIME)
@Inherited
public static @interface AX {
String value();
}
+ @Documented
+ @Target({METHOD,TYPE})
+ @Retention(RUNTIME)
+ @Inherited
+ public static @interface AConfig {
+ String value();
+ }
+
private static void check(String expected, Object o) {
assertEquals(expected, TO_STRING.apply(o));
}
private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public String apply(Object t) {
if (t == null)
@@ -61,6 +71,14 @@ public class MethodInfoTest {
return ((List<?>)t).stream().map(this).collect(Collectors.joining(","));
if (t instanceof A)
return "@A(" + ((A)t).value() + ")";
+ if (t instanceof PA)
+ return "@PA(" + ((PA)t).value() + ")";
+ if (t instanceof AConfig)
+ return "@AConfig(" + ((AConfig)t).value() + ")";
+ if (t instanceof AnnotationsMap) {
+ AnnotationsMap m = (AnnotationsMap)t;
+ return new ClassTreeSet((Set)m.keySet()).stream().map(x -> x.getSimpleName() + "=[" + (m.get(x).stream().map(y -> apply(y))).collect(Collectors.joining(",")) +"]").collect(Collectors.joining(","));
+ }
if (t instanceof ClassInfo)
return ((ClassInfo)t).getSimpleName();
return t.toString();
@@ -137,6 +155,7 @@ public class MethodInfoTest {
// Annotations
//-----------------------------------------------------------------------------------------------------------------
+ @A("C1")
public static interface C1 {
@A("a1") void a1();
@A("a2a") void a2();
@@ -145,6 +164,7 @@ public class MethodInfoTest {
void a5();
}
+ @A("C2")
public static class C2 implements C1 {
@Override public void a1() {}
@Override @A("a2b") public void a2() {}
@@ -153,6 +173,7 @@ public class MethodInfoTest {
@Override public void a5() {}
}
+ @A("C3")
public static class C3 extends C2 {
@Override public void a1() {}
@Override public void a2() {}
@@ -170,11 +191,11 @@ public class MethodInfoTest {
@Test
public void getAnnotations() {
- check("@A(a1)", c_a1.getAnnotations(A.class));
- check("@A(a2b),@A(a2a)", c_a2.getAnnotations(A.class));
- check("@A(a3)", c_a3.getAnnotations(A.class));
- check("@A(a4)", c_a4.getAnnotations(A.class));
- check("", c_a5.getAnnotations(A.class));
+ check("@A(a1),@A(C3),@A(C2),@A(C1)", c_a1.getAnnotations(A.class));
+ check("@A(a2b),@A(a2a),@A(C3),@A(C2),@A(C1)", c_a2.getAnnotations(A.class));
+ check("@A(a3),@A(C3),@A(C2),@A(C1)", c_a3.getAnnotations(A.class));
+ check("@A(a4),@A(C3),@A(C2),@A(C1)", c_a4.getAnnotations(A.class));
+ check("@A(C3),@A(C2),@A(C1)", c_a5.getAnnotations(A.class));
}
@Test
@@ -188,29 +209,29 @@ public class MethodInfoTest {
@Test
public void getAnnotationsParentFirst() {
- check("@A(a1)", c_a1.getAnnotationsParentFirst(A.class));
- check("@A(a2a),@A(a2b)", c_a2.getAnnotationsParentFirst(A.class));
- check("@A(a3)", c_a3.getAnnotationsParentFirst(A.class));
- check("@A(a4)", c_a4.getAnnotationsParentFirst(A.class));
- check("", c_a5.getAnnotationsParentFirst(A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a1)", c_a1.getAnnotationsParentFirst(A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a2a),@A(a2b)", c_a2.getAnnotationsParentFirst(A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a3)", c_a3.getAnnotationsParentFirst(A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a4)", c_a4.getAnnotationsParentFirst(A.class));
+ check("@A(C1),@A(C2),@A(C3)", c_a5.getAnnotationsParentFirst(A.class));
}
@Test
public void appendAnnotations() {
- check("@A(a1)", c_a1.appendAnnotations(new ArrayList<>(), A.class));
- check("@A(a2b),@A(a2a)", c_a2.appendAnnotations(new ArrayList<>(), A.class));
- check("@A(a3)", c_a3.appendAnnotations(new ArrayList<>(), A.class));
- check("@A(a4)", c_a4.appendAnnotations(new ArrayList<>(), A.class));
- check("", c_a5.appendAnnotations(new ArrayList<>(), A.class));
+ check("@A(a1),@A(C3),@A(C2),@A(C1)", c_a1.appendAnnotations(new ArrayList<>(), A.class));
+ check("@A(a2b),@A(a2a),@A(C3),@A(C2),@A(C1)", c_a2.appendAnnotations(new ArrayList<>(), A.class));
+ check("@A(a3),@A(C3),@A(C2),@A(C1)", c_a3.appendAnnotations(new ArrayList<>(), A.class));
+ check("@A(a4),@A(C3),@A(C2),@A(C1)", c_a4.appendAnnotations(new ArrayList<>(), A.class));
+ check("@A(C3),@A(C2),@A(C1)", c_a5.appendAnnotations(new ArrayList<>(), A.class));
}
@Test
public void appendAnnotationsParentFirst() {
- check("@A(a1)", c_a1.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
- check("@A(a2a),@A(a2b)", c_a2.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
- check("@A(a3)", c_a3.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
- check("@A(a4)", c_a4.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
- check("", c_a5.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a1)", c_a1.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a2a),@A(a2b)", c_a2.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a3)", c_a3.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
+ check("@A(C1),@A(C2),@A(C3),@A(a4)", c_a4.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
+ check("@A(C1),@A(C2),@A(C3)", c_a5.appendAnnotationsParentFirst(new ArrayList<>(), A.class));
}
@Test
@@ -231,6 +252,76 @@ public class MethodInfoTest {
check(null, c_a5.getAnnotation(AX.class, A.class));
}
+ @Test
+ public void getAnnotationsMap() {
+ check("A=[@A(a1),@A(C3),@A(C2),@A(C1)],PA=[@PA(10)]", c_a1.getAnnotationsMap());
+ check("A=[@A(a2b),@A(a2a),@A(C3),@A(C2),@A(C1)],PA=[@PA(10)]", c_a2.getAnnotationsMap());
+ check("A=[@A(a3),@A(C3),@A(C2),@A(C1)],PA=[@PA(10)]", c_a3.getAnnotationsMap());
+ check("A=[@A(a4),@A(C3),@A(C2),@A(C1)],PA=[@PA(10)]", c_a4.getAnnotationsMap());
+ check("A=[@A(C3),@A(C2),@A(C1)],PA=[@PA(10)]", c_a5.getAnnotationsMap());
+ }
+
+ @Test
+ public void getAnnotationsMapParentFirst() {
+ check("A=[@A(C1),@A(C2),@A(C3),@A(a1)],PA=[@PA(10)]", c_a1.getAnnotationsMapParentFirst());
+ check("A=[@A(C1),@A(C2),@A(C3),@A(a2a),@A(a2b)],PA=[@PA(10)]", c_a2.getAnnotationsMapParentFirst());
+ check("A=[@A(C1),@A(C2),@A(C3),@A(a3)],PA=[@PA(10)]", c_a3.getAnnotationsMapParentFirst());
+ check("A=[@A(C1),@A(C2),@A(C3),@A(a4)],PA=[@PA(10)]", c_a4.getAnnotationsMapParentFirst());
+ check("A=[@A(C1),@A(C2),@A(C3)],PA=[@PA(10)]", c_a5.getAnnotationsMapParentFirst());
+ }
+
+ @A("C1") @AConfig("C1")
+ public static interface CB1 {
+ @A("a1") @AConfig("a1") void a1();
+ @A("a2a") @AConfig("a2a") void a2();
+ @A("a3") @AConfig("a3") void a3(CharSequence foo);
+ void a4();
+ void a5();
+ }
+
+ @A("C2") @AConfig("C2")
+ public static class CB2 implements CB1 {
+ @Override public void a1() {}
+ @Override @A("a2b") @AConfig("a2b") public void a2() {}
+ @Override public void a3(CharSequence s) {}
+ @Override public void a4() {}
+ @Override public void a5() {}
+ }
+
+ @A("C3") @AConfig("C3")
+ public static class CB3 extends CB2 {
+ @Override public void a1() {}
+ @Override public void a2() {}
+ @Override public void a3(CharSequence foo) {}
+ @Override @A("a4") @AConfig("a4") public void a4() {}
+ @Override public void a5() {}
+ }
+
+ static MethodInfo
+ cb_a1 = ofm(CB3.class, "a1"),
+ cb_a2 = ofm(CB3.class, "a2"),
+ cb_a3 = ofm(CB3.class, "a3", CharSequence.class),
+ cb_a4 = ofm(CB3.class, "a4"),
+ cb_a5 = ofm(CB3.class, "a5");
+
+ @Test
+ public void getConfigAnnotationsMap() {
+ check("AConfig=[@AConfig(a1),@AConfig(C3),@AConfig(C2),@AConfig(C1)]", cb_a1.getConfigAnnotationsMap());
+ check("AConfig=[@AConfig(a2b),@AConfig(a2a),@AConfig(C3),@AConfig(C2),@AConfig(C1)]", cb_a2.getConfigAnnotationsMap());
+ check("AConfig=[@AConfig(a3),@AConfig(C3),@AConfig(C2),@AConfig(C1)]", cb_a3.getConfigAnnotationsMap());
+ check("AConfig=[@AConfig(a4),@AConfig(C3),@AConfig(C2),@AConfig(C1)]", cb_a4.getConfigAnnotationsMap());
+ check("AConfig=[@AConfig(C3),@AConfig(C2),@AConfig(C1)]", cb_a5.getConfigAnnotationsMap());
+ }
+
+ @Test
+ public void getConfigAnnotationsMapParentFirst() {
+ check("AConfig=[@AConfig(C1),@AConfig(C2),@AConfig(C3),@AConfig(a1)]", cb_a1.getConfigAnnotationsMapParentFirst());
+ check("AConfig=[@AConfig(C1),@AConfig(C2),@AConfig(C3),@AConfig(a2a),@AConfig(a2b)]", cb_a2.getConfigAnnotationsMapParentFirst());
+ check("AConfig=[@AConfig(C1),@AConfig(C2),@AConfig(C3),@AConfig(a3)]", cb_a3.getConfigAnnotationsMapParentFirst());
+ check("AConfig=[@AConfig(C1),@AConfig(C2),@AConfig(C3),@AConfig(a4)]", cb_a4.getConfigAnnotationsMapParentFirst());
+ check("AConfig=[@AConfig(C1),@AConfig(C2),@AConfig(C3)]", cb_a5.getConfigAnnotationsMapParentFirst());
+ }
+
//-----------------------------------------------------------------------------------------------------------------
// Return type.
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/annotation/SerializerConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/annotation/SerializerConfigTest.java
new file mode 100644
index 0000000..3fe34a5
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/serializer/annotation/SerializerConfigTest.java
@@ -0,0 +1,201 @@
+// ***************************************************************************************************************************
+// * 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.serializer.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.serializer.Serializer.*;
+import static org.apache.juneau.serializer.WriterSerializer.*;
+import static org.apache.juneau.serializer.OutputStreamSerializer.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.msgpack.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @SerializerConfig annotation.
+ */
+public class SerializerConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ if (t instanceof Class)
+ return ((Class<?>)t).getSimpleName();
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class AA extends SerializerListener {}
+
+ @SerializerConfig(
+ addBeanTypes="$true",
+ addRootType="$true",
+ binaryFormat="$HEX",
+ listener=AA.class,
+ maxIndent="$1",
+ quoteChar="$'",
+ sortCollections="$true",
+ sortMaps="$true",
+ trimEmptyCollections="$true",
+ trimEmptyMaps="$true",
+ trimNullProperties="$true",
+ trimStrings="$true",
+ uriContext="${}",
+ uriRelativity="$RESOURCE",
+ uriResolution="$ABSOLUTE",
+ useWhitespace="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicWriterSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ JsonSerializer x = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ check("true", x.getProperty(SERIALIZER_addRootType));
+ check(null, x.getProperty(OSSERIALIZER_binaryFormat));
+ check("AA", x.getProperty(SERIALIZER_listener));
+ check("1", x.getProperty(WSERIALIZER_maxIndent));
+ check("'", x.getProperty(WSERIALIZER_quoteChar));
+ check("true", x.getProperty(SERIALIZER_sortCollections));
+ check("true", x.getProperty(SERIALIZER_sortMaps));
+ check("true", x.getProperty(SERIALIZER_trimEmptyCollections));
+ check("true", x.getProperty(SERIALIZER_trimEmptyMaps));
+ check("true", x.getProperty(SERIALIZER_trimNullProperties));
+ check("true", x.getProperty(SERIALIZER_trimStrings));
+ check("{}", x.getProperty(SERIALIZER_uriContext));
+ check("RESOURCE", x.getProperty(SERIALIZER_uriRelativity));
+ check("ABSOLUTE", x.getProperty(SERIALIZER_uriResolution));
+ check("true", x.getProperty(SERIALIZER_useWhitespace));
+ }
+
+ @Test
+ public void basicOutputStreamSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ MsgPackSerializer x = MsgPackSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ check("true", x.getProperty(SERIALIZER_addRootType));
+ check("HEX", x.getProperty(OSSERIALIZER_binaryFormat));
+ check("AA", x.getProperty(SERIALIZER_listener));
+ check(null, x.getProperty(WSERIALIZER_maxIndent));
+ check(null, x.getProperty(WSERIALIZER_quoteChar));
+ check("true", x.getProperty(SERIALIZER_sortCollections));
+ check("true", x.getProperty(SERIALIZER_sortMaps));
+ check("true", x.getProperty(SERIALIZER_trimEmptyCollections));
+ check("true", x.getProperty(SERIALIZER_trimEmptyMaps));
+ check("true", x.getProperty(SERIALIZER_trimNullProperties));
+ check("true", x.getProperty(SERIALIZER_trimStrings));
+ check("{}", x.getProperty(SERIALIZER_uriContext));
+ check("RESOURCE", x.getProperty(SERIALIZER_uriRelativity));
+ check("ABSOLUTE", x.getProperty(SERIALIZER_uriResolution));
+ check("true", x.getProperty(SERIALIZER_useWhitespace));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @SerializerConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesWriterSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ JsonSerializer x = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(SERIALIZER_addRootType));
+ check(null, x.getProperty(OSSERIALIZER_binaryFormat));
+ check(null, x.getProperty(SERIALIZER_listener));
+ check(null, x.getProperty(WSERIALIZER_maxIndent));
+ check(null, x.getProperty(WSERIALIZER_quoteChar));
+ check(null, x.getProperty(SERIALIZER_sortCollections));
+ check(null, x.getProperty(SERIALIZER_sortMaps));
+ check(null, x.getProperty(SERIALIZER_trimEmptyCollections));
+ check(null, x.getProperty(SERIALIZER_trimEmptyMaps));
+ check(null, x.getProperty(SERIALIZER_trimNullProperties));
+ check(null, x.getProperty(SERIALIZER_trimStrings));
+ check(null, x.getProperty(SERIALIZER_uriContext));
+ check(null, x.getProperty(SERIALIZER_uriRelativity));
+ check(null, x.getProperty(SERIALIZER_uriResolution));
+ check(null, x.getProperty(SERIALIZER_useWhitespace));
+ }
+
+ @Test
+ public void noValuesOutputStreamSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ MsgPackSerializer x = MsgPackSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(SERIALIZER_addRootType));
+ check(null, x.getProperty(OSSERIALIZER_binaryFormat));
+ check(null, x.getProperty(SERIALIZER_listener));
+ check(null, x.getProperty(WSERIALIZER_maxIndent));
+ check(null, x.getProperty(WSERIALIZER_quoteChar));
+ check(null, x.getProperty(SERIALIZER_sortCollections));
+ check(null, x.getProperty(SERIALIZER_sortMaps));
+ check(null, x.getProperty(SERIALIZER_trimEmptyCollections));
+ check(null, x.getProperty(SERIALIZER_trimEmptyMaps));
+ check(null, x.getProperty(SERIALIZER_trimNullProperties));
+ check(null, x.getProperty(SERIALIZER_trimStrings));
+ check(null, x.getProperty(SERIALIZER_uriContext));
+ check(null, x.getProperty(SERIALIZER_uriRelativity));
+ check(null, x.getProperty(SERIALIZER_uriResolution));
+ check(null, x.getProperty(SERIALIZER_useWhitespace));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationWriterSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ JsonSerializer x = JsonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noAnnotationOutputStreamSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ MsgPackSerializer x = MsgPackSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/soap/annotation/SoapXmlConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/soap/annotation/SoapXmlConfigTest.java
new file mode 100644
index 0000000..65ebf0a
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/soap/annotation/SoapXmlConfigTest.java
@@ -0,0 +1,97 @@
+// ***************************************************************************************************************************
+// * 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.soap.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.soap.SoapXmlSerializer.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.soap.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @SoapXmlConfig annotation.
+ */
+public class SoapXmlConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @SoapXmlConfig(
+ soapAction="$foo"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basic() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ SoapXmlSerializer x = SoapXmlSerializer.create().applyAnnotations(m, sr).build();
+ check("foo", x.getProperty(SOAPXML_SOAPAction));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @SoapXmlConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValues() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ SoapXmlSerializer x = SoapXmlSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SOAPXML_SOAPAction));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotation() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ SoapXmlSerializer x = SoapXmlSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SOAPXML_SOAPAction));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/uon/annotation/UonConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/uon/annotation/UonConfigTest.java
new file mode 100644
index 0000000..fa240bc
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/uon/annotation/UonConfigTest.java
@@ -0,0 +1,132 @@
+// ***************************************************************************************************************************
+// * 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.uon.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.serializer.Serializer.*;
+import static org.apache.juneau.uon.UonSerializer.*;
+import static org.apache.juneau.uon.UonParser.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.uon.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @UonConfig annotation.
+ */
+public class UonConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @UonConfig(
+ addBeanTypes="$true",
+ decoding="$true",
+ encoding="$true",
+ paramFormat="$UON",
+ validateEnd="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ UonSerializer x = UonSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(UON_decoding));
+ check("true", x.getProperty(UON_encoding));
+ check("UON", x.getProperty(UON_paramFormat));
+ check(null, x.getProperty(UON_validateEnd));
+ }
+
+ @Test
+ public void basicParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ UonParser x = UonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check("true", x.getProperty(UON_decoding));
+ check(null, x.getProperty(UON_encoding));
+ check(null, x.getProperty(UON_paramFormat));
+ check("true", x.getProperty(UON_validateEnd));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @UonConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ UonSerializer x = UonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ UonParser x = UonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ UonSerializer x = UonSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ UonParser x = UonParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigTest.java
new file mode 100644
index 0000000..352bafa
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigTest.java
@@ -0,0 +1,117 @@
+// ***************************************************************************************************************************
+// * 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.urlencoding.annotation;
+
+import static org.junit.Assert.*;
+
+import java.util.function.*;
+
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.urlencoding.*;
+import org.apache.juneau.utils.*;
+import org.junit.*;
+
+/**
+ * Tests the @UrlEncodingConfig annotation.
+ */
+public class UrlEncodingConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @UrlEncodingConfig(
+ expandedParams="$true"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ UrlEncodingSerializer x = UrlEncodingSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(UrlEncodingSerializer.URLENC_expandedParams));
+ }
+
+ @Test
+ public void basicParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ UrlEncodingParser x = UrlEncodingParser.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(UrlEncodingParser.URLENC_expandedParams));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @UrlEncodingConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ UrlEncodingSerializer x = UrlEncodingSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(UrlEncodingSerializer.URLENC_expandedParams));
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ UrlEncodingParser x = UrlEncodingParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(UrlEncodingParser.URLENC_expandedParams));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ UrlEncodingSerializer x = UrlEncodingSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(UrlEncodingSerializer.URLENC_expandedParams));
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ UrlEncodingParser x = UrlEncodingParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(UrlEncodingParser.URLENC_expandedParams));
+ }
+}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/annotation/XmlConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/annotation/XmlConfigTest.java
new file mode 100644
index 0000000..748ded7
--- /dev/null
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/xml/annotation/XmlConfigTest.java
@@ -0,0 +1,184 @@
+// ***************************************************************************************************************************
+// * 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.xml.annotation;
+
+import static org.junit.Assert.*;
+import static org.apache.juneau.serializer.Serializer.*;
+import static org.apache.juneau.xml.XmlSerializer.*;
+import static org.apache.juneau.xml.XmlParser.*;
+
+import java.util.function.*;
+
+import javax.xml.stream.*;
+import javax.xml.stream.events.*;
+import javax.xml.stream.util.*;
+
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
+import org.apache.juneau.xml.*;
+import org.junit.*;
+
+/**
+ * Tests the @XmlConfig annotation.
+ */
+public class XmlConfigTest {
+
+ private static void check(String expected, Object o) {
+ assertEquals(expected, TO_STRING.apply(o));
+ }
+
+ private static final Function<Object,String> TO_STRING = new Function<Object,String>() {
+ @Override
+ public String apply(Object t) {
+ if (t == null)
+ return null;
+ if (t instanceof Class)
+ return ((Class<?>)t).getSimpleName();
+ return t.toString();
+ }
+ };
+
+ static StringResolver sr = new StringResolver() {
+ @Override
+ public String resolve(String input) {
+ if (input.startsWith("$"))
+ input = input.substring(1);
+ return input;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Basic tests
+ //-----------------------------------------------------------------------------------------------------------------
+
+ public static class AA extends XmlEventAllocator {
+ @Override
+ public XMLEventAllocator newInstance() {
+ return null;
+ }
+ @Override
+ public XMLEvent allocate(XMLStreamReader reader) throws XMLStreamException {
+ return null;
+ }
+ @Override
+ public void allocate(XMLStreamReader reader, XMLEventConsumer consumer) throws XMLStreamException {
+ }
+ }
+ public static class AB extends XmlReporter {
+ @Override
+ public void report(String message, String errorType, Object relatedInformation, Location location) throws XMLStreamException {
+ }
+ }
+ public static class AC extends XmlResolver {
+ @Override
+ public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException {
+ return null;
+ }
+ }
+
+ @XmlConfig(
+ addBeanTypes="$true",
+ addNamespaceUrisToRoot="$true",
+ autoDetectNamespaces="$true",
+ defaultNamespace="$foo",
+ enableNamespaces="$true",
+ eventAllocator=AA.class,
+ namespaces="$foo",
+ preserveRootElement="$true",
+ reporter=AB.class,
+ resolver=AC.class,
+ validating="$true",
+ xsNamespace="$foo"
+ )
+ static class A {}
+ static ClassInfo a = ClassInfo.of(A.class);
+
+ @Test
+ public void basicSerializer() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ XmlSerializer x = XmlSerializer.create().applyAnnotations(m, sr).build();
+ check("true", x.getProperty(SERIALIZER_addBeanTypes));
+ check("true", x.getProperty(XML_addNamespaceUrisToRoot));
+ check("true", x.getProperty(XML_autoDetectNamespaces));
+ check("foo", x.getProperty(XML_defaultNamespace));
+ check("true", x.getProperty(XML_enableNamespaces));
+ check(null, x.getProperty(XML_eventAllocator));
+ check("[foo:null]", x.getProperty(XML_namespaces));
+ check(null, x.getProperty(XML_preserveRootElement));
+ check(null, x.getProperty(XML_reporter));
+ check(null, x.getProperty(XML_resolver));
+ check(null, x.getProperty(XML_validating));
+ check("foo:null", x.getProperty(XML_xsNamespace));
+ }
+
+ @Test
+ public void basicParser() throws Exception {
+ AnnotationsMap m = a.getAnnotationsMap();
+ XmlParser x = XmlParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ check(null, x.getProperty(XML_addNamespaceUrisToRoot));
+ check(null, x.getProperty(XML_autoDetectNamespaces));
+ check(null, x.getProperty(XML_defaultNamespace));
+ check(null, x.getProperty(XML_enableNamespaces));
+ check("AA", x.getProperty(XML_eventAllocator));
+ check(null, x.getProperty(XML_namespaces));
+ check("true", x.getProperty(XML_preserveRootElement));
+ check("AB", x.getProperty(XML_reporter));
+ check("AC", x.getProperty(XML_resolver));
+ check("true", x.getProperty(XML_validating));
+ check(null, x.getProperty(XML_xsNamespace));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotation with no values.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @XmlConfig()
+ static class B {}
+ static ClassInfo b = ClassInfo.of(B.class);
+
+ @Test
+ public void noValuesSerializer() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ XmlSerializer x = XmlSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noValuesParser() throws Exception {
+ AnnotationsMap m = b.getAnnotationsMap();
+ XmlParser x = XmlParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // No annotation.
+ //-----------------------------------------------------------------------------------------------------------------
+
+ static class C {}
+ static ClassInfo c = ClassInfo.of(C.class);
+
+ @Test
+ public void noAnnotationSerializer() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ XmlSerializer x = XmlSerializer.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+
+ @Test
+ public void noAnnotationParser() throws Exception {
+ AnnotationsMap m = c.getAnnotationsMap();
+ XmlParser x = XmlParser.create().applyAnnotations(m, sr).build();
+ check(null, x.getProperty(SERIALIZER_addBeanTypes));
+ }
+}
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 2284c84..f16c14b 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
@@ -19,8 +19,11 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.internal.*;
import org.apache.juneau.jena.annotation.*;
import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
import org.apache.juneau.xml.annotation.*;
@@ -50,12 +53,514 @@ public class RdfParserBuilder extends ReaderParserBuilder {
return build(RdfParser.class);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public RdfParserBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ if (! m.containsKey(RdfConfig.class))
+ return this;
+ ObjectResolver r = new ObjectResolver(sr);
+ for (RdfConfig a : m.get(RdfConfig.class)) {
+ if (! a.language().isEmpty())
+ language(r.string(a.language()));
+ if (! a.juneauNs().isEmpty())
+ juneauNs(r.string(a.juneauNs()));
+ if (! a.juneauBpNs().isEmpty())
+ juneauBpNs(r.string(a.juneauBpNs()));
+ if (! a.useXmlNamespaces().isEmpty())
+ useXmlNamespaces(r.bool(a.useXmlNamespaces()));
+ if (! a.arp_iriRules().isEmpty())
+ arp_iriRules(r.string(a.arp_iriRules()));
+ if (! a.arp_errorMode().isEmpty())
+ arp_errorMode(r.string(a.arp_errorMode()));
+ if (! a.arp_embedding().isEmpty())
+ arp_embedding(r.bool(a.arp_embedding()));
+ if (! a.rdfxml_xmlBase().isEmpty())
+ rdfxml_xmlBase(r.string(a.rdfxml_xmlBase()));
+ if (! a.rdfxml_longId().isEmpty())
+ rdfxml_longId(r.bool(a.rdfxml_longId()));
+ if (! a.rdfxml_allowBadUris().isEmpty())
+ rdfxml_allowBadUris(r.bool(a.rdfxml_allowBadUris()));
+ if (! a.rdfxml_relativeUris().isEmpty())
+ rdfxml_relativeUris(r.string(a.rdfxml_relativeUris()));
+ if (! a.rdfxml_showXmlDeclaration().isEmpty())
+ rdfxml_showXmlDeclaration(r.string(a.rdfxml_showXmlDeclaration()));
+ if (! a.rdfxml_showDoctypeDeclaration().isEmpty())
+ rdfxml_showDoctypeDeclaration(r.bool(a.rdfxml_showDoctypeDeclaration()));
+ if (! a.rdfxml_tab().isEmpty())
+ rdfxml_tab(r.integer(a.rdfxml_tab()));
+ if (! a.rdfxml_attributeQuoteChar().isEmpty())
+ rdfxml_attributeQuoteChar(r.string(a.rdfxml_attributeQuoteChar()));
+ if (! a.rdfxml_blockRules().isEmpty())
+ rdfxml_blockRules(r.string(a.rdfxml_blockRules()));
+ if (! a.n3_minGap().isEmpty())
+ n3_minGap(r.integer(a.n3_minGap()));
+ if (! a.n3_objectLists().isEmpty())
+ n3_objectLists(r.bool(a.n3_objectLists()));
+ if (! a.n3_subjectColumn().isEmpty())
+ n3_subjectColumn(r.integer(a.n3_subjectColumn()));
+ if (! a.n3_propertyColumn().isEmpty())
+ n3_propertyColumn(r.integer(a.n3_propertyColumn()));
+ if (! a.n3_indentProperty().isEmpty())
+ n3_indentProperty(r.integer(a.n3_indentProperty()));
+ if (! a.n3_widePropertyLen().isEmpty())
+ n3_widePropertyLen(r.integer(a.n3_widePropertyLen()));
+ if (! a.n3_abbrevBaseUri().isEmpty())
+ n3_abbrevBaseUri(r.bool(a.n3_abbrevBaseUri()));
+ if (! a.n3_usePropertySymbols().isEmpty())
+ n3_usePropertySymbols(r.bool(a.n3_usePropertySymbols()));
+ if (! a.n3_useTripleQuotedStrings().isEmpty())
+ n3_useTripleQuotedStrings(r.bool(a.n3_useTripleQuotedStrings()));
+ if (! a.n3_useDoubles().isEmpty())
+ n3_useDoubles(r.bool(a.n3_useDoubles()));
+ if (! a.collectionFormat().isEmpty())
+ collectionFormat(r.string(a.collectionFormat()));
+ if (! a.looseCollections().isEmpty())
+ looseCollections(r.bool(a.looseCollections()));
+ if (! a.trimWhitespace().isEmpty())
+ trimWhitespace(r.bool(a.trimWhitespace()));
+ }
+ return this;
+ }
//-----------------------------------------------------------------------------------------------------------------
// Properties
//-----------------------------------------------------------------------------------------------------------------
/**
+ * Configuration property: XML namespace for Juneau properties.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder juneauNs(String value) {
+ return set(RDF_juneauNs, value);
+ }
+
+ /**
+ * Configuration property: Default XML namespace for bean properties.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder juneauBpNs(String value) {
+ return set(RDF_juneauBpNs, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>iri_rules</code>.
+ *
+ * <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
+ * ({@doc http://www.ietf.org/rfc/rfc3986.txt RFC 3986},
+ * {@doc http://www.ietf.org/rfc/rfc3987.txt RFC 3987}).
+ *
+ * </ul>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder arp_iriRules(String value) {
+ return set(RDF_arp_iriRules, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML ARP property: <code>error-mode</code>.
+ *
+ * <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>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder arp_errorMode(String value) {
+ return set(RDF_arp_errorMode, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML ARP property: <code>error-mode</code>.
+ *
+ * <p>
+ * Sets ARP to look for RDF embedded within an enclosing XML document.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder arp_embedding(boolean value) {
+ return set(RDF_arp_embedding, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>xmlbase</code>.
+ *
+ * <p>
+ * The value to be included for an <xa>xml:base</xa> attribute on the root element in the file.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_xmlBase(String value) {
+ return set(RDF_rdfxml_xmlBase, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>longId</code>.
+ *
+ * <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.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_longId(boolean value) {
+ return set(RDF_rdfxml_longId, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>allowBadURIs</code>.
+ *
+ * <p>
+ * URIs in the graph are, by default, checked prior to serialization.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_allowBadUris(boolean value) {
+ return set(RDF_rdfxml_allowBadUris, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>relativeURIs</code>.
+ *
+ * <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.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_relativeUris(String value) {
+ return set(RDF_rdfxml_relativeUris, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>showXmlDeclaration</code>.
+ *
+ * <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>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_showXmlDeclaration(String value) {
+ return set(RDF_rdfxml_showXmlDeclaration, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>showDoctypeDeclaration</code>.
+ *
+ * <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.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_showDoctypeDeclaration(boolean value) {
+ return set(RDF_rdfxml_showDoctypeDeclaration, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>tab</code>.
+ *
+ * <p>
+ * The number of spaces with which to indent XML child elements.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_tab(int value) {
+ return set(RDF_rdfxml_tab, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>attributeQuoteChar</code>.
+ *
+ * <p>
+ * The XML attribute quote character.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_attributeQuoteChar(String value) {
+ return set(RDF_rdfxml_attributeQuoteChar, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>blockRules</code>.
+ *
+ * <p>
+ * A list of <code>Resource</code> or a <code>String</code> being a comma separated list of fragment IDs from
+ * {@doc http://www.w3.org/TR/rdf-syntax-grammar RDF Syntax Grammar} indicating grammar
+ * rules that will not be used.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder rdfxml_blockRules(String value) {
+ return set(RDF_rdfxml_blockRules, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>minGap</code>.
+ *
+ * <p>
+ * Minimum gap between items on a line.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_minGap(int value) {
+ return set(RDF_n3_minGap, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>objectLists</code>.
+ *
+ * <p>
+ * Print object lists as comma separated lists.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_objectLists(boolean value) {
+ return set(RDF_n3_objectLists, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>subjectColumn</code>.
+ *
+ * <p>
+ * If the subject is shorter than this value, the first property may go on the same line.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_subjectColumn(int value) {
+ return set(RDF_n3_subjectColumn, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>propertyColumn</code>.
+ *
+ * <p>
+ * Width of the property column.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_propertyColumn(int value) {
+ return set(RDF_n3_propertyColumn, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>indentProperty</code>.
+ *
+ * <p>
+ * Width to indent properties.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_indentProperty(int value) {
+ return set(RDF_n3_indentProperty, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>widePropertyLen</code>.
+ *
+ * <p>
+ * Width of the property column.
+ * Must be longer than <code>propertyColumn</code>.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_widePropertyLen(int value) {
+ return set(RDF_n3_widePropertyLen, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>abbrevBaseURI</code>.
+ *
+ * <p>
+ * Control whether to use abbreviations <code><></code> or <code><#></code>.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_abbrevBaseUri(boolean value) {
+ return set(RDF_n3_abbrevBaseUri, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>usePropertySymbols</code>.
+ *
+ * <p>
+ * Control whether to use <code>a</code>, <code>=</code> and <code>=></code> in output
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_usePropertySymbols(boolean value) {
+ return set(RDF_n3_usePropertySymbols, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>useTripleQuotedStrings</code>.
+ *
+ * <p>
+ * Allow the use of <code>"""</code> to delimit long strings.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_useTripleQuotedStrings(boolean value) {
+ return set(RDF_n3_useTripleQuotedStrings, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>useDoubles</code>.
+ *
+ * <p>
+ * Allow the use doubles as <code>123.456</code>.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder n3_useDoubles(boolean value) {
+ return set(RDF_n3_useDoubles, value);
+ }
+
+ /**
+ * Configuration property: RDF format for representing collections and arrays.
+ *
+ * <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 class='spaced-list'>
+ * <li>
+ * If you use <js>"BAG"</js> or <js>"MULTI_VALUED"</js>, the order of the elements in the collection will get
+ * lost.
+ * </ul>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfParserBuilder collectionFormat(String value) {
+ return set(RDF_collectionFormat, value);
+ }
+
+ /**
* Configuration property: RDF format for representing collections and arrays.
*
* <p>
@@ -422,38 +927,44 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public RdfParserBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder beanDictionary(Class<?>...values) {
+ public RdfParserBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public RdfParserBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder beanDictionaryRemove(Object...values) {
+ public RdfParserBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public RdfParserBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public RdfParserBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -470,6 +981,24 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public RdfParserBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfParserBuilder beanFiltersRemove(Object...values) {
super.beanFiltersRemove(values);
return this;
@@ -554,6 +1083,12 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> RdfParserBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfParserBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -602,7 +1137,7 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public <T> RdfParserBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public RdfParserBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -626,32 +1161,38 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
+ public RdfParserBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder notBeanClasses(Class<?>...values) {
+ public RdfParserBuilder notBeanClasses(Object...values) {
super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
+ public RdfParserBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder notBeanClassesRemove(Object...values) {
+ public RdfParserBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder notBeanClassesRemove(Class<?>...values) {
super.notBeanClassesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public RdfParserBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
return this;
}
@@ -668,14 +1209,26 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder notBeanPackagesRemove(Object...values) {
+ public RdfParserBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfParserBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public RdfParserBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -692,6 +1245,24 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public RdfParserBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfParserBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfParserBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -716,6 +1287,12 @@ public class RdfParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public RdfParserBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfParserBuilder useEnumNames() {
super.useEnumNames();
return this;
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 da003f7..8cb7062 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
@@ -19,8 +19,12 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.internal.*;
import org.apache.juneau.jena.annotation.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
import org.apache.juneau.xml.annotation.*;
@@ -50,12 +54,535 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
return build(RdfSerializer.class);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public RdfSerializerBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ if (! m.containsKey(RdfConfig.class))
+ return this;
+ ObjectResolver r = new ObjectResolver(sr);
+ for (RdfConfig a : m.get(RdfConfig.class)) {
+ if (! a.language().isEmpty())
+ language(r.string(a.language()));
+ if (! a.juneauNs().isEmpty())
+ juneauNs(r.string(a.juneauNs()));
+ if (! a.juneauBpNs().isEmpty())
+ juneauBpNs(r.string(a.juneauBpNs()));
+ if (! a.useXmlNamespaces().isEmpty())
+ useXmlNamespaces(r.bool(a.useXmlNamespaces()));
+ if (! a.arp_iriRules().isEmpty())
+ arp_iriRules(r.string(a.arp_iriRules()));
+ if (! a.arp_errorMode().isEmpty())
+ arp_errorMode(r.string(a.arp_errorMode()));
+ if (! a.arp_embedding().isEmpty())
+ arp_embedding(r.bool(a.arp_embedding()));
+ if (! a.rdfxml_xmlBase().isEmpty())
+ rdfxml_xmlBase(r.string(a.rdfxml_xmlBase()));
+ if (! a.rdfxml_longId().isEmpty())
+ rdfxml_longId(r.bool(a.rdfxml_longId()));
+ if (! a.rdfxml_allowBadUris().isEmpty())
+ rdfxml_allowBadUris(r.bool(a.rdfxml_allowBadUris()));
+ if (! a.rdfxml_relativeUris().isEmpty())
+ rdfxml_relativeUris(r.string(a.rdfxml_relativeUris()));
+ if (! a.rdfxml_showXmlDeclaration().isEmpty())
+ rdfxml_showXmlDeclaration(r.string(a.rdfxml_showXmlDeclaration()));
+ if (! a.rdfxml_showDoctypeDeclaration().isEmpty())
+ rdfxml_showDoctypeDeclaration(r.bool(a.rdfxml_showDoctypeDeclaration()));
+ if (! a.rdfxml_tab().isEmpty())
+ rdfxml_tab(r.integer(a.rdfxml_tab()));
+ if (! a.rdfxml_attributeQuoteChar().isEmpty())
+ rdfxml_attributeQuoteChar(r.string(a.rdfxml_attributeQuoteChar()));
+ if (! a.rdfxml_blockRules().isEmpty())
+ rdfxml_blockRules(r.string(a.rdfxml_blockRules()));
+ if (! a.n3_minGap().isEmpty())
+ n3_minGap(r.integer(a.n3_minGap()));
+ if (! a.n3_objectLists().isEmpty())
+ n3_objectLists(r.bool(a.n3_objectLists()));
+ if (! a.n3_subjectColumn().isEmpty())
+ n3_subjectColumn(r.integer(a.n3_subjectColumn()));
+ if (! a.n3_propertyColumn().isEmpty())
+ n3_propertyColumn(r.integer(a.n3_propertyColumn()));
+ if (! a.n3_indentProperty().isEmpty())
+ n3_indentProperty(r.integer(a.n3_indentProperty()));
+ if (! a.n3_widePropertyLen().isEmpty())
+ n3_widePropertyLen(r.integer(a.n3_widePropertyLen()));
+ if (! a.n3_abbrevBaseUri().isEmpty())
+ n3_abbrevBaseUri(r.bool(a.n3_abbrevBaseUri()));
+ if (! a.n3_usePropertySymbols().isEmpty())
+ n3_usePropertySymbols(r.bool(a.n3_usePropertySymbols()));
+ if (! a.n3_useTripleQuotedStrings().isEmpty())
+ n3_useTripleQuotedStrings(r.bool(a.n3_useTripleQuotedStrings()));
+ if (! a.n3_useDoubles().isEmpty())
+ n3_useDoubles(r.bool(a.n3_useDoubles()));
+ if (! a.collectionFormat().isEmpty())
+ collectionFormat(r.string(a.collectionFormat()));
+ if (! a.looseCollections().isEmpty())
+ looseCollections(r.bool(a.looseCollections()));
+ if (! a.addBeanTypes().isEmpty())
+ addBeanTypes(r.bool(a.addBeanTypes()));
+ if (! a.addLiteralTypes().isEmpty())
+ addLiteralTypes(r.bool(a.addLiteralTypes()));
+ if (! a.addRootProperty().isEmpty())
+ addRootProperty(r.bool(a.addRootProperty()));
+ if (! a.autoDetectNamespaces().isEmpty())
+ autoDetectNamespaces(r.bool(a.autoDetectNamespaces()));
+ if (a.namespaces().length > 0)
+ namespaces(r.strings(a.namespaces()));
+ }
+ return this;
+ }
//-----------------------------------------------------------------------------------------------------------------
// Properties
//-----------------------------------------------------------------------------------------------------------------
/**
+ * Configuration property: XML namespace for Juneau properties.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder juneauNs(String value) {
+ return set(RDF_juneauNs, value);
+ }
+
+ /**
+ * Configuration property: Default XML namespace for bean properties.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder juneauBpNs(String value) {
+ return set(RDF_juneauBpNs, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>iri_rules</code>.
+ *
+ * <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
+ * ({@doc http://www.ietf.org/rfc/rfc3986.txt RFC 3986},
+ * {@doc http://www.ietf.org/rfc/rfc3987.txt RFC 3987}).
+ * </ul>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder arp_iriRules(String value) {
+ return set(RDF_arp_iriRules, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML ARP property: <code>error-mode</code>.
+ *
+ * <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>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder arp_errorMode(String value) {
+ return set(RDF_arp_errorMode, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML ARP property: <code>error-mode</code>.
+ *
+ * <p>
+ * Sets ARP to look for RDF embedded within an enclosing XML document.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder arp_embedding(boolean value) {
+ return set(RDF_arp_embedding, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>xmlbase</code>.
+ *
+ * <p>
+ * The value to be included for an <xa>xml:base</xa> attribute on the root element in the file.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_xmlBase(String value) {
+ return set(RDF_rdfxml_xmlBase, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>longId</code>.
+ *
+ * <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.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_longId(boolean value) {
+ return set(RDF_rdfxml_longId, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>allowBadURIs</code>.
+ *
+ * <p>
+ * URIs in the graph are, by default, checked prior to serialization.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_allowBadUris(boolean value) {
+ return set(RDF_rdfxml_allowBadUris, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>relativeURIs</code>.
+ *
+ * <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.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_relativeUris(String value) {
+ return set(RDF_rdfxml_relativeUris, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>showXmlDeclaration</code>.
+ *
+ * <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>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_showXmlDeclaration(String value) {
+ return set(RDF_rdfxml_showXmlDeclaration, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>showDoctypeDeclaration</code>.
+ *
+ * <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.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_showDoctypeDeclaration(boolean value) {
+ return set(RDF_rdfxml_showDoctypeDeclaration, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>tab</code>.
+ *
+ * <p>
+ * The number of spaces with which to indent XML child elements.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_tab(int value) {
+ return set(RDF_rdfxml_tab, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>attributeQuoteChar</code>.
+ *
+ * <p>
+ * The XML attribute quote character.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_attributeQuoteChar(String value) {
+ return set(RDF_rdfxml_attributeQuoteChar, value);
+ }
+
+ /**
+ * Configuration property: RDF/XML property: <code>blockRules</code>.
+ *
+ * <p>
+ * A list of <code>Resource</code> or a <code>String</code> being a comma separated list of fragment IDs from
+ * {@doc http://www.w3.org/TR/rdf-syntax-grammar RDF Syntax Grammar} indicating grammar
+ * rules that will not be used.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder rdfxml_blockRules(String value) {
+ return set(RDF_rdfxml_blockRules, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>minGap</code>.
+ *
+ * <p>
+ * Minimum gap between items on a line.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_minGap(int value) {
+ return set(RDF_n3_minGap, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>objectLists</code>.
+ *
+ * <p>
+ * Print object lists as comma separated lists.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_objectLists(boolean value) {
+ return set(RDF_n3_objectLists, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>subjectColumn</code>.
+ *
+ * <p>
+ * If the subject is shorter than this value, the first property may go on the same line.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_subjectColumn(int value) {
+ return set(RDF_n3_subjectColumn, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>propertyColumn</code>.
+ *
+ * <p>
+ * Width of the property column.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_propertyColumn(int value) {
+ return set(RDF_n3_propertyColumn, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>indentProperty</code>.
+ *
+ * <p>
+ * Width to indent properties.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_indentProperty(int value) {
+ return set(RDF_n3_indentProperty, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>widePropertyLen</code>.
+ *
+ * <p>
+ * Width of the property column.
+ * Must be longer than <code>propertyColumn</code>.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_widePropertyLen(int value) {
+ return set(RDF_n3_widePropertyLen, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>abbrevBaseURI</code>.
+ *
+ * <p>
+ * Control whether to use abbreviations <code><></code> or <code><#></code>.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_abbrevBaseUri(boolean value) {
+ return set(RDF_n3_abbrevBaseUri, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>usePropertySymbols</code>.
+ *
+ * <p>
+ * Control whether to use <code>a</code>, <code>=</code> and <code>=></code> in output
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_usePropertySymbols(boolean value) {
+ return set(RDF_n3_usePropertySymbols, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>useTripleQuotedStrings</code>.
+ *
+ * <p>
+ * Allow the use of <code>"""</code> to delimit long strings.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_useTripleQuotedStrings(boolean value) {
+ return set(RDF_n3_useTripleQuotedStrings, value);
+ }
+
+ /**
+ * Configuration property: N3/Turtle property: <code>useDoubles</code>.
+ *
+ * <p>
+ * Allow the use doubles as <code>123.456</code>.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder n3_useDoubles(boolean value) {
+ return set(RDF_n3_useDoubles, value);
+ }
+
+ /**
+ * Configuration property: RDF format for representing collections and arrays.
+ *
+ * <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 class='spaced-list'>
+ * <li>
+ * If you use <js>"BAG"</js> or <js>"MULTI_VALUED"</js>, the order of the elements in the collection will get
+ * lost.
+ * </ul>
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder collectionFormat(String value) {
+ return set(RDF_collectionFormat, value);
+ }
+
+ /**
+ * Configuration property: Default namespaces.
+ *
+ * <p>
+ * The default list of namespaces associated with this serializer.
+ *
+ * @param value
+ * The new value for this property.
+ * @return This object (for method chaining).
+ */
+ public RdfSerializerBuilder namespaces(String[] value) {
+ return set(RDF_namespaces, value);
+ }
+
+ /**
* Configuration property: Add XSI data types to non-<code>String</code> literals.
*
* <h5 class='section'>See Also:</h5>
@@ -621,38 +1148,44 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public RdfSerializerBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder beanDictionary(Class<?>...values) {
+ public RdfSerializerBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public RdfSerializerBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder beanDictionaryRemove(Object...values) {
+ public RdfSerializerBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public RdfSerializerBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public RdfSerializerBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -669,6 +1202,24 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public RdfSerializerBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfSerializerBuilder beanFiltersRemove(Object...values) {
super.beanFiltersRemove(values);
return this;
@@ -753,6 +1304,12 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> RdfSerializerBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -801,7 +1358,7 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public <T> RdfSerializerBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public RdfSerializerBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -825,32 +1382,38 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
+ public RdfSerializerBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder notBeanClasses(Class<?>...values) {
+ public RdfSerializerBuilder notBeanClasses(Object...values) {
super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
+ public RdfSerializerBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder notBeanClassesRemove(Object...values) {
+ public RdfSerializerBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder notBeanClassesRemove(Class<?>...values) {
super.notBeanClassesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public RdfSerializerBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
return this;
}
@@ -867,14 +1430,26 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder notBeanPackagesRemove(Object...values) {
+ public RdfSerializerBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public RdfSerializerBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public RdfSerializerBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -891,6 +1466,24 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public RdfSerializerBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public RdfSerializerBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfSerializerBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -915,6 +1508,12 @@ public class RdfSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public RdfSerializerBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public RdfSerializerBuilder useEnumNames() {
super.useEnumNames();
return this;
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfig.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfig.java
new file mode 100644
index 0000000..9887745
--- /dev/null
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfig.java
@@ -0,0 +1,638 @@
+// ***************************************************************************************************************************
+// * 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.annotation;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.jena.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.xml.*;
+import org.apache.juneau.xml.annotation.*;
+
+/**
+ * Annotation for specifying config properties defined in {@link XmlSerializer}, {@link XmlDocSerializer}, and {@link XmlParser}.
+ *
+ * <p>
+ * Used primarily for specifying bean configuration properties on REST classes and methods.
+ */
+@Documented
+@Target(TYPE)
+@Retention(RUNTIME)
+@Inherited
+public @interface RdfConfig {
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // RdfCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Configuration property: RDF language.
+ *
+ * <p>
+ * The RDF language to use.
+ *
+ * <p>
+ * Can be any of the following:
+ * <ul class='spaced-list'>
+ * <li>
+ * <js>"RDF/XML"</js>
+ * <li>
+ * <js>"RDF/XML-ABBREV"</js> (default)
+ * <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>org.apache.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>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link RdfCommon#RDF_language}
+ * </ul>
+ */
+ String language() default "";
+
+ /**
+ * Configuration property: XML namespace for Juneau properties.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link RdfCommon#RDF_juneauNs}
+ * </ul>
+ */
+ String juneauNs() default "";
+
+ /**
+ * Configuration property: Default XML namespace for bean properties.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link RdfCommon#RDF_juneauBpNs}
+ * </ul>
+ */
+ String juneauBpNs() default "";
+
+ /**
+ * Configuration property: Reuse XML namespaces when RDF namespaces not specified.
+ *
+ * <p>
+ * When specified, namespaces defined using {@link XmlNs @XmlNs} and {@link Xml @Xml} will be inherited by the RDF serializers.
+ * <br>Otherwise, namespaces will be defined using {@link RdfNs @RdfNs} and {@link Rdf @Rdf}.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js> (default)
+ * <li><js>"false"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link RdfCommon#RDF_useXmlNamespaces}
+ * </ul>
+ */
+ String useXmlNamespaces() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>iri_rules</code>.
+ *
+ * <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
+ * ({@doc http://www.ietf.org/rfc/rfc3986.txt RFC 3986},
+ * {@doc http://www.ietf.org/rfc/rfc3987.txt RFC 3987}).
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link RdfCommon#RDF_arp_iriRules}
+ * </ul>
+ */
+ String arp_iriRules() default "";
+
+ /**
+ * Configuration property: RDF/XML ARP property: <code>error-mode</code>.
+ *
+ * <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>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_arp_errorMode}
+ * <li>
+ * {@doc ARP/ARPOptions.html#setDefaultErrorMode() ARPOptions.setDefaultErrorMode()}
+ * <li>
+ * {@doc ARP/ARPOptions.html#setLaxErrorMode() ARPOptions.setLaxErrorMode()}
+ * <li>
+ * {@doc ARP/ARPOptions.html#setStrictErrorMode() ARPOptions.setStrictErrorMode()}
+ * <li>
+ * {@doc ARP/ARPOptions.html#setStrictErrorMode(int) ARPOptions.setStrictErrorMode(int)}
+ * </ul>
+ */
+ String arp_errorMode() default "";
+
+ /**
+ * Configuration property: RDF/XML ARP property: <code>embedding</code>.
+ *
+ * <p>
+ * Sets ARP to look for RDF embedded within an enclosing XML document.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_arp_embedding}
+ * <li>
+ * {@doc ARP/ARPOptions.html#setEmbedding(boolean) ARPOptions.setEmbedding(boolean)}
+ * </ul>
+ */
+ String arp_embedding() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>xmlbase</code>.
+ *
+ * <p>
+ * The value to be included for an <xa>xml:base</xa> attribute on the root element in the file.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_xmlBase}
+ * </ul>
+ */
+ String rdfxml_xmlBase() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>longId</code>.
+ *
+ * <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.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_longId}
+ * </ul>
+ */
+ String rdfxml_longId() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>allowBadURIs</code>.
+ *
+ * <p>
+ * URIs in the graph are, by default, checked prior to serialization.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_allowBadUris}
+ * </ul>
+ */
+ String rdfxml_allowBadUris() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>relativeURIs</code>.
+ *
+ * <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.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_relativeUris}
+ * </ul>
+ */
+ String rdfxml_relativeUris() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>showXmlDeclaration</code>.
+ *
+ * <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>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_showXmlDeclaration}
+ * </ul>
+ */
+ String rdfxml_showXmlDeclaration() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>showDoctypeDeclaration</code>.
+ *
+ * <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.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_showDoctypeDeclaration}
+ * </ul>
+ */
+ String rdfxml_showDoctypeDeclaration() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>tab</code>.
+ *
+ * <p>
+ * The number of spaces with which to indent XML child elements.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_tab}
+ * </ul>
+ */
+ String rdfxml_tab() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>attributeQuoteChar</code>.
+ *
+ * <p>
+ * The XML attribute quote character.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_attributeQuoteChar}
+ * </ul>
+ */
+ String rdfxml_attributeQuoteChar() default "";
+
+ /**
+ * Configuration property: RDF/XML property: <code>blockRules</code>.
+ *
+ * <p>
+ * A list of <code>Resource</code> or a <code>String</code> being a comma separated list of fragment IDs from
+ * {@doc http://www.w3.org/TR/rdf-syntax-grammar RDF Syntax Grammar} indicating grammar
+ * rules that will not be used.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_rdfxml_blockRules}
+ * </ul>
+ */
+ String rdfxml_blockRules() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>minGap</code>.
+ *
+ * <p>
+ * Minimum gap between items on a line.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_minGap}
+ * </ul>
+ */
+ String n3_minGap() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>objectLists</code>.
+ *
+ * <p>
+ * Print object lists as comma separated lists.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_objectLists}
+ * </ul>
+ */
+ String n3_objectLists() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>subjectColumn</code>.
+ *
+ * <p>
+ * If the subject is shorter than this value, the first property may go on the same line.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_subjectColumn}
+ * </ul>
+ */
+ String n3_subjectColumn() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>propertyColumn</code>.
+ *
+ * <p>
+ * Width of the property column.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_propertyColumn}
+ * </ul>
+ */
+ String n3_propertyColumn() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>indentProperty</code>.
+ *
+ * <p>
+ * Width to indent properties.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_indentProperty}
+ * </ul>
+ */
+ String n3_indentProperty() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>widePropertyLen</code>.
+ *
+ * <p>
+ * Width of the property column.
+ * <br>Must be longer than <code>propertyColumn</code>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_widePropertyLen}
+ * </ul>
+ */
+ String n3_widePropertyLen() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>abbrevBaseURI</code>.
+ *
+ * <p>
+ * Control whether to use abbreviations <code><></code> or <code><#></code>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_abbrevBaseUri}
+ * </ul>
+ */
+ String n3_abbrevBaseUri() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>usePropertySymbols</code>.
+ *
+ * <p>
+ * Control whether to use <code>a</code>, <code>=</code> and <code>=></code> in output
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_usePropertySymbols}
+ * </ul>
+ */
+ String n3_usePropertySymbols() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>useTripleQuotedStrings</code>.
+ *
+ * <p>
+ * Allow the use of <code>"""</code> to delimit long strings.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_useTripleQuotedStrings}
+ * </ul>
+ */
+ String n3_useTripleQuotedStrings() default "";
+
+ /**
+ * Configuration property: N3/Turtle property: <code>useDoubles</code>.
+ *
+ * <p>
+ * Allow the use doubles as <code>123.456</code>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_n3_useDoubles}
+ * </ul>
+ */
+ String n3_useDoubles() default "";
+
+ /**
+ * Configuration property: RDF format for representing collections and arrays.
+ *
+ * <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 class='spaced-list'>
+ * <li>
+ * If you use <js>"BAG"</js> or <js>"MULTI_VALUED"</js>, the order of the elements in the collection will get
+ * lost.
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_collectionFormat}
+ * </ul>
+ */
+ String collectionFormat() default "";
+
+ /**
+ * Configuration property: Collections should be serialized and parsed as loose collections.
+ *
+ * <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'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfCommon#RDF_looseCollections}
+ * </ul>
+ */
+ String looseCollections() default "";
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // RdfParser
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Configuration property: Trim whitespace from text elements.
+ *
+ * <p>
+ * If <js>"true"</js>, whitespace in text elements will be automatically trimmed.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfParser#RDF_trimWhitespace}
+ * </ul>
+ */
+ String trimWhitespace() default "";
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // RdfSerializer
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Configuration property: Add <js>"_type"</js> properties when needed.
+ *
+ * If <js>"true"</js>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred
+ * through reflection.
+ *
+ * <p>
+ * When present, this value overrides the {@link Serializer#SERIALIZER_addBeanTypes} setting and is
+ * provided to customize the behavior of specific serializers in a {@link SerializerGroup}.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfSerializer#RDF_addBeanTypes}
+ * </ul>
+ */
+ String addBeanTypes() default "";
+
+ /**
+ * Configuration property: Add XSI data types to non-<code>String</code> literals.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfSerializer#RDF_addLiteralTypes}
+ * </ul>
+ */
+ String addLiteralTypes() default "";
+
+ /**
+ * Configuration property: Add RDF root identifier property to root node.
+ *
+ * <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.
+ * <br>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.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfSerializer#RDF_addRootProperty}
+ * </ul>
+ */
+ String addRootProperty() default "";
+
+ /**
+ * Configuration property: Auto-detect namespace usage.
+ *
+ * <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.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfSerializer#RDF_autoDetectNamespaces}
+ * </ul>
+ */
+ String autoDetectNamespaces() default "";
+
+ /**
+ * Configuration property: Default namespaces.
+ *
+ * <p>
+ * The default list of namespaces associated with this serializer.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul class='spaced-list'>
+ * <li class='jf'>{@link RdfSerializer#RDF_namespaces}
+ * </ul>
+ */
+ String[] namespaces() default {};
+}
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 28cd7e5..23617be 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
@@ -250,8 +250,10 @@ public class BeanContext extends Context {
* <ul>
* <li class='jm'>{@link BeanContextBuilder#beanDictionary(Object...)}
* <li class='jm'>{@link BeanContextBuilder#beanDictionary(Class...)}
- * <li class='jm'>{@link BeanContextBuilder#beanDictionary(boolean,Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#beanDictionaryReplace(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#beanDictionaryReplace(Class...)}
* <li class='jm'>{@link BeanContextBuilder#beanDictionaryRemove(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#beanDictionaryRemove(Class...)}
* <li class='jm'>{@link BeanFilterBuilder#beanDictionary(Class...)}
* </ul>
* </ul>
@@ -383,8 +385,10 @@ public class BeanContext extends Context {
* <ul>
* <li class='jm'>{@link BeanContextBuilder#beanFilters(Object...)}
* <li class='jm'>{@link BeanContextBuilder#beanFilters(Class...)}
- * <li class='jm'>{@link BeanContextBuilder#beanFilters(boolean,Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#beanFiltersReplace(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#beanFiltersReplace(Class...)}
* <li class='jm'>{@link BeanContextBuilder#beanFiltersRemove(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#beanFiltersRemove(Class...)}
* </ul>
* </ul>
*
@@ -1352,7 +1356,9 @@ public class BeanContext extends Context {
* <ul>
* <li class='jm'>{@link BeanContextBuilder#notBeanClasses(Class...)}
* <li class='jm'>{@link BeanContextBuilder#notBeanClasses(Object...)}
- * <li class='jm'>{@link BeanContextBuilder#notBeanClasses(boolean, Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#notBeanClassesReplace(Class...)}
+ * <li class='jm'>{@link BeanContextBuilder#notBeanClassesReplace(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#notBeanClassesRemove(Class...)}
* <li class='jm'>{@link BeanContextBuilder#notBeanClassesRemove(Object...)}
* </ul>
* </ul>
@@ -1419,8 +1425,10 @@ public class BeanContext extends Context {
* <ul>
* <li class='jm'>{@link BeanContextBuilder#notBeanPackages(Object...)}
* <li class='jm'>{@link BeanContextBuilder#notBeanPackages(String...)}
- * <li class='jm'>{@link BeanContextBuilder#notBeanPackages(boolean, Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#notBeanPackagesReplace(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#notBeanPackagesReplace(String...)}
* <li class='jm'>{@link BeanContextBuilder#notBeanPackagesRemove(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#notBeanPackagesRemove(String...)}
* </ul>
* </ul>
*
@@ -1487,8 +1495,10 @@ public class BeanContext extends Context {
* <ul>
* <li class='jm'>{@link BeanContextBuilder#pojoSwaps(Object...)}
* <li class='jm'>{@link BeanContextBuilder#pojoSwaps(Class...)}
- * <li class='jm'>{@link BeanContextBuilder#pojoSwaps(boolean, Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#pojoSwapsReplace(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#pojoSwapsReplace(Class...)}
* <li class='jm'>{@link BeanContextBuilder#pojoSwapsRemove(Object...)}
+ * <li class='jm'>{@link BeanContextBuilder#pojoSwapsRemove(Class...)}
* </ul>
* </ul>
*
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java
index 63b034e..6cdacb5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContextBuilder.java
@@ -20,8 +20,13 @@ import java.util.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.marshall.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.transform.*;
+import org.apache.juneau.utils.*;
/**
* Builder class for building instances of serializers, parsers, and bean contexts.
@@ -84,6 +89,117 @@ public class BeanContextBuilder extends ContextBuilder {
}
//-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Apply annotations to this builder.
+ *
+ * @param m
+ * Annotations map.
+ * <br>Must not be <jk>null</jk>.
+ * @param sr The string resolver to use for resolving variables in the annotations.
+ * @return This object (for method chaining).
+ * @throws ParseException
+ */
+ public BeanContextBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ if (! m.containsKey(BeanConfig.class))
+ return this;
+ ObjectResolver r = new ObjectResolver(sr);
+ for (BeanConfig a : m.get(BeanConfig.class)) {
+ if (! a.beanClassVisibility().isEmpty())
+ beanClassVisibility(r.visibility(a.beanClassVisibility()));
+ if (! a.beanConstructorVisibility().isEmpty())
+ beanConstructorVisibility(r.visibility(a.beanConstructorVisibility()));
+ if (a.beanDictionary().length != 0)
+ beanDictionary(a.beanDictionary());
+ if (a.beanDictionary_replace().length != 0)
+ beanDictionaryReplace(a.beanDictionary_replace());
+ if (a.beanDictionary_remove().length != 0)
+ beanDictionaryRemove(a.beanDictionary_remove());
+ if (! a.beanFieldVisibility().isEmpty())
+ beanFieldVisibility(r.visibility(a.beanFieldVisibility()));
+ if (a.beanFilters().length != 0)
+ beanFilters(a.beanFilters());
+ if (a.beanFilters_replace().length != 0)
+ beanFiltersReplace(a.beanFilters_replace());
+ if (a.beanFilters_remove().length != 0)
+ beanFiltersRemove(a.beanFilters_remove());
+ if (! a.beanMapPutReturnsOldValue().isEmpty())
+ beanMapPutReturnsOldValue(r.bool(a.beanMapPutReturnsOldValue()));
+ if (! a.beanMethodVisibility().isEmpty())
+ beanMethodVisibility(r.visibility(a.beanMethodVisibility()));
+ if (! a.beansRequireDefaultConstructor().isEmpty())
+ beansRequireDefaultConstructor(r.bool(a.beansRequireDefaultConstructor()));
+ if (! a.beansRequireSerializable().isEmpty())
+ beansRequireSerializable(r.bool(a.beansRequireSerializable()));
+ if (! a.beansRequireSettersForGetters().isEmpty())
+ beansRequireSettersForGetters(r.bool(a.beansRequireSettersForGetters()));
+ if (! a.beansRequireSomeProperties().isEmpty())
+ beansRequireSomeProperties(r.bool(a.beansRequireSomeProperties()));
+ if (! a.beanTypePropertyName().isEmpty())
+ beanTypePropertyName(r.string(a.beanTypePropertyName()));
+ if (! a.debug().isEmpty())
+ debug(r.bool(a.debug()));
+ for (CSEntry e : a.examples())
+ exampleJson(e.key(), r.string(e.value()));
+ for (CSEntry e : a.excludeProperties())
+ excludeProperties(e.key(), r.string(e.value()));
+ if (! a.fluentSetters().isEmpty())
+ fluentSetters(r.bool(a.fluentSetters()));
+ if (! a.ignoreInvocationExceptionsOnGetters().isEmpty())
+ ignoreInvocationExceptionsOnGetters(r.bool(a.ignoreInvocationExceptionsOnGetters()));
+ if (! a.ignoreInvocationExceptionsOnSetters().isEmpty())
+ ignoreInvocationExceptionsOnSetters(r.bool(a.ignoreInvocationExceptionsOnSetters()));
+ if (! a.ignorePropertiesWithoutSetters().isEmpty())
+ ignorePropertiesWithoutSetters(r.bool(a.ignorePropertiesWithoutSetters()));
+ if (! a.ignoreUnknownBeanProperties().isEmpty())
+ ignoreUnknownBeanProperties(r.bool(a.ignoreUnknownBeanProperties()));
+ if (! a.ignoreUnknownNullBeanProperties().isEmpty())
+ ignoreUnknownNullBeanProperties(r.bool(a.ignoreUnknownNullBeanProperties()));
+ for (CCEntry e : a.implClasses())
+ implClass(e.key(), e.value());
+ for (CSEntry e : a.includeProperties())
+ includeProperties(e.key(), r.string(e.value()));
+ if (! a.locale().isEmpty())
+ locale(r.locale(a.locale()));
+ if (! a.mediaType().isEmpty())
+ mediaType(r.mediaType(a.mediaType()));
+ if (a.notBeanClasses().length != 0)
+ notBeanClasses(a.notBeanClasses());
+ if (a.notBeanClasses_replace().length != 0)
+ notBeanClassesReplace(a.notBeanClasses_replace());
+ if (a.notBeanClasses_remove().length != 0)
+ notBeanClassesRemove(a.notBeanClasses_remove());
+ if (a.notBeanPackages().length != 0)
+ notBeanPackages(r.strings(a.notBeanPackages()));
+ if (a.notBeanPackages_replace().length != 0)
+ notBeanPackagesReplace(r.strings(a.notBeanPackages_replace()));
+ if (a.notBeanPackages_remove().length != 0)
+ notBeanPackagesRemove(r.strings(a.notBeanPackages_remove()));
+ if (a.pojoSwaps().length != 0)
+ pojoSwaps(a.pojoSwaps());
+ if (a.pojoSwaps_replace().length != 0)
+ pojoSwapsReplace(a.pojoSwaps_replace());
+ if (a.pojoSwaps_remove().length != 0)
+ pojoSwapsRemove(a.pojoSwaps_remove());
+ if (a.propertyNamer() != PropertyNamer.Null.class)
+ propertyNamer(a.propertyNamer());
+ if (! a.sortProperties().isEmpty())
+ sortProperties(r.bool(a.sortProperties()));
+ if (! a.timeZone().isEmpty())
+ timeZone(r.timeZone(a.timeZone()));
+ if (! a.useEnumNames().isEmpty())
+ useEnumNames(r.bool(a.useEnumNames()));
+ if (! a.useInterfaceProxies().isEmpty())
+ useInterfaceProxies(r.bool(a.useInterfaceProxies()));
+ if (! a.useJavaBeanIntrospector().isEmpty())
+ useJavaBeanIntrospector(r.bool(a.useJavaBeanIntrospector()));
+ }
+ return this;
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
// Properties
//-----------------------------------------------------------------------------------------------------------------
@@ -173,21 +289,57 @@ public class BeanContextBuilder extends ContextBuilder {
* Configuration property: Bean dictionary.
*
* <p>
- * Same as {@link #beanDictionary(Object...)} but allows you to optionally overwrite the previous value.
+ * Same as {@link #beanDictionary(Object...)} but replaces the existing value.
*
* <h5 class='section'>See Also:</h5>
* <ul>
* <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
* </ul>
*
- * @param append
- * If <jk>true</jk>, the previous value is appended to. Otherwise, the previous value is replaced.
* @param values
* The new values for this property.
* @return This object (for method chaining).
*/
- public BeanContextBuilder beanDictionary(boolean append, Object...values) {
- return set(append, BEAN_beanDictionary, values);
+ public BeanContextBuilder beanDictionaryReplace(Class<?>...values) {
+ return set(false, BEAN_beanDictionary, values);
+ }
+
+ /**
+ * Configuration property: Bean dictionary.
+ *
+ * <p>
+ * Same as {@link #beanDictionary(Object...)} but replaces the existing value.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
+ * </ul>
+ *
+ * @param values
+ * The new values for this property.
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder beanDictionaryReplace(Object...values) {
+ return set(false, BEAN_beanDictionary, values);
+ }
+
+ /**
+ * Configuration property: Bean dictionary.
+ *
+ * <p>
+ * Removes from the list of classes that make up the bean dictionary in this bean context.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
+ * </ul>
+ *
+ * @param values
+ * The values to remove from this property.
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder beanDictionaryRemove(Class<?>...values) {
+ return removeFrom(BEAN_beanDictionary, values);
}
/**
@@ -280,15 +432,38 @@ public class BeanContextBuilder extends ContextBuilder {
* Configuration property: Bean filters.
*
* <p>
- * Same as {@link #beanFilters(Object...)} but allows you to optionally overwrite the previous value.
+ * Same as {@link #beanFilters(Object...)} but replaces the existing values.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanFilters}
+ * </ul>
+ *
+ * @param values
+ * The new values for this property.
+ * <br>Values can consist of any of the following types:
+ * <ul>
+ * <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
+ * <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
+ * <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
+ * </ul>
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder beanFiltersReplace(Class<?>...values) {
+ return set(false, BEAN_beanFilters, values);
+ }
+
+ /**
+ * Configuration property: Bean filters.
+ *
+ * <p>
+ * Same as {@link #beanFilters(Object...)} but replaces the existing values.
*
* <h5 class='section'>See Also:</h5>
* <ul>
* <li class='jf'>{@link BeanContext#BEAN_beanFilters}
* </ul>
*
- * @param append
- * If <jk>true</jk>, the previous value is appended to. Otherwise, the previous value is replaced.
* @param values
* The new values for this property.
* <br>Values can consist of any of the following types:
@@ -300,8 +475,33 @@ public class BeanContextBuilder extends ContextBuilder {
* </ul>
* @return This object (for method chaining).
*/
- public BeanContextBuilder beanFilters(boolean append, Object...values) {
- return set(append, BEAN_beanFilters, values);
+ public BeanContextBuilder beanFiltersReplace(Object...values) {
+ return set(false, BEAN_beanFilters, values);
+ }
+
+ /**
+ * Configuration property: Bean filters.
+ *
+ * <p>
+ * Removes from the list of classes that make up the bean filters in this bean context.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanFilters}
+ * </ul>
+ *
+ * @param values
+ * The values to remove from this property.
+ * <br>Values can consist of any of the following types:
+ * <ul>
+ * <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean(typeName)}.
+ * <li>Any subclass of {@link BeanDictionaryList} containing a collection of bean classes with type name annotations.
+ * <li>Any subclass of {@link BeanDictionaryMap} containing a mapping of type names to classes without type name annotations.
+ * </ul>
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder beanFiltersRemove(Class<?>...values) {
+ return removeFrom(BEAN_beanFilters, values);
}
/**
@@ -609,6 +809,30 @@ public class BeanContextBuilder extends ContextBuilder {
}
/**
+ * Configuration property: POJO example.
+ *
+ * <p>
+ * Specifies an example of the specified class.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_examples}
+ * </ul>
+ *
+ * @param <T>
+ * @param pojoClass The POJO class.
+ * @param json The simple JSON representation of the example.
+ * @return This object (for method chaining).
+ */
+ public <T> BeanContextBuilder exampleJson(Class<T> pojoClass, String json) {
+ try {
+ return addTo(BEAN_examples, pojoClass.getName(), SimpleJson.DEFAULT.read(json, pojoClass));
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
* Configuration property: Bean property excludes.
*
* <p>
@@ -876,10 +1100,9 @@ public class BeanContextBuilder extends ContextBuilder {
*
* @param interfaceClass The interface class.
* @param implClass The implementation class.
- * @param <I> The class type of the interface.
* @return This object (for method chaining).
*/
- public <I> BeanContextBuilder implClass(Class<I> interfaceClass, Class<? extends I> implClass) {
+ public BeanContextBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
return addTo(BEAN_implClasses, interfaceClass.getName(), implClass);
}
@@ -1001,19 +1224,35 @@ public class BeanContextBuilder extends ContextBuilder {
* Configuration property: Bean class exclusions.
*
* <p>
- * Not-bean classes are converted to <code>Strings</code> during serialization even if they appear to be
- * bean-like.
+ * List of classes that should not be treated as beans even if they appear to be bean-like.
+ * <br>Not-bean classes are converted to <code>Strings</code> during serialization.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
+ * </ul>
+ *
+ * @param values The values to add to this property.
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder notBeanClasses(Class<?>...values) {
+ return addTo(BEAN_notBeanClasses, values);
+ }
+
+ /**
+ * Configuration property: Bean class exclusions.
+ *
+ * <p>
+ * List of classes that should not be treated as beans even if they appear to be bean-like.
+ * <br>Not-bean classes are converted to <code>Strings</code> during serialization.
*
* <h5 class='section'>See Also:</h5>
* <ul>
* <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
* </ul>
*
- * @param append
- * If <jk>true</jk>, the previous value is appended to.
- * <br>Otherwise, the previous value is replaced.
* @param values
- * The new value for this property.
+ * The values to add to this property.
* <br>Values can consist of any of the following types:
* <ul>
* <li>Classes.
@@ -1021,35 +1260,36 @@ public class BeanContextBuilder extends ContextBuilder {
* </ul>
* @return This object (for method chaining).
*/
- public BeanContextBuilder notBeanClasses(boolean append, Object...values) {
- return set(append, BEAN_notBeanClasses, values);
+ public BeanContextBuilder notBeanClasses(Object...values) {
+ return addTo(BEAN_notBeanClasses, values);
}
/**
* Configuration property: Bean class exclusions.
*
* <p>
- * List of classes that should not be treated as beans even if they appear to be bean-like.
- * <br>Not-bean classes are converted to <code>Strings</code> during serialization.
+ * Not-bean classes are converted to <code>Strings</code> during serialization even if they appear to be
+ * bean-like.
*
* <h5 class='section'>See Also:</h5>
* <ul>
* <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
* </ul>
*
- * @param values The values to add to this property.
+ * @param values
+ * The new value for this property.
* @return This object (for method chaining).
*/
- public BeanContextBuilder notBeanClasses(Class<?>...values) {
- return addTo(BEAN_notBeanClasses, values);
+ public BeanContextBuilder notBeanClassesReplace(Class<?>...values) {
+ return set(false, BEAN_notBeanClasses, values);
}
/**
* Configuration property: Bean class exclusions.
*
* <p>
- * List of classes that should not be treated as beans even if they appear to be bean-like.
- * <br>Not-bean classes are converted to <code>Strings</code> during serialization.
+ * Not-bean classes are converted to <code>Strings</code> during serialization even if they appear to be
+ * bean-like.
*
* <h5 class='section'>See Also:</h5>
* <ul>
@@ -1057,7 +1297,7 @@ public class BeanContextBuilder extends ContextBuilder {
* </ul>
*
* @param values
- * The values to add to this property.
+ * The new value for this property.
* <br>Values can consist of any of the following types:
* <ul>
* <li>Classes.
@@ -1065,8 +1305,24 @@ public class BeanContextBuilder extends ContextBuilder {
* </ul>
* @return This object (for method chaining).
*/
- public BeanContextBuilder notBeanClasses(Object...values) {
- return addTo(BEAN_notBeanClasses, values);
+ public BeanContextBuilder notBeanClassesReplace(Object...values) {
+ return set(false, BEAN_notBeanClasses, values);
+ }
+
+ /**
+ * Configuration property: Bean class exclusions.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
+ * </ul>
+ *
+ * @param values
+ * The values to remove from this property.
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder notBeanClassesRemove(Class<?>...values) {
+ return removeFrom(BEAN_notBeanClasses, values);
}
/**
@@ -1093,28 +1349,17 @@ public class BeanContextBuilder extends ContextBuilder {
/**
* Configuration property: Bean package exclusions.
*
- * <p>
- * When specified, the current list of ignore packages are appended to.
- *
* <h5 class='section'>See Also:</h5>
* <ul>
* <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
* </ul>
*
- * @param append
- * If <jk>true</jk>, the previous value is appended to.
- * <br>Otherwise, the previous value is replaced.
* @param values
- * The new values for this property.
- * <br>Values can consist of any of the following types:
- * <ul>
- * <li>Classes.
- * <li>Arrays and collections of classes.
- * </ul>
+ * The values to add to this property.
* @return This object (for method chaining).
*/
- public BeanContextBuilder notBeanPackages(boolean append, Object...values) {
- return set(append, BEAN_notBeanPackages, values);
+ public BeanContextBuilder notBeanPackages(String...values) {
+ return addTo(BEAN_notBeanPackages, values);
}
/**
@@ -1147,11 +1392,11 @@ public class BeanContextBuilder extends ContextBuilder {
* </ul>
*
* @param values
- * The values to add to this property.
+ * <br>Values can consist of any of the following types:
* @return This object (for method chaining).
*/
- public BeanContextBuilder notBeanPackages(String...values) {
- return addTo(BEAN_notBeanPackages, values);
+ public BeanContextBuilder notBeanPackagesReplace(String...values) {
+ return set(false, BEAN_notBeanPackages, values);
}
/**
@@ -1171,39 +1416,44 @@ public class BeanContextBuilder extends ContextBuilder {
* </ul>
* @return This object (for method chaining).
*/
- public BeanContextBuilder notBeanPackagesRemove(Object...values) {
- return removeFrom(BEAN_notBeanPackages, values);
+ public BeanContextBuilder notBeanPackagesReplace(Object...values) {
+ return set(false, BEAN_notBeanPackages, values);
}
/**
- * Configuration property: POJO swaps.
+ * Configuration property: Bean package exclusions.
*
- * <p>
- * POJO swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization,
- * and "swap in" the non-serializable class during parsing.
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
+ * </ul>
*
- * <p>
- * An example of a POJO swap would be a <code>Calendar</code> object that gets swapped out for an ISO8601 string.
+ * @param values The values to remove from this property.
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder notBeanPackagesRemove(String...values) {
+ return removeFrom(BEAN_notBeanPackages, values);
+ }
+
+ /**
+ * Configuration property: Bean package exclusions.
*
* <h5 class='section'>See Also:</h5>
* <ul>
- * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
* </ul>
*
- * @param append
- * If <jk>true</jk>, the previous value is appended to.
- * <br>Otherwise, the previous value is replaced.
* @param values
- * The new value for this property.
* <br>Values can consist of any of the following types:
+ * <br>Possible values are:
* <ul>
* <li>Strings.
* <li>Arrays and collections of strings.
* </ul>
* @return This object (for method chaining).
*/
- public BeanContextBuilder pojoSwaps(boolean append, Object...values) {
- return set(append, BEAN_pojoSwaps, values);
+ public BeanContextBuilder notBeanPackagesRemove(Object...values) {
+ return removeFrom(BEAN_notBeanPackages, values);
}
/**
@@ -1261,6 +1511,71 @@ public class BeanContextBuilder extends ContextBuilder {
* </ul>
* @return This object (for method chaining).
*/
+ public BeanContextBuilder pojoSwapsReplace(Class<?>...values) {
+ return set(false, BEAN_pojoSwaps, values);
+ }
+
+ /**
+ * Configuration property: POJO swaps.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
+ * </ul>
+ *
+ * @param values
+ * The values to remove from this property.
+ * <br>Values can consist of any of the following types:
+ * <ul>
+ * <li>Any subclass of {@link PojoSwap}.
+ * <li>Any surrogate class. A shortcut for defining a {@link SurrogateSwap}.
+ * <li>Any array or collection of the objects above.
+ * </ul>
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder pojoSwapsReplace(Object...values) {
+ return set(false, BEAN_pojoSwaps, values);
+ }
+
+ /**
+ * Configuration property: POJO swaps.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
+ * </ul>
+ *
+ * @param values
+ * The values to remove from this property.
+ * <br>Values can consist of any of the following types:
+ * <ul>
+ * <li>Any subclass of {@link PojoSwap}.
+ * <li>Any surrogate class. A shortcut for defining a {@link SurrogateSwap}.
+ * </ul>
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder pojoSwapsRemove(Class<?>...values) {
+ return removeFrom(BEAN_pojoSwaps, values);
+ }
+
+ /**
+ * Configuration property: POJO swaps.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
+ * </ul>
+ *
+ * @param values
+ * The values to remove from this property.
+ * <br>Values can consist of any of the following types:
+ * <ul>
+ * <li>Any subclass of {@link PojoSwap}.
+ * <li>Any surrogate class. A shortcut for defining a {@link SurrogateSwap}.
+ * <li>Any array or collection of the objects above.
+ * </ul>
+ * @return This object (for method chaining).
+ */
public BeanContextBuilder pojoSwapsRemove(Object...values) {
return removeFrom(BEAN_pojoSwaps, values);
}
@@ -1349,6 +1664,24 @@ public class BeanContextBuilder extends ContextBuilder {
* <li class='jf'>{@link BeanContext#BEAN_useEnumNames}
* </ul>
*
+ * @param value The property value.
+ * @return This object (for method chaining).
+ */
+ public BeanContextBuilder useEnumNames(boolean value) {
+ return set(BEAN_useEnumNames, value);
+ }
+
+ /**
+ * Configuration property: Use enum names.
+ *
+ * <p>
+ * When enabled, enums are always serialized by name instead of using {@link Object#toString()}.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_useEnumNames}
+ * </ul>
+ *
* @return This object (for method chaining).
*/
public BeanContextBuilder useEnumNames() {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseBuilder.java
index 8ba89b9..737a328 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseBuilder.java
@@ -16,7 +16,12 @@ import static org.apache.juneau.BeanTraverseContext.*;
import java.util.*;
+import org.apache.juneau.annotation.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
/**
* Builder class for building instances of bean traversals.
@@ -39,6 +44,28 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
super(ps);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public BeanTraverseBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ if (! m.containsKey(BeanConfig.class))
+ return this;
+ ObjectResolver r = new ObjectResolver(sr);
+ for (BeanConfig a : m.get(BeanConfig.class)) {
+ if (! a.detectRecursions().isEmpty())
+ detectRecursions(r.bool(a.detectRecursions()));
+ if (! a.ignoreRecursions().isEmpty())
+ ignoreRecursions(r.bool(a.ignoreRecursions()));
+ if (! a.initialDepth().isEmpty())
+ initialDepth(r.integer(a.initialDepth()));
+ if (! a.maxDepth().isEmpty())
+ maxDepth(r.integer(a.maxDepth()));
+ }
+ return this;
+ }
//-----------------------------------------------------------------------------------------------------------------
// Properties
@@ -187,38 +214,44 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public BeanTraverseBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder beanDictionary(Class<?>...values) {
+ public BeanTraverseBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public BeanTraverseBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder beanDictionaryRemove(Object...values) {
+ public BeanTraverseBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public BeanTraverseBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public BeanTraverseBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -235,6 +268,24 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
+ public BeanTraverseBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public BeanTraverseBuilder beanFiltersRemove(Object...values) {
super.beanFiltersRemove(values);
return this;
@@ -319,6 +370,12 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> BeanTraverseBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public BeanTraverseBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -367,7 +424,7 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
- public <T> BeanTraverseBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public BeanTraverseBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -391,32 +448,38 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
+ public BeanTraverseBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder notBeanClasses(Class<?>...values) {
+ public BeanTraverseBuilder notBeanClasses(Object...values) {
super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
+ public BeanTraverseBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder notBeanClassesRemove(Object...values) {
+ public BeanTraverseBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder notBeanClassesRemove(Class<?>...values) {
super.notBeanClassesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public BeanTraverseBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
return this;
}
@@ -433,14 +496,26 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder notBeanPackagesRemove(Object...values) {
+ public BeanTraverseBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public BeanTraverseBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public BeanTraverseBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -457,6 +532,24 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
+ public BeanTraverseBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public BeanTraverseBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public BeanTraverseBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -481,6 +574,12 @@ public class BeanTraverseBuilder extends BeanContextBuilder {
}
@Override /* BeanContextBuilder */
+ public BeanTraverseBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public BeanTraverseBuilder useEnumNames() {
super.useEnumNames();
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyNamer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyNamer.java
index 2520e07..a245384 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyNamer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyNamer.java
@@ -27,6 +27,11 @@ import org.apache.juneau.annotation.*;
public interface PropertyNamer {
/**
+ * Represents a non-existent class.
+ */
+ public interface Null extends PropertyNamer {}
+
+ /**
* Convert the specified default property name to some other value.
*
* @param name The original bean property name.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfig.java
new file mode 100644
index 0000000..0c61cf4
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfig.java
@@ -0,0 +1,1057 @@
+// ***************************************************************************************************************************
+// * 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.annotation;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static org.apache.juneau.BeanTraverseContext.*;
+
+import java.io.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.transform.*;
+
+/**
+ * Annotation for specifying config properties defined in {@link BeanContext} and {@link BeanTraverseContext}.
+ *
+ * <p>
+ * Used primarily for specifying bean configuration properties on REST classes and methods.
+ */
+@Documented
+@Target(TYPE)
+@Retention(RUNTIME)
+@Inherited
+public @interface BeanConfig {
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // BeanContext
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Configuration property: Minimum bean class visibility.
+ *
+ * <p>
+ * Classes are not considered beans unless they meet the minimum visibility requirements.
+ *
+ * <p>
+ * For example, if the visibility is <code>PUBLIC</code> and the bean class is <jk>protected</jk>, then the class
+ * will not be interpreted as a bean class and be serialized as a string.
+ * <br>Use this setting to reduce the visibility requirement.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"PUBLIC"</js> (default)
+ * <li><js>"PROTECTED"</js>
+ * <li><js>"DEFAULT"</js>
+ * <li><js>"PRIVATE"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanClassVisibility}
+ * </ul>
+ */
+ String beanClassVisibility() default "";
+
+ /**
+ * Configuration property: Minimum bean constructor visibility.
+ *
+ * <p>
+ * Only look for constructors with the specified minimum visibility.
+ *
+ * <p>
+ * This setting affects the logic for finding no-arg constructors for bean.
+ * <br>Normally, only <jk>public</jk> no-arg constructors are used.
+ * <br>Use this setting if you want to reduce the visibility requirement.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"PUBLIC"</js> (default)
+ * <li><js>"PROTECTED"</js>
+ * <li><js>"DEFAULT"</js>
+ * <li><js>"PRIVATE"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanConstructorVisibility}
+ * </ul>
+ */
+ String beanConstructorVisibility() default "";
+
+ /**
+ * Configuration property: Bean dictionary.
+ *
+ * <p>
+ * The list of classes that make up the bean dictionary in this bean context.
+ *
+ * <p>
+ * A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred
+ * through reflection.
+ * <br>The names are defined through the {@link Bean#typeName() @Bean(typeName)} annotation defined on the bean class.
+ * <br>For example, if a class <code>Foo</code> has a type-name of <js>"myfoo"</js>, then it would end up serialized
+ * as <js>"{_type:'myfoo',...}"</js>.
+ *
+ * <p>
+ * This setting tells the parsers which classes to look for when resolving <js>"_type"</js> attributes.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
+ * <li class='link'>{@doc juneau-marshall.BeanDictionaries}
+ * </ul>
+ */
+ Class<?>[] beanDictionary() default {};
+
+ /**
+ * Configuration property: Add to bean dictionary.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanDictionary}
+ * </ul>
+ */
+ Class<?>[] beanDictionary_replace() default {};
+
+ /**
+ * Configuration property: Remove from bean dictionary.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanDictionary_remove}
+ * </ul>
+ */
+ Class<?>[] beanDictionary_remove() default {};
+
+ /**
+ * Configuration property: Minimum bean field visibility.
+ *
+ * <p>
+ * Only look for bean fields with the specified minimum visibility.
+ *
+ * <p>
+ * This affects which fields on a bean class are considered bean properties.
+ * <br>Normally only <jk>public</jk> fields are considered.
+ * <br>Use this setting if you want to reduce the visibility requirement.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"PUBLIC"</js> (default)
+ * <li><js>"PROTECTED"</js>
+ * <li><js>"DEFAULT"</js>
+ * <li><js>"PRIVATE"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanFieldVisibility}
+ * </ul>
+ */
+ String beanFieldVisibility() default "";
+
+ /**
+ * Configuration property: Bean filters.
+ *
+ * <p>
+ * This is a programmatic equivalent to the {@link Bean @Bean} annotation.
+ * <br>It's useful when you want to use the <code>@Bean</code> annotation functionality, but you don't have the ability to alter
+ * the bean classes.
+ *
+ * <p>
+ * Values can consist of any of the following types:
+ * <ul class='spaced-list'>
+ * <li>Any subclass of {@link BeanFilterBuilder}.
+ * <br>These must have a public no-arg constructor.
+ * <li>Any bean interfaces.
+ * <br>A shortcut for defining a {@link InterfaceBeanFilterBuilder}.
+ * <br>Any subclasses of an interface class will only have properties defined on the interface.
+ * All other bean properties will be ignored.
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanFilters}
+ * <li class='link'>{@doc juneau-marshall.Transforms.BeanFilters}
+ * <li class='link'>{@doc juneau-marshall.Transforms.InterfaceFilters}
+ * </ul>
+ */
+ Class<?>[] beanFilters() default {};
+
+ /**
+ * Configuration property: Add to bean filters.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanFilters}
+ * </ul>
+ */
+ Class<?>[] beanFilters_replace() default {};
+
+ /**
+ * Configuration property: Remove from bean filters.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanFilters_remove}
+ * </ul>
+ */
+ Class<?>[] beanFilters_remove() default {};
+
+ /**
+ * Configuration property: BeanMap.put() returns old property value.
+ *
+ * <p>
+ * If <js>"true"</js>, then the {@link BeanMap#put(String,Object) BeanMap.put()} method will return old property
+ * values.
+ * <br>Otherwise, it returns <jk>null</jk>.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default because it introduces a slight performance penalty during serialization)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanMapPutReturnsOldValue}
+ * </ul>
+ */
+ String beanMapPutReturnsOldValue() default "";
+
+ /**
+ * Configuration property: Minimum bean method visibility.
+ *
+ * <p>
+ * Only look for bean methods with the specified minimum visibility.
+ *
+ * <p>
+ * This affects which methods are detected as getters and setters on a bean class.
+ * <br>Normally only <jk>public</jk> getters and setters are considered.
+ * <br>Use this setting if you want to reduce the visibility requirement.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"PUBLIC"</js> (default)
+ * <li><js>"PROTECTED"</js>
+ * <li><js>"DEFAULT"</js>
+ * <li><js>"PRIVATE"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanMethodVisibility}
+ * </ul>
+ */
+ String beanMethodVisibility() default "";
+
+ /**
+ * Configuration property: Beans require no-arg constructors.
+ *
+ * <p>
+ * If <js>"true"</js>, a Java class must implement a default no-arg constructor to be considered a bean.
+ * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <p>
+ * The {@link Bean @Bean} annotation can be used on a class to override this setting when <js>"true"</js>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beansRequireDefaultConstructor}
+ * </ul>
+ */
+ String beansRequireDefaultConstructor() default "";
+
+ /**
+ * Configuration property: Beans require Serializable interface.
+ *
+ * <p>
+ * If <js>"true"</js>, a Java class must implement the {@link Serializable} interface to be considered a bean.
+ * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <p>
+ * The {@link Bean @Bean} annotation can be used on a class to override this setting when <js>"true"</js>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beansRequireSerializable}
+ * </ul>
+ */
+ String beansRequireSerializable() default "";
+
+ /**
+ * Configuration property: Beans require setters for getters.
+ *
+ * <p>
+ * If <js>"true"</js>, only getters that have equivalent setters will be considered as properties on a bean.
+ * <br>Otherwise, they will be ignored.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beansRequireSettersForGetters}
+ * </ul>
+ */
+ String beansRequireSettersForGetters() default "";
+
+ /**
+ * Configuration property: Beans require at least one property.
+ *
+ * <p>
+ * If <js>"true"</js>, then a Java class must contain at least 1 property to be considered a bean.
+ * <br>Otherwise, the bean will be serialized as a string using the {@link Object#toString()} method.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js> (default)
+ * <li><js>"false"</js>
+ * </ul>
+ *
+ * <p>
+ * The {@link Bean @Bean} annotation can be used on a class to override this setting when <js>"true"</js>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beansRequireSomeProperties}
+ * </ul>
+ */
+ String beansRequireSomeProperties() default "";
+
+ /**
+ * Configuration property: Bean type property name.
+ *
+ * <p>
+ * This specifies the name of the bean property used to store the dictionary name of a bean type so that the
+ * parser knows the data type to reconstruct.
+ *
+ * <p>
+ * The default value is <js>"_type"</js>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_beanTypePropertyName}
+ * </ul>
+ */
+ String beanTypePropertyName() default "";
+
+ /**
+ * Configuration property: Debug mode.
+ *
+ * <p>
+ * Enables the following additional information during serialization:
+ * <ul class='spaced-list'>
+ * <li>
+ * When bean getters throws exceptions, the exception includes the object stack information
+ * in order to determine how that method was invoked.
+ * <li>
+ * Enables {@link Serializer#BEANTRAVERSE_detectRecursions}.
+ * </ul>
+ *
+ * <p>
+ * Enables the following additional information during parsing:
+ * <ul class='spaced-list'>
+ * <li>
+ * When bean setters throws exceptions, the exception includes the object stack information
+ * in order to determine how that method was invoked.
+ * </ul>
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_debug}
+ * </ul>
+ */
+ String debug() default "";
+
+ /**
+ * Configuration property: POJO examples.
+ *
+ * <p>
+ * Specifies an example of the specified class.
+ *
+ * <p>
+ * Examples are used in cases such as POJO examples in Swagger documents.
+ *
+ * <p>
+ * Setting applies to specified class and all subclasses.
+ *
+ * <p>
+ * Keys are the class of the example.
+ * <br>Values are Simple-JSON representation of that class.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode w800'>
+ * <ja>@BeanConfig</ja>(
+ * examples={
+ * <ja>@CSEntry</ja>(key=MyBean.<jk>class</jk>, value=<js>"{foo:'bar'}"</js>)
+ * }
+ * )
+ * <p>
+ *
+ * POJO examples can also be defined on classes via the following:
+ * <ul class='spaced-list'>
+ * <li>A static field annotated with {@link Example @Example}.
+ * <li>A static method annotated with {@link Example @Example} with zero arguments or one {@link BeanSession} argument.
+ * <li>A static method with name <code>example</code> with no arguments or one {@link BeanSession} argument.
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_examples}
+ * </ul>
+ */
+ CSEntry[] examples() default {};
+
+ /**
+ * Configuration property: Bean property excludes.
+ *
+ * <p>
+ * Specifies to exclude the specified list of properties for the specified bean class.
+ *
+ * <p>
+ * Keys are the class applied to.
+ * <br>Values are comma-delimited lists of property names.
+ *
+ * <p>
+ * Setting applies to specified class and all subclasses.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode w800'>
+ * <ja>@BeanConfig</ja>(
+ * excludeProperties={
+ * <ja>@CSEntry</ja>(key=MyBean.<jk>class</jk>, value=<js>"foo,bar"</js>)
+ * }
+ * )
+ * <p>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_excludeProperties}
+ * </ul>
+ */
+ CSEntry[] excludeProperties() default {};
+
+ /**
+ * Configuration property: Find fluent setters.
+ *
+ * <p>
+ * When enabled, fluent setters are detected on beans.
+ *
+ * <p>
+ * Fluent setters must have the following attributes:
+ * <ul>
+ * <li>Public.
+ * <li>Not static.
+ * <li>Take in one parameter.
+ * <li>Return the bean itself.
+ * </ul>
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_fluentSetters}
+ * </ul>
+ */
+ String fluentSetters() default "";
+
+ /**
+ * Configuration property: Ignore invocation errors on getters.
+ *
+ * <p>
+ * If <js>"true"</js>, errors thrown when calling bean getter methods will silently be ignored.
+ * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnGetters}
+ * </ul>
+ */
+ String ignoreInvocationExceptionsOnGetters() default "";
+
+ /**
+ * Configuration property: Ignore invocation errors on setters.
+ *
+ * <p>
+ * If <js>"true"</js>, errors thrown when calling bean setter methods will silently be ignored.
+ * <br>Otherwise, a {@code BeanRuntimeException} is thrown.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_ignoreInvocationExceptionsOnSetters}
+ * </ul>
+ */
+ String ignoreInvocationExceptionsOnSetters() default "";
+
+ /**
+ * Configuration property: Ignore properties without setters.
+ *
+ * <p>
+ * If <js>"true"</js>, trying to set a value on a bean property without a setter will silently be ignored.
+ * <br>Otherwise, a {@code RuntimeException} is thrown.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js> (default)
+ * <li><js>"false"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_ignorePropertiesWithoutSetters}
+ * </ul>
+ */
+ String ignorePropertiesWithoutSetters() default "";
+
+ /**
+ * Configuration property: Ignore unknown properties.
+ *
+ * <p>
+ * If <js>"true"</js>, trying to set a value on a non-existent bean property will silently be ignored.
+ * <br>Otherwise, a {@code RuntimeException} is thrown.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownBeanProperties}
+ * </ul>
+ */
+ String ignoreUnknownBeanProperties() default "";
+
+ /**
+ * Configuration property: Ignore unknown properties with null values.
+ *
+ * <p>
+ * If <js>"true"</js>, trying to set a <jk>null</jk> value on a non-existent bean property will silently be ignored.
+ * <br>Otherwise, a {@code RuntimeException} is thrown.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js> (default)
+ * <li><js>"false"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_ignoreUnknownNullBeanProperties}
+ * </ul>
+ */
+ String ignoreUnknownNullBeanProperties() default "";
+
+ /**
+ * Configuration property: Implementation classes.
+ *
+ * <p>
+ * For interfaces and abstract classes this method can be used to specify an implementation class for the
+ * interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a
+ * parse).
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode w800'>
+ * <ja>@BeanConfig</ja>(
+ * implClasses={
+ * <ja>@CCEntry</ja>(key=MyInterface.<jk>class</jk>, value=MyInterfaceImpl.<jk>class</jk>)
+ * }
+ * )
+ * <p>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_implClasses}
+ * </ul>
+ */
+ CCEntry[] implClasses() default {};
+
+ /**
+ * Configuration property: Bean property includes.
+ *
+ * <p>
+ * Specifies the set and order of names of properties associated with the bean class.
+ *
+ * <p>
+ * Keys are the class applied to.
+ * <br>Values are comma-delimited lists of property names.
+ *
+ * <p>
+ * Setting applies to specified class and all subclasses.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode w800'>
+ * <ja>@BeanConfig</ja>(
+ * includeProperties={
+ * <ja>@CSEntry</ja>(key=MyBean.<jk>class</jk>, value=<js>"foo,bar"</js>)
+ * }
+ * )
+ * <p>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_includeProperties}
+ * </ul>
+ */
+ CSEntry[] includeProperties() default {};
+
+ /**
+ * Configuration property: Locale.
+ *
+ * <p>
+ * Specifies the default locale for serializer and parser sessions.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_locale}
+ * </ul>
+ */
+ String locale() default "";
+
+ /**
+ * Configuration property: Media type.
+ *
+ * <p>
+ * Specifies the default media type value for serializer and parser sessions.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_mediaType}
+ * </ul>
+ */
+ String mediaType() default "";
+
+ /**
+ * Configuration property: Bean class exclusions.
+ *
+ * <p>
+ * List of classes that should not be treated as beans even if they appear to be bean-like.
+ * <br>Not-bean classes are converted to <code>Strings</code> during serialization.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
+ * </ul>
+ */
+ Class<?>[] notBeanClasses() default {};
+
+ /**
+ * Configuration property: Add to classes that should not be considered beans.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
+ * </ul>
+ */
+ Class<?>[] notBeanClasses_replace() default {};
+
+ /**
+ * Configuration property: Remove from classes that should not be considered beans.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
+ * </ul>
+ */
+ Class<?>[] notBeanClasses_remove() default {};
+
+ /**
+ * Configuration property: Bean package exclusions.
+ *
+ * <p>
+ * When specified, the current list of ignore packages are appended to.
+ *
+ * <p>
+ * Any classes within these packages will be serialized to strings using {@link Object#toString()}.
+ *
+ * <p>
+ * Note that you can specify suffix patterns to include all subpackages.
+ *
+ * <p>
+ * The default value excludes the following packages:
+ * <ul>
+ * <li><code>java.lang</code>
+ * <li><code>java.lang.annotation</code>
+ * <li><code>java.lang.ref</code>
+ * <li><code>java.lang.reflect</code>
+ * <li><code>java.io</code>
+ * <li><code>java.net</code>
+ * <li><code>java.nio.*</code>
+ * <li><code>java.util.*</code>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanClasses}
+ * </ul>
+ */
+ String[] notBeanPackages() default {};
+
+ /**
+ * Configuration property: Add to packages whose classes should not be considered beans.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
+ * </ul>
+ */
+ String[] notBeanPackages_replace() default {};
+
+ /**
+ * Configuration property: Remove from packages whose classes should not be considered beans.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_notBeanPackages}
+ * </ul>
+ */
+ String[] notBeanPackages_remove() default {};
+
+ /**
+ * Configuration property: POJO swaps.
+ *
+ * <p>
+ * POJO swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization,
+ * and "swap in" the non-serializable class during parsing.
+ *
+ * <p>
+ * An example of a POJO swap would be a <code>Calendar</code> object that gets swapped out for an ISO8601 string.
+ *
+ * <p>
+ * Multiple POJO swaps can be associated with a single class.
+ * <br>When multiple swaps are applicable to the same class, the media type pattern defined by
+ * {@link PojoSwap#forMediaTypes()} or {@link Swap#mediaTypes() @Swap(mediaTypes)} are used to come up with the best match.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
+ * <li class='link'>{@doc juneau-marshall.Transforms.PojoSwaps}
+ * <li class='link'>{@doc juneau-marshall.Transforms.PerMediaTypePojoSwaps}
+ * <li class='link'>{@doc juneau-marshall.Transforms.OneWayPojoSwaps}
+ * <li class='link'>{@doc juneau-marshall.Transforms.SwapAnnotation}
+ * <li class='link'>{@doc juneau-marshall.Transforms.SwapMethods}
+ * <li class='link'>{@doc juneau-marshall.Transforms.SurrogateClasses}
+ * </ul>
+ */
+ Class<? extends PojoSwap<?,?>>[] pojoSwaps() default {};
+
+ /**
+ * Configuration property: Add to POJO swap classes.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
+ * </ul>
+ */
+ Class<? extends PojoSwap<?,?>>[] pojoSwaps_replace() default {};
+
+ /**
+ * Configuration property: Remove from POJO swap classes.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_pojoSwaps}
+ * </ul>
+ */
+ Class<? extends PojoSwap<?,?>>[] pojoSwaps_remove() default {};
+
+ /**
+ * Configuration property: Bean property namer.
+ *
+ * <p>
+ * The class to use for calculating bean property names.
+ *
+ * <p>
+ * Predefined classes:
+ * <ul>
+ * <li>{@link PropertyNamerDefault} (default)
+ * <li>{@link PropertyNamerDLC} - Dashed-lower-case names.
+ * <li>{@link PropertyNamerULC} - Dashed-upper-case names.
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_propertyNamer}
+ * </ul>
+ */
+ Class<? extends PropertyNamer> propertyNamer() default PropertyNamer.Null.class;
+
+ /**
+ * Configuration property: Sort bean properties.
+ *
+ * <p>
+ * When <jk>true</jk>, all bean properties will be serialized and access in alphabetical order.
+ * <br>Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor.
+ * <br>On IBM JVMs, the bean properties are ordered based on their ordering in the Java file.
+ * <br>On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs).
+ *
+ * <p>
+ * This property is disabled by default so that IBM JVM users don't have to use {@link Bean @Bean} annotations
+ * to force bean properties to be in a particular order and can just alter the order of the fields/methods
+ * in the Java file.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_sortProperties}
+ * </ul>
+ */
+ String sortProperties() default "";
+
+ /**
+ * Configuration property: Time zone.
+ *
+ * <p>
+ * Specifies the default timezone for serializer and parser sessions.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_timeZone}
+ * </ul>
+ */
+ String timeZone() default "";
+
+ /**
+ * Configuration property: Use enum names.
+ *
+ * <p>
+ * When enabled, enums are always serialized by name, not using {@link Object#toString()}.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_useEnumNames}
+ * </ul>
+ */
+ String useEnumNames() default "";
+
+ /**
+ * Configuration property: Use interface proxies.
+ *
+ * <p>
+ * If <js>"true"</js>, then interfaces will be instantiated as proxy classes through the use of an
+ * {@link InvocationHandler} if there is no other way of instantiating them.
+ * <br>Otherwise, throws a {@link BeanRuntimeException}.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js> (default)
+ * <li><js>"false"</js>
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_useInterfaceProxies}
+ * </ul>
+ */
+ String useInterfaceProxies() default "";
+
+ /**
+ * Configuration property: Use Java Introspector.
+ *
+ * <p>
+ * Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters.
+ * <br>Most {@link Bean @Bean} annotations will be ignored.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanContext#BEAN_useJavaBeanIntrospector}
+ * </ul>
+ */
+ String useJavaBeanIntrospector() default "";
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // BeanTraverseContext
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Configuration property: Automatically detect POJO recursions.
+ *
+ * <p>
+ * Specifies that recursions should be checked for during traversal.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <p>
+ * Recursions can occur when traversing models that aren't true trees but rather contain loops.
+ * <br>In general, unchecked recursions cause stack-overflow-errors.
+ * <br>These show up as {@link ParseException ParseExceptions} with the message <js>"Depth too deep. Stack overflow occurred."</js>.
+ *
+ * <p>
+ * The behavior when recursions are detected depends on the value for {@link #BEANTRAVERSE_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>BEANTRAVERSE_ignoreRecursions</jsf> is <jk>true</jk>...
+ *
+ * <p class='bcode w800'>
+ * {A:{B:{C:<jk>null</jk>}}}
+ * </p>
+ *
+ * <h5 class='section'>Notes:</h5>
+ * <ul class='spaced-list'>
+ * <li>
+ * Checking for recursion can cause a small performance penalty.
+ * </ul>
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_detectRecursions}
+ * </ul>
+ */
+ String detectRecursions() default "";
+
+ /**
+ * Configuration property: Ignore recursion errors.
+ *
+ * <p>
+ * Used in conjunction with {@link #BEANTRAVERSE_detectRecursions}.
+ * <br>Setting is ignored if <jsf>BEANTRAVERSE_detectRecursions</jsf> is <js>"false"</js>.
+ *
+ * <p>
+ * Possible values:
+ * <ul>
+ * <li><js>"true"</js>
+ * <li><js>"false"</js> (default)
+ * </ul>
+ *
+ * <p>
+ * If <js>"true"</js>, when we encounter the same object when traversing a tree, we set the value to <jk>null</jk>.
+ * <br>Otherwise, a {@link BeanRecursionException} is thrown with the message <js>"Recursion occurred, stack=..."</js>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_ignoreRecursions}
+ * </ul>
+ */
+ String ignoreRecursions() default "";
+
+ /**
+ * Configuration property: Initial depth.
+ *
+ * <p>
+ * The initial indentation level at the root.
+ * <br>Useful when constructing document fragments that need to be indented at a certain level.
+ *
+ * <p>
+ * Format is an integer.
+ * <br>The default value is <js>"0"</js>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_initialDepth}
+ * </ul>
+ */
+ String initialDepth() default "";
+
+ /**
+ * Configuration property: Max traversal depth.
+ *
+ * <p>
+ * Abort traversal if specified depth is reached in the POJO tree.
+ * <br>If this depth is exceeded, an exception is thrown.
+ *
+ * <p>
+ * Format is an integer.
+ * <br>The default value is <js>"100"</js>.
+ *
+ * <h5 class='section'>See Also:</h5>
+ * <ul>
+ * <li class='jf'>{@link BeanTraverseContext#BEANTRAVERSE_maxDepth}
+ * </ul>
+ */
+ String maxDepth() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/CCEntry.java
similarity index 69%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
copy to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/CCEntry.java
index 8e7b2c4..1639f98 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/CCEntry.java
@@ -10,38 +10,16 @@
// * "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.jsonschema;
-
-import java.net.*;
-
-import org.apache.juneau.*;
+package org.apache.juneau.annotation;
/**
- * Interface used to retrieve identifiers and URIs for bean classes.
+ * Represents a Class-to-Class mapping.
*/
-public interface BeanDefMapper {
-
- /**
- * Returns the ID for the specified class.
- *
- * @param cm The class.
- * @return The ID for the specified class.
- */
- String getId(ClassMeta<?> cm);
+public @interface CCEntry {
- /**
- * Returns the URI for the specified class.
- *
- * @param cm The class.
- * @return The URI for the specified class.
- */
- URI getURI(ClassMeta<?> cm);
+ /** The Class key */
+ public Class<?> key();
- /**
- * Returns the URI for the specified class by its ID.
- *
- * @param id The class ID.
- * @return The URI for the specified class.
- */
- URI getURI(String id);
+ /** The Class value */
+ public Class<?> value();
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/CSEntry.java
similarity index 69%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
copy to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/CSEntry.java
index 8e7b2c4..9e8ee71 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/CSEntry.java
@@ -10,38 +10,16 @@
// * "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.jsonschema;
-
-import java.net.*;
-
-import org.apache.juneau.*;
+package org.apache.juneau.annotation;
/**
- * Interface used to retrieve identifiers and URIs for bean classes.
+ * Represents a Class-to-String mapping.
*/
-public interface BeanDefMapper {
-
- /**
- * Returns the ID for the specified class.
- *
- * @param cm The class.
- * @return The ID for the specified class.
- */
- String getId(ClassMeta<?> cm);
+public @interface CSEntry {
- /**
- * Returns the URI for the specified class.
- *
- * @param cm The class.
- * @return The URI for the specified class.
- */
- URI getURI(ClassMeta<?> cm);
+ /** The Class key */
+ public Class<?> key();
- /**
- * Returns the URI for the specified class by its ID.
- *
- * @param id The class ID.
- * @return The URI for the specified class.
- */
- URI getURI(String id);
+ /** The String value */
+ public String value();
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SCEntry.java
similarity index 69%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
copy to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SCEntry.java
index 8e7b2c4..f4e1a9c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SCEntry.java
@@ -10,38 +10,16 @@
// * "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.jsonschema;
-
-import java.net.*;
-
-import org.apache.juneau.*;
+package org.apache.juneau.annotation;
/**
- * Interface used to retrieve identifiers and URIs for bean classes.
+ * Represents a String-to-Class mapping.
*/
-public interface BeanDefMapper {
-
- /**
- * Returns the ID for the specified class.
- *
- * @param cm The class.
- * @return The ID for the specified class.
- */
- String getId(ClassMeta<?> cm);
+public @interface SCEntry {
- /**
- * Returns the URI for the specified class.
- *
- * @param cm The class.
- * @return The URI for the specified class.
- */
- URI getURI(ClassMeta<?> cm);
+ /** The String key */
+ public String key();
- /**
- * Returns the URI for the specified class by its ID.
- *
- * @param id The class ID.
- * @return The URI for the specified class.
- */
- URI getURI(String id);
+ /** The Class value */
+ public Class<?> value();
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SSEntry.java
similarity index 69%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
copy to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SSEntry.java
index 8e7b2c4..478d42a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SSEntry.java
@@ -10,38 +10,16 @@
// * "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.jsonschema;
-
-import java.net.*;
-
-import org.apache.juneau.*;
+package org.apache.juneau.annotation;
/**
- * Interface used to retrieve identifiers and URIs for bean classes.
+ * Represents a String-to-String mapping.
*/
-public interface BeanDefMapper {
-
- /**
- * Returns the ID for the specified class.
- *
- * @param cm The class.
- * @return The ID for the specified class.
- */
- String getId(ClassMeta<?> cm);
+public @interface SSEntry {
- /**
- * Returns the URI for the specified class.
- *
- * @param cm The class.
- * @return The URI for the specified class.
- */
- URI getURI(ClassMeta<?> cm);
+ /** The String key */
+ public String key();
- /**
- * Returns the URI for the specified class by its ID.
- *
- * @param id The class ID.
- * @return The URI for the specified class.
- */
- URI getURI(String id);
+ /** The String value */
+ public String value();
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserBuilder.java
index a588725..5dc6867 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParserBuilder.java
@@ -17,6 +17,8 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
/**
* Builder class for building instances of CSV parsers.
@@ -45,6 +47,16 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
//-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public CsvParserBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ return this;
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
// Properties
//-----------------------------------------------------------------------------------------------------------------
@@ -133,38 +145,44 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public CsvParserBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder beanDictionary(Class<?>...values) {
+ public CsvParserBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public CsvParserBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder beanDictionaryRemove(Object...values) {
+ public CsvParserBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public CsvParserBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public CsvParserBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -181,6 +199,24 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public CsvParserBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvParserBuilder beanFiltersRemove(Object...values) {
super.beanFiltersRemove(values);
return this;
@@ -265,6 +301,12 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> CsvParserBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvParserBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -313,7 +355,7 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public <T> CsvParserBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public CsvParserBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -337,32 +379,38 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
+ public CsvParserBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder notBeanClasses(Class<?>...values) {
+ public CsvParserBuilder notBeanClasses(Object...values) {
super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
+ public CsvParserBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder notBeanClassesRemove(Object...values) {
+ public CsvParserBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder notBeanClassesRemove(Class<?>...values) {
super.notBeanClassesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public CsvParserBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
return this;
}
@@ -379,14 +427,26 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder notBeanPackagesRemove(Object...values) {
+ public CsvParserBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvParserBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public CsvParserBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -403,6 +463,24 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public CsvParserBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvParserBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvParserBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -427,6 +505,12 @@ public class CsvParserBuilder extends ReaderParserBuilder {
}
@Override /* BeanContextBuilder */
+ public CsvParserBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvParserBuilder useEnumNames() {
super.useEnumNames();
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerBuilder.java
index 174047e..e96bd39 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializerBuilder.java
@@ -16,7 +16,10 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
/**
* Builder class for building instances of CSV serializers.
@@ -44,6 +47,15 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
return build(CsvSerializer.class);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public CsvSerializerBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ return this;
+ }
//-----------------------------------------------------------------------------------------------------------------
// Properties
@@ -247,38 +259,44 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public CsvSerializerBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder beanDictionary(Class<?>...values) {
+ public CsvSerializerBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public CsvSerializerBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder beanDictionaryRemove(Object...values) {
+ public CsvSerializerBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public CsvSerializerBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public CsvSerializerBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -295,6 +313,24 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public CsvSerializerBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvSerializerBuilder beanFiltersRemove(Object...values) {
super.beanFiltersRemove(values);
return this;
@@ -379,6 +415,12 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> CsvSerializerBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -427,7 +469,7 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public <T> CsvSerializerBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public CsvSerializerBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -451,32 +493,38 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
+ public CsvSerializerBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder notBeanClasses(Class<?>...values) {
+ public CsvSerializerBuilder notBeanClasses(Object...values) {
super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
+ public CsvSerializerBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder notBeanClassesRemove(Object...values) {
+ public CsvSerializerBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder notBeanClassesRemove(Class<?>...values) {
super.notBeanClassesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public CsvSerializerBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
return this;
}
@@ -493,14 +541,26 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder notBeanPackagesRemove(Object...values) {
+ public CsvSerializerBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public CsvSerializerBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public CsvSerializerBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -517,6 +577,24 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public CsvSerializerBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public CsvSerializerBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvSerializerBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -541,6 +619,12 @@ public class CsvSerializerBuilder extends WriterSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public CsvSerializerBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public CsvSerializerBuilder useEnumNames() {
super.useEnumNames();
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfig.java
similarity index 69%
copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
copy to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfig.java
index 8e7b2c4..a76304d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/BeanDefMapper.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfig.java
@@ -10,38 +10,23 @@
// * "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.jsonschema;
+package org.apache.juneau.csv.annotation;
-import java.net.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import org.apache.juneau.*;
+import java.lang.annotation.*;
+
+import org.apache.juneau.csv.*;
/**
- * Interface used to retrieve identifiers and URIs for bean classes.
+ * Annotation for specifying config properties defined in {@link CsvSerializer} and {@link CsvParser}.
+ *
+ * <p>
+ * Used primarily for specifying bean configuration properties on REST classes and methods.
*/
-public interface BeanDefMapper {
-
- /**
- * Returns the ID for the specified class.
- *
- * @param cm The class.
- * @return The ID for the specified class.
- */
- String getId(ClassMeta<?> cm);
-
- /**
- * Returns the URI for the specified class.
- *
- * @param cm The class.
- * @return The URI for the specified class.
- */
- URI getURI(ClassMeta<?> cm);
-
- /**
- * Returns the URI for the specified class by its ID.
- *
- * @param id The class ID.
- * @return The URI for the specified class.
- */
- URI getURI(String id);
-}
+@Documented
+@Target(TYPE)
+@Retention(RUNTIME)
+@Inherited
+public @interface CsvConfig {}
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 ef7eea5..140ba96 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
@@ -574,6 +574,27 @@ public class HtmlDocSerializer extends HtmlStrippedDocSerializer {
template = getInstanceProperty(HTMLDOC_template, HtmlDocTemplate.class, BasicHtmlDocTemplate.class);
}
+ @Override /* Context */
+ public HtmlDocSerializerBuilder builder() {
+ return new HtmlDocSerializerBuilder(getPropertyStore());
+ }
+
+ /**
+ * Instantiates a new clean-slate {@link HtmlDocSerializerBuilder} object.
+ *
+ * <p>
+ * This is equivalent to simply calling <code><jk>new</jk> HtmlDocSerializerBuilder()</code>.
+ *
+ * <p>
+ * Note that this method creates a builder initialized to all default settings, whereas {@link #builder()} copies
+ * the settings of the object called on.
+ *
+ * @return A new {@link HtmlDocSerializerBuilder} object.
+ */
+ public static HtmlDocSerializerBuilder create() {
+ return new HtmlDocSerializerBuilder();
+ }
+
@Override /* Serializer */
public HtmlDocSerializerSession createSession(SerializerSessionArgs args) {
return new HtmlDocSerializerSession(this, args);
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerBuilder.java
new file mode 100644
index 0000000..53266a1
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocSerializerBuilder.java
@@ -0,0 +1,1172 @@
+// ***************************************************************************************************************************
+// * 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.html;
+
+import static org.apache.juneau.html.HtmlDocSerializer.*;
+
+import java.util.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.html.annotation.*;
+import org.apache.juneau.http.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
+import org.apache.juneau.xml.*;
+
+/**
+ * Builder class for building instances of HTML Doc serializers.
+ */
+public class HtmlDocSerializerBuilder extends HtmlStrippedDocSerializerBuilder {
+
+ /**
+ * Constructor, default settings.
+ */
+ public HtmlDocSerializerBuilder() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param ps The initial configuration settings for this builder.
+ */
+ public HtmlDocSerializerBuilder(PropertyStore ps) {
+ super(ps);
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializer build() {
+ return build(HtmlDocSerializer.class);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public HtmlDocSerializerBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ if (! m.containsKey(HtmlDocConfig.class))
+ return this;
+ ObjectResolver r = new ObjectResolver(sr);
+ for (HtmlDocConfig a : m.get(HtmlDocConfig.class)) {
+ if (a.aside().length > 0)
+ aside(r.strings(a.aside()));
+ if (a.footer().length > 0)
+ footer(r.strings(a.footer()));
+ if (a.head().length > 0)
+ head(r.strings(a.head()));
+ if (a.header().length > 0)
+ header(r.strings(a.header()));
+ if (a.nav().length > 0)
+ nav(r.strings(a.nav()));
+ if (a.navlinks().length > 0)
+ navlinks(r.strings(a.navlinks()));
+ if (a.navlinks_replace().length > 0)
+ navlinks_replace(r.strings(a.navlinks_replace()));
+ if (! a.noResultsMessage().isEmpty())
+ noResultsMessage(r.string(a.noResultsMessage()));
+ if (! a.nowrap().isEmpty())
+ nowrap(r.bool(a.nowrap()));
+ if (a.script().length > 0)
+ script(r.strings(a.script()));
+ if (a.script_replace().length > 0)
+ script_replace(r.strings(a.script_replace()));
+ if (a.style().length > 0)
+ style(r.strings(a.style()));
+ if (a.style_replace().length > 0)
+ style_replace(r.strings(a.style_replace()));
+ if (a.stylesheet().length > 0)
+ stylesheet(r.strings(a.stylesheet()));
+ if (a.stylesheet_replace().length > 0)
+ stylesheet_replace
+ (r.strings(a.stylesheet_replace()));
+ if (a.template() != HtmlDocTemplate.Null.class)
+ template(a.template());
+ }
+ return this;
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Properties
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Configuration property: Aside section contents.
+ *
+ * <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 w800'>
+ * <ja>@HtmlDocConfig</ja>(
+ * aside={
+ * <js>"<ul>"</js>,
+ * <js>" <li>Item 1"</js>,
+ * <js>" <li>Item 2"</js>,
+ * <js>" <li>Item 3"</js>,
+ * <js>"</ul>"</js>
+ * }
+ * )
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder aside(String[] value) {
+ set(HTMLDOC_aside, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Footer section contents.
+ *
+ * <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 w800'>
+ * <ja>@HtmlDocConfig</ja>(
+ * footer={
+ * <js>"<b>This interface is great!</b>"</js>
+ * }
+ * )
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder footer(String[] value) {
+ set(HTMLDOC_footer, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Additional head section content.
+ *
+ * <p>
+ * Adds the specified HTML content to the head section of the page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode w800'>
+ * <ja>@HtmlDoc</ja>(
+ * head={
+ * <js>"<link rel='icon' href='$U{servlet:/htdocs/mypageicon.ico}'>"</js>
+ * }
+ * )
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder head(String[] value) {
+ set(HTMLDOC_head, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Header section contents.
+ *
+ * <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 w800'>
+ * <ja>@HtmlDocConfig</ja>(
+ * header={
+ * <js>"<h1>My own header</h1>"</js>
+ * }
+ * )
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder header(String[] value) {
+ set(HTMLDOC_header, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Nav section contents.
+ *
+ * <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 w800'>
+ * <ja>@HtmlDocConfig</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.
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder nav(String[] value) {
+ set(HTMLDOC_nav, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Page navigation links.
+ *
+ * <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>
+ * <ja>@HtmlDocConfig</ja>(
+ * navlinks={
+ * <js>"options: ?method=OPTIONS"</js>,
+ * <js>"doc: doc"</js>
+ * }
+ * )
+ * <jk>public class</jk> AddressBookResource <jk>extends</jk> BasicRestServletJena {
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder navlinks_replace(String[] value) {
+ set(HTMLDOC_navlinks, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Add to the {@link #HTMLDOC_navlinks} property.
+ *
+ * @param value
+ * The value to add to this property.
+ */
+ private HtmlDocSerializerBuilder navlinks(String[] value) {
+ set(HTMLDOC_navlinks_add, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: No-results message.
+ *
+ * <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 w800'>
+ * <ja>@HtmlDocConfig</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.
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder noResultsMessage(String value) {
+ set(HTMLDOC_noResultsMessage, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Prevent word wrap on page.
+ *
+ * <p>
+ * Adds <js>"* {white-space:nowrap}"</js> to the CSS instructions on the page to prevent word wrapping.
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder nowrap(boolean value) {
+ set(HTMLDOC_nowrap, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Javascript code.
+ *
+ * <p>
+ * Adds the specified Javascript code to the HTML page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode w800'>
+ * <ja>@HtmlDocConfig</ja>(
+ * script={
+ * <js>"alert('hello!');"</js>
+ * }
+ * )
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder script_replace(String[] value) {
+ set(HTMLDOC_script, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Add to the {@link #HTMLDOC_script} property.
+ *
+ * @param value
+ * The value to add to this property.
+ */
+ private HtmlDocSerializerBuilder script(String[] value) {
+ set(HTMLDOC_script_add, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: CSS style code.
+ *
+ * <p>
+ * Adds the specified CSS instructions to the HTML page.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode w800'>
+ * <ja>@HtmlDocConfig</ja>(
+ * style={
+ * <js>"h3 { color: red; }"</js>,
+ * <js>"h5 { font-weight: bold; }"</js>
+ * }
+ * )
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder style_replace(String[] value) {
+ set(HTMLDOC_style, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Add to the {@link #HTMLDOC_style} property.
+ *
+ * @param value
+ * The value to add to this property.
+ */
+ private HtmlDocSerializerBuilder style(String[] value) {
+ set(HTMLDOC_style_add, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Stylesheet import URLs.
+ *
+ * <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.
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder stylesheet_replace(String[] value) {
+ set(HTMLDOC_stylesheet, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: Add to the {@link #HTMLDOC_stylesheet} property.
+ *
+ * @param value
+ * The value to add to this property.
+ */
+ private HtmlDocSerializerBuilder stylesheet(String[] value) {
+ set(HTMLDOC_stylesheet_add, value);
+ return this;
+ }
+
+ /**
+ * Configuration property: HTML document template.
+ *
+ * <p>
+ * Specifies the template to use for serializing the page.
+ *
+ * <p>
+ * By default, the {@link BasicHtmlDocTemplate} 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 w800'>
+ * <ja>@HtmlDocConfig</ja>(
+ * template=MySpecialDocTemplate.<jk>class</jk>
+ * )
+ * </p>
+ *
+ * @param value
+ * The new value for this property.
+ */
+ private HtmlDocSerializerBuilder template(Class<?> value) {
+ set(HTMLDOC_template, value);
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder addKeyValueTableHeaders(boolean value) {
+ super.addKeyValueTableHeaders(value);
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder addKeyValueTableHeaders() {
+ super.addKeyValueTableHeaders();
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder detectLinksInStrings(boolean value) {
+ super.detectLinksInStrings(value);
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder labelParameter(String value) {
+ super.labelParameter(value);
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder detectLabelParameters(boolean value) {
+ super.detectLabelParameters(value);
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder uriAnchorText(AnchorText value) {
+ super.uriAnchorText(value);
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder uriAnchorText(String value) {
+ super.uriAnchorText(value);
+ return this;
+ }
+
+ @Override /* HtmlSerializerBuilder */
+ public HtmlDocSerializerBuilder addNamespaceUrisToRoot(boolean value) {
+ super.addNamespaceUrisToRoot(value);
+ return this;
+ }
+
+ @Override /* XmlSerializerBuilder */
+ public HtmlDocSerializerBuilder addNamespaceUrisToRoot() {
+ super.addNamespaceUrisToRoot();
+ return this;
+ }
+
+ @Override /* XmlSerializerBuilder */
+ public HtmlDocSerializerBuilder autoDetectNamespaces(boolean value) {
+ super.autoDetectNamespaces(value);
+ return this;
+ }
+
+ @Override /* XmlSerializerBuilder */
+ public HtmlDocSerializerBuilder defaultNamespace(String value) {
+ super.defaultNamespace(value);
+ return this;
+ }
+
+ @Override /* XmlSerializerBuilder */
+ public HtmlDocSerializerBuilder enableNamespaces(boolean value) {
+ super.enableNamespaces(value);
+ return this;
+ }
+
+ @Override /* XmlSerializerBuilder */
+ public HtmlDocSerializerBuilder namespaces(Namespace...values) {
+ super.namespaces(values);
+ return this;
+ }
+
+ @Override /* XmlSerializerBuilder */
+ public HtmlDocSerializerBuilder xsNamespace(Namespace value) {
+ super.xsNamespace(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder addBeanTypes(boolean value) {
+ super.addBeanTypes(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder addBeanTypes() {
+ super.addBeanTypes();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder addRootType(boolean value) {
+ super.addRootType(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder addRootType() {
+ super.addRootType();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder detectRecursions(boolean value) {
+ super.detectRecursions(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder detectRecursions() {
+ super.detectRecursions();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder ignoreRecursions(boolean value) {
+ super.ignoreRecursions(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder ignoreRecursions() {
+ super.ignoreRecursions();
+ return this;
+ }
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder initialDepth(int value) {
+ super.initialDepth(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder listener(Class<? extends SerializerListener> value) {
+ super.listener(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder maxDepth(int value) {
+ super.maxDepth(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder maxIndent(int value) {
+ super.maxIndent(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder quoteChar(char value) {
+ super.quoteChar(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder sortCollections(boolean value) {
+ super.sortCollections(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder sortCollections() {
+ super.sortCollections();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder sortMaps(boolean value) {
+ super.sortMaps(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder sortMaps() {
+ super.sortMaps();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder sq() {
+ super.sq();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder trimEmptyCollections(boolean value) {
+ super.trimEmptyCollections(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder trimEmptyCollections() {
+ super.trimEmptyCollections();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder trimEmptyMaps(boolean value) {
+ super.trimEmptyMaps(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder trimEmptyMaps() {
+ super.trimEmptyMaps();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder trimNullProperties(boolean value) {
+ super.trimNullProperties(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder trimStrings(boolean value) {
+ super.trimStrings(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder trimStrings() {
+ super.trimStrings();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder uriContext(UriContext value) {
+ super.uriContext(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder uriRelativity(UriRelativity value) {
+ super.uriRelativity(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder uriResolution(UriResolution value) {
+ super.uriResolution(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder useWhitespace(boolean value) {
+ super.useWhitespace(value);
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder useWhitespace() {
+ super.useWhitespace();
+ return this;
+ }
+
+ @Override /* SerializerBuilder */
+ public HtmlDocSerializerBuilder ws() {
+ super.ws();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanClassVisibility(Visibility value) {
+ super.beanClassVisibility(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanConstructorVisibility(Visibility value) {
+ super.beanConstructorVisibility(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanDictionary(Object...values) {
+ super.beanDictionary(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanDictionaryRemove(Class<?>...values) {
+ super.beanDictionaryRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanFilters(Class<?>...values) {
+ super.beanFilters(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanFilters(Object...values) {
+ super.beanFilters(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanFiltersRemove(Object...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanMapPutReturnsOldValue(boolean value) {
+ super.beanMapPutReturnsOldValue(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanMapPutReturnsOldValue() {
+ super.beanMapPutReturnsOldValue();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanMethodVisibility(Visibility value) {
+ super.beanMethodVisibility(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beansRequireDefaultConstructor(boolean value) {
+ super.beansRequireDefaultConstructor(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beansRequireDefaultConstructor() {
+ super.beansRequireDefaultConstructor();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beansRequireSerializable(boolean value) {
+ super.beansRequireSerializable(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beansRequireSerializable() {
+ super.beansRequireSerializable();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beansRequireSettersForGetters(boolean value) {
+ super.beansRequireSettersForGetters(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beansRequireSettersForGetters() {
+ super.beansRequireSettersForGetters();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beansRequireSomeProperties(boolean value) {
+ super.beansRequireSomeProperties(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder beanTypePropertyName(String value) {
+ super.beanTypePropertyName(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder debug() {
+ super.debug();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public <T> HtmlDocSerializerBuilder example(Class<T> c, T o) {
+ super.example(c, o);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public <T> HtmlDocSerializerBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
+ super.ignoreInvocationExceptionsOnGetters(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignoreInvocationExceptionsOnGetters() {
+ super.ignoreInvocationExceptionsOnGetters();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignoreInvocationExceptionsOnSetters(boolean value) {
+ super.ignoreInvocationExceptionsOnSetters(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignoreInvocationExceptionsOnSetters() {
+ super.ignoreInvocationExceptionsOnSetters();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignorePropertiesWithoutSetters(boolean value) {
+ super.ignorePropertiesWithoutSetters(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignoreUnknownBeanProperties(boolean value) {
+ super.ignoreUnknownBeanProperties(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignoreUnknownBeanProperties() {
+ super.ignoreUnknownBeanProperties();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder ignoreUnknownNullBeanProperties(boolean value) {
+ super.ignoreUnknownNullBeanProperties(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
+ super.implClass(interfaceClass, implClass);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder implClasses(Map<String,Class<?>> values) {
+ super.implClasses(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder locale(Locale value) {
+ super.locale(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder mediaType(MediaType value) {
+ super.mediaType(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanClasses(Object...values) {
+ super.notBeanClasses(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanClassesRemove(Class<?>...values) {
+ super.notBeanClassesRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanPackages(Object...values) {
+ super.notBeanPackages(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanPackages(String...values) {
+ super.notBeanPackages(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanPackagesRemove(String...values) {
+ super.notBeanPackagesRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder pojoSwaps(Class<?>...values) {
+ super.pojoSwaps(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder pojoSwaps(Object...values) {
+ super.pojoSwaps(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder pojoSwapsRemove(Object...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder sortProperties(boolean value) {
+ super.sortProperties(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder sortProperties() {
+ super.sortProperties();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder timeZone(TimeZone value) {
+ super.timeZone(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder useEnumNames() {
+ super.useEnumNames();
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder useInterfaceProxies(boolean value) {
+ super.useInterfaceProxies(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder useJavaBeanIntrospector(boolean value) {
+ super.useJavaBeanIntrospector(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlDocSerializerBuilder useJavaBeanIntrospector() {
+ super.useJavaBeanIntrospector();
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder set(String name, Object value) {
+ super.set(name, value);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder set(boolean append, String name, Object value) {
+ super.set(append, name, value);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder set(Map<String,Object> properties) {
+ super.set(properties);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder add(Map<String,Object> properties) {
+ super.add(properties);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder addTo(String name, Object value) {
+ super.addTo(name, value);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder addTo(String name, String key, Object value) {
+ super.addTo(name, key, value);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder removeFrom(String name, Object value) {
+ super.removeFrom(name, value);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder apply(PropertyStore copyFrom) {
+ super.apply(copyFrom);
+ return this;
+ }
+}
\ No newline at end of file
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocTemplate.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocTemplate.java
index 7cdbefa..0df97ce 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocTemplate.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlDocTemplate.java
@@ -56,6 +56,11 @@ package org.apache.juneau.html;
public interface HtmlDocTemplate {
/**
+ * Represents a non-existent doc template.
+ */
+ public interface Null extends HtmlDocTemplate {}
+
+ /**
* Renders the contents of the <code><xt><head></xt></code> element.
*
* @param session The current serializer session.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserBuilder.java
index 0f90b1e..f4a26dd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserBuilder.java
@@ -20,6 +20,8 @@ import javax.xml.stream.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
/**
@@ -48,6 +50,15 @@ public class HtmlParserBuilder extends XmlParserBuilder {
return build(HtmlParser.class);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public HtmlParserBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ return this;
+ }
//-----------------------------------------------------------------------------------------------------------------
// Properties
@@ -156,38 +167,44 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public HtmlParserBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder beanDictionary(Class<?>...values) {
+ public HtmlParserBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public HtmlParserBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder beanDictionaryRemove(Object...values) {
+ public HtmlParserBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public HtmlParserBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public HtmlParserBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -204,6 +221,24 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlParserBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlParserBuilder beanFiltersRemove(Object...values) {
super.beanFiltersRemove(values);
return this;
@@ -288,6 +323,12 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> HtmlParserBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlParserBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -336,7 +377,7 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
- public <T> HtmlParserBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public HtmlParserBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -360,32 +401,38 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
+ public HtmlParserBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder notBeanClasses(Class<?>...values) {
+ public HtmlParserBuilder notBeanClasses(Object...values) {
super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
+ public HtmlParserBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder notBeanClassesRemove(Object...values) {
+ public HtmlParserBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder notBeanClassesRemove(Class<?>...values) {
super.notBeanClassesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public HtmlParserBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
return this;
}
@@ -402,14 +449,26 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder notBeanPackagesRemove(Object...values) {
+ public HtmlParserBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlParserBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public HtmlParserBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -426,6 +485,24 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlParserBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlParserBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlParserBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -450,6 +527,12 @@ public class HtmlParserBuilder extends XmlParserBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlParserBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlParserBuilder useEnumNames() {
super.useEnumNames();
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerBuilder.java
index f946209..4ae3995 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSchemaSerializerBuilder.java
@@ -20,7 +20,10 @@ import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.http.*;
import org.apache.juneau.jsonschema.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
/**
* Builder class for building instances of HTML Schema serializers.
@@ -48,6 +51,15 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
return build(HtmlSchemaSerializer.class);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public HtmlSchemaSerializerBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ return this;
+ }
//-----------------------------------------------------------------------------------------------------------------
// Properties
@@ -423,38 +435,44 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public HtmlSchemaSerializerBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder beanDictionary(Class<?>...values) {
+ public HtmlSchemaSerializerBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public HtmlSchemaSerializerBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder beanDictionaryRemove(Object...values) {
+ public HtmlSchemaSerializerBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSchemaSerializerBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public HtmlSchemaSerializerBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public HtmlSchemaSerializerBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -555,6 +573,12 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> HtmlSchemaSerializerBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlSchemaSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -603,7 +627,7 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public <T> HtmlSchemaSerializerBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public HtmlSchemaSerializerBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -627,12 +651,6 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
public HtmlSchemaSerializerBuilder notBeanClasses(Class<?>...values) {
super.notBeanClasses(values);
return this;
@@ -651,32 +669,38 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public HtmlSchemaSerializerBuilder notBeanPackages(Object...values) {
+ super.notBeanPackages(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder notBeanPackages(Object...values) {
+ public HtmlSchemaSerializerBuilder notBeanPackages(String...values) {
super.notBeanPackages(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder notBeanPackages(String...values) {
- super.notBeanPackages(values);
+ public HtmlSchemaSerializerBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder notBeanPackagesRemove(Object...values) {
+ public HtmlSchemaSerializerBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSchemaSerializerBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSchemaSerializerBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public HtmlSchemaSerializerBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -693,6 +717,24 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlSchemaSerializerBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSchemaSerializerBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSchemaSerializerBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlSchemaSerializerBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -717,6 +759,12 @@ public class HtmlSchemaSerializerBuilder extends HtmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlSchemaSerializerBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlSchemaSerializerBuilder useEnumNames() {
super.useEnumNames();
return this;
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 cb1b1b5..71abf80 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
@@ -17,8 +17,13 @@ import static org.apache.juneau.html.HtmlSerializer.*;
import java.util.*;
import org.apache.juneau.*;
+import org.apache.juneau.html.annotation.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
/**
@@ -47,6 +52,32 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
return build(HtmlSerializer.class);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Annotations
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override
+ public HtmlSerializerBuilder applyAnnotations(AnnotationsMap m, StringResolver sr) throws ParseException {
+ super.applyAnnotations(m, sr);
+ if (! m.containsKey(HtmlConfig.class))
+ return this;
+ ObjectResolver r = new ObjectResolver(sr);
+ for (HtmlConfig a : m.get(HtmlConfig.class)) {
+ if (! a.addBeanTypes().isEmpty())
+ addBeanTypes(r.bool(a.addBeanTypes()));
+ if (! a.addKeyValueTableHeaders().isEmpty())
+ addKeyValueTableHeaders(r.bool(a.addKeyValueTableHeaders()));
+ if (! a.detectLabelParameters().isEmpty())
+ detectLabelParameters(r.bool(a.detectLabelParameters()));
+ if (! a.detectLinksInStrings().isEmpty())
+ detectLinksInStrings(r.bool(a.detectLinksInStrings()));
+ if (! a.labelParameter().isEmpty())
+ labelParameter(r.string(a.labelParameter()));
+ if (! a.uriAnchorText().isEmpty())
+ uriAnchorText(r.string(a.uriAnchorText()));
+ }
+ return this;
+ }
//-----------------------------------------------------------------------------------------------------------------
// Properties
@@ -428,38 +459,44 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder beanDictionary(boolean append, Object...values) {
- super.beanDictionary(append, values);
+ public HtmlSerializerBuilder beanDictionary(Class<?>...values) {
+ super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder beanDictionary(Class<?>...values) {
+ public HtmlSerializerBuilder beanDictionary(Object...values) {
super.beanDictionary(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
+ public HtmlSerializerBuilder beanDictionaryReplace(Class<?>...values) {
+ super.beanDictionaryReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder beanDictionaryRemove(Object...values) {
+ public HtmlSerializerBuilder beanDictionaryReplace(Object...values) {
+ super.beanDictionaryReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder beanDictionaryRemove(Class<?>...values) {
super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder beanFieldVisibility(Visibility value) {
- super.beanFieldVisibility(value);
+ public HtmlSerializerBuilder beanDictionaryRemove(Object...values) {
+ super.beanDictionaryRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder beanFilters(boolean append, Object...values) {
- super.beanFilters(append, values);
+ public HtmlSerializerBuilder beanFieldVisibility(Visibility value) {
+ super.beanFieldVisibility(value);
return this;
}
@@ -476,6 +513,24 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder beanFiltersReplace(Class<?>...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder beanFiltersReplace(Object...values) {
+ super.beanFiltersReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder beanFiltersRemove(Class<?>...values) {
+ super.beanFiltersRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlSerializerBuilder beanFiltersRemove(Object...values) {
super.beanFiltersRemove(values);
return this;
@@ -560,6 +615,12 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public <T> HtmlSerializerBuilder exampleJson(Class<T> c, String value) {
+ super.exampleJson(c, value);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
@@ -608,7 +669,7 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public <T> HtmlSerializerBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass) {
+ public HtmlSerializerBuilder implClass(Class<?> interfaceClass, Class<?> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@@ -632,32 +693,38 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder notBeanClasses(boolean append, Object...values) {
- super.notBeanClasses(append, values);
+ public HtmlSerializerBuilder notBeanClasses(Class<?>...values) {
+ super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder notBeanClasses(Class<?>...values) {
+ public HtmlSerializerBuilder notBeanClasses(Object...values) {
super.notBeanClasses(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
+ public HtmlSerializerBuilder notBeanClassesReplace(Class<?>...values) {
+ super.notBeanClassesReplace(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder notBeanClassesRemove(Object...values) {
+ public HtmlSerializerBuilder notBeanClassesReplace(Object...values) {
+ super.notBeanClassesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder notBeanClassesRemove(Class<?>...values) {
super.notBeanClassesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder notBeanPackages(boolean append, Object...values) {
- super.notBeanPackages(append, values);
+ public HtmlSerializerBuilder notBeanClassesRemove(Object...values) {
+ super.notBeanClassesRemove(values);
return this;
}
@@ -674,14 +741,26 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder notBeanPackagesRemove(Object...values) {
+ public HtmlSerializerBuilder notBeanPackagesReplace(String...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder notBeanPackagesReplace(Object...values) {
+ super.notBeanPackagesReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder notBeanPackagesRemove(String...values) {
super.notBeanPackagesRemove(values);
return this;
}
@Override /* BeanContextBuilder */
- public HtmlSerializerBuilder pojoSwaps(boolean append, Object...values) {
- super.pojoSwaps(append, values);
+ public HtmlSerializerBuilder notBeanPackagesRemove(Object...values) {
+ super.notBeanPackagesRemove(values);
return this;
}
@@ -698,6 +777,24 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder pojoSwapsReplace(Class<?>...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder pojoSwapsReplace(Object...values) {
+ super.pojoSwapsReplace(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder pojoSwapsRemove(Class<?>...values) {
+ super.pojoSwapsRemove(values);
+ return this;
+ }
+
+ @Override /* BeanContextBuilder */
public HtmlSerializerBuilder pojoSwapsRemove(Object...values) {
super.pojoSwapsRemove(values);
return this;
@@ -722,6 +819,12 @@ public class HtmlSerializerBuilder extends XmlSerializerBuilder {
}
@Override /* BeanContextBuilder */
+ public HtmlSerializerBuilder useEnumNames(boolean value) {
+ super.useEnumNames(value);
+ return this;
+ }
... 12855 lines suppressed ...