JUNEAU-169 Dynamic annotations.
diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/ConfigBuilder.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/ConfigBuilder.java
index 3b3bb01..5ff84c74 100644
--- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/ConfigBuilder.java
+++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/ConfigBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.config.Config.*;
+import java.lang.annotation.*;
import java.util.*;
import org.apache.juneau.*;
@@ -293,6 +294,12 @@
}
@Override /* ContextBuilder */
+ public ConfigBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public ConfigBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java
index b0c7d72..d879947 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java
@@ -17,6 +17,8 @@
import java.util.*;
+import org.apache.juneau.html.annotation.*;
+import org.apache.juneau.json.annotation.*;
import org.apache.juneau.utils.*;
import org.junit.*;
@@ -1755,6 +1757,43 @@
assertEquals("{A:{'foo.ls':['baz','qux','foo','bar','quux']}}", psb.build().toString());
}
+ @Test
+ public void testListOfAnnotations() {
+
+ // Per the Annotation spec, two annotations have the same hashcode and are equivalent if their individual
+ // values are equal. Therefore, the annotations on A1 and A2 are two different but equivalent instances.
+
+ Html html1 = A1.class.getAnnotation(Html.class);
+ Html html1a = A1.class.getAnnotation(Html.class);
+ Html html2 = A2.class.getAnnotation(Html.class);
+ Html html3 = A3.class.getAnnotation(Html.class);
+ Json json4 = A4.class.getAnnotation(Json.class);
+
+ PropertyStore
+ ps1 = PropertyStore.create().set("xxx", AList.create(html1)).build(),
+ ps1a = PropertyStore.create().set("xxx", AList.create(html1a)).build(),
+ ps2 = PropertyStore.create().set("xxx", AList.create(html2)).build(),
+ ps3 = PropertyStore.create().set("xxx", AList.create(html3)).build(),
+ ps4 = PropertyStore.create().set("xxx", AList.create(json4)).build();
+
+ assertTrue(ps1.equals(ps1a));
+ assertTrue(ps1.equals(ps2));
+ assertFalse(ps1.equals(ps3));
+ assertFalse(ps1.equals(ps4));
+ }
+
+ @Html(on="foo")
+ public static class A1 {}
+
+ @Html(on="foo")
+ public static class A2 {}
+
+ @Html(on="bar")
+ public static class A3 {}
+
+ @Json(on="foo")
+ public static class A4 {}
+
//-------------------------------------------------------------------------------------------------------------------
// Utility methods
//-------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/utils/ReflectionMapTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/utils/ReflectionMapTest.java
new file mode 100644
index 0000000..7c299f3
--- /dev/null
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/utils/ReflectionMapTest.java
@@ -0,0 +1,223 @@
+// ***************************************************************************************************************************
+// * 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.utils;
+
+import static org.apache.juneau.testutils.TestUtils.*;
+import static org.junit.Assert.*;
+
+import java.lang.reflect.*;
+
+import org.junit.*;
+import org.junit.runners.*;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ReflectionMapTest {
+
+ private static ReflectionMap.Builder<Number> create() {
+ return ReflectionMap.create(Number.class);
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Class names
+ //------------------------------------------------------------------------------------------------------------------
+
+ static class A1 {}
+ static class A2 {}
+
+ static ReflectionMap<Number>
+ RM_A_SIMPLE = create().append("A1", 1).build(),
+ RM_A_FULL = create().append("org.apache.juneau.utils.ReflectionMapTest$A1", 1).build();
+
+ @Test
+ public void a01_simpleClassName_find() {
+ assertObjectEquals("[1]", RM_A_SIMPLE.find(A1.class));
+ assertObjectEquals("[]", RM_A_SIMPLE.find(A2.class));
+ }
+
+ @Test
+ public void a02_simpleClassName_findType() {
+ assertObjectEquals("[1]", RM_A_SIMPLE.find(A1.class, Integer.class));
+ assertObjectEquals("[]", RM_A_SIMPLE.find(A1.class, Long.class));
+ assertObjectEquals("[]", RM_A_SIMPLE.find(A2.class, Integer.class));
+ }
+
+ @Test
+ public void a03_simpleClassName_findFirst() {
+ assertObjectEquals("1", RM_A_SIMPLE.findFirst(A1.class));
+ assertObjectEquals("null", RM_A_SIMPLE.findFirst(A2.class));
+ }
+
+ @Test
+ public void a04_simpleClassName_findFirstType() {
+ assertObjectEquals("1", RM_A_SIMPLE.findFirst(A1.class, Integer.class));
+ assertObjectEquals("null", RM_A_SIMPLE.findFirst(A1.class, Long.class));
+ assertObjectEquals("null", RM_A_SIMPLE.findFirst(A2.class, Integer.class));
+ }
+
+ @Test
+ public void a05_fullClassName_find() {
+ assertObjectEquals("[1]", RM_A_FULL.find(A1.class));
+ assertObjectEquals("[]", RM_A_FULL.find(A2.class));
+ }
+
+ @Test
+ public void a06_fullClassName_findType() {
+ assertObjectEquals("[1]", RM_A_FULL.find(A1.class, Integer.class));
+ assertObjectEquals("[]", RM_A_FULL.find(A1.class, Long.class));
+ assertObjectEquals("[]", RM_A_FULL.find(A2.class, Integer.class));
+ }
+
+ @Test
+ public void a07_fullClassName_findFirst() {
+ assertObjectEquals("1", RM_A_FULL.findFirst(A1.class));
+ assertObjectEquals("null", RM_A_FULL.findFirst(A2.class));
+ }
+
+ @Test
+ public void a08_fullClassName_findFirstType() {
+ assertObjectEquals("1", RM_A_FULL.findFirst(A1.class, Integer.class));
+ assertObjectEquals("null", RM_A_FULL.findFirst(A1.class, Long.class));
+ assertObjectEquals("null", RM_A_FULL.findFirst(A2.class, Integer.class));
+ }
+
+ @Test
+ public void a09_nullClass() {
+ assertObjectEquals("[]", RM_A_SIMPLE.find((Class<?>)null));
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Method names
+ //------------------------------------------------------------------------------------------------------------------
+
+ static class B1 {
+ public void f1() {}
+ public void f2() {}
+ }
+ static class B2 {
+ public void f1() {}
+ public void f2() {}
+ }
+
+ static ReflectionMap<Number>
+ RM_B_SIMPLE = create().append("B1.f1", 1).build(),
+ RM_B_FULL = create().append("org.apache.juneau.utils.ReflectionMapTest$B1.f1", 1).build();
+
+ @Test
+ public void b01_simpleMethodName_find() throws Exception {
+ assertObjectEquals("[1]", RM_B_SIMPLE.find(B1.class.getMethod("f1")));
+ assertObjectEquals("[]", RM_B_SIMPLE.find(B1.class.getMethod("f2")));
+ assertObjectEquals("[]", RM_B_SIMPLE.find(B2.class.getMethod("f1")));
+ assertObjectEquals("[]", RM_B_SIMPLE.find(B2.class.getMethod("f2")));
+ }
+
+ @Test
+ public void b02_simpleMethodName_findType() throws Exception {
+ assertObjectEquals("[1]", RM_B_SIMPLE.find(B1.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("[]", RM_B_SIMPLE.find(B1.class.getMethod("f1"), Long.class));
+ assertObjectEquals("[]", RM_B_SIMPLE.find(B1.class.getMethod("f2"), Integer.class));
+ assertObjectEquals("[]", RM_B_SIMPLE.find(B2.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("[]", RM_B_SIMPLE.find(B2.class.getMethod("f2"), Integer.class));
+ }
+
+ @Test
+ public void b03_simpleMethodName_findFirst() throws Exception {
+ assertObjectEquals("1", RM_B_SIMPLE.findFirst(B1.class.getMethod("f1")));
+ assertObjectEquals("null", RM_B_SIMPLE.findFirst(B1.class.getMethod("f2")));
+ assertObjectEquals("null", RM_B_SIMPLE.findFirst(B2.class.getMethod("f1")));
+ assertObjectEquals("null", RM_B_SIMPLE.findFirst(B2.class.getMethod("f2")));
+ }
+
+ @Test
+ public void b04_simpleMethodName_findFirstType() throws Exception {
+ assertObjectEquals("1", RM_B_SIMPLE.findFirst(B1.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("null", RM_B_SIMPLE.findFirst(B1.class.getMethod("f1"), Long.class));
+ assertObjectEquals("null", RM_B_SIMPLE.findFirst(B1.class.getMethod("f2"), Integer.class));
+ assertObjectEquals("null", RM_B_SIMPLE.findFirst(B2.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("null", RM_B_SIMPLE.findFirst(B2.class.getMethod("f2"), Integer.class));
+ }
+
+ @Test
+ public void b05_fullMethodName_find() throws Exception {
+ assertObjectEquals("[1]", RM_B_FULL.find(B1.class.getMethod("f1")));
+ assertObjectEquals("[]", RM_B_FULL.find(B1.class.getMethod("f2")));
+ assertObjectEquals("[]", RM_B_FULL.find(B2.class.getMethod("f1")));
+ assertObjectEquals("[]", RM_B_FULL.find(B2.class.getMethod("f2")));
+ }
+
+ @Test
+ public void b06_fullMethodName_findType() throws Exception {
+ assertObjectEquals("[1]", RM_B_FULL.find(B1.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("[]", RM_B_FULL.find(B1.class.getMethod("f1"), Long.class));
+ assertObjectEquals("[]", RM_B_FULL.find(B1.class.getMethod("f2"), Integer.class));
+ assertObjectEquals("[]", RM_B_FULL.find(B2.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("[]", RM_B_FULL.find(B2.class.getMethod("f2"), Integer.class));
+ }
+
+ @Test
+ public void b07_fullMethodName_findFirst() throws Exception {
+ assertObjectEquals("1", RM_B_FULL.findFirst(B1.class.getMethod("f1")));
+ assertObjectEquals("null", RM_B_FULL.findFirst(B1.class.getMethod("f2")));
+ assertObjectEquals("null", RM_B_FULL.findFirst(B2.class.getMethod("f1")));
+ assertObjectEquals("null", RM_B_FULL.findFirst(B2.class.getMethod("f2")));
+ }
+
+ @Test
+ public void b08_fullMethodName_findFirstType() throws Exception {
+ assertObjectEquals("1", RM_B_FULL.findFirst(B1.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("null", RM_B_FULL.findFirst(B1.class.getMethod("f1"), Long.class));
+ assertObjectEquals("null", RM_B_FULL.findFirst(B1.class.getMethod("f2"), Integer.class));
+ assertObjectEquals("null", RM_B_FULL.findFirst(B2.class.getMethod("f1"), Integer.class));
+ assertObjectEquals("null", RM_B_FULL.findFirst(B2.class.getMethod("f2"), Integer.class));
+ }
+
+ @Test
+ public void b09_nullMethod() {
+ assertObjectEquals("[]", RM_B_SIMPLE.find((Method)null));
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Invalid input
+ //------------------------------------------------------------------------------------------------------------------
+
+ @Test
+ public void c01_blankInput() throws Exception {
+ try {
+ create().append("", 1);
+ fail();
+ } catch (RuntimeException e) {
+ assertEquals("Invalid reflection signature: []", e.getMessage());
+ }
+ }
+
+ @Test
+ public void c02_nullInput() throws Exception {
+ try {
+ create().append(null, 1);
+ fail();
+ } catch (RuntimeException e) {
+ assertEquals("Invalid reflection signature: [null]", e.getMessage());
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Comma-delimited list.
+ //------------------------------------------------------------------------------------------------------------------
+ static class D1 {}
+
+ static ReflectionMap<Number> RM_D = create().append("D2, D1", 1).build();
+
+ @Test
+ public void d01_cdl() {
+ assertObjectEquals("[1]", RM_D.find(D1.class));
+ }
+}
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 bfc436e..27d5d0e 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
@@ -15,6 +15,7 @@
import static org.apache.juneau.jena.RdfCommon.*;
import static org.apache.juneau.jena.RdfParser.*;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -1320,6 +1321,12 @@
}
@Override /* ContextBuilder */
+ public RdfParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public RdfParserBuilder set(String name, Object value) {
super.set(name, value);
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 56fb2dd..6dd6a4e 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
@@ -15,6 +15,7 @@
import static org.apache.juneau.jena.RdfCommon.*;
import static org.apache.juneau.jena.RdfSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -1564,6 +1565,12 @@
}
@Override /* ContextBuilder */
+ public RdfSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public RdfSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java
index 7f29e80..25309b8 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java
@@ -67,6 +67,28 @@
String namespace() default "";
/**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link RdfConfig#annotateRdf()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* Sets the XML prefix of this property or class.
*
* <p>
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
index 153a075..e49da2b 100644
--- 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
@@ -49,6 +49,19 @@
//-------------------------------------------------------------------------------------------------------------------
/**
+ * Indirectly applies {@link Rdf @Rdf} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Rdf#on() @Rdf.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Rdf[] annotateRdf() default {};
+
+ /**
* Configuration property: RDF language.
*
* <p>
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigApply.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigApply.java
index bbff821..f6c2bde 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigApply.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigApply.java
@@ -108,5 +108,8 @@
if (! a.trimWhitespace().isEmpty())
psb.set(RDF_trimWhitespace, bool(a.trimWhitespace()));
+
+ if (a.annotateRdf().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateRdf());
}
}
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 b1209ff..3ebfc17 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
@@ -16,6 +16,7 @@
import static org.apache.juneau.internal.StringUtils.*;
import java.io.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -1877,6 +1878,12 @@
}
@Override /* ContextBuilder */
+ public BeanContextBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public BeanContextBuilder set(String name, Object value) {
super.set(name, value);
return this;
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 b56a2e7..0795998 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
@@ -14,6 +14,7 @@
import static org.apache.juneau.BeanTraverseContext.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -685,6 +686,12 @@
}
@Override /* ContextBuilder */
+ public BeanTraverseBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public BeanTraverseBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
index 30eb9fe..27c1176 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau;
+import java.lang.annotation.*;
import java.util.*;
import org.apache.juneau.annotation.*;
@@ -41,6 +42,57 @@
*/
public abstract class Context {
+ static final String PREFIX = "Context";
+
+ /**
+ * Configuration property: Annotations.
+ *
+ * <h5 class='section'>Property:</h5>
+ * <ul>
+ * <li><b>Name:</b> <js>"Context.annotations.lo"</js>
+ * <li><b>Data type:</b> <c>List<Annotation></c>
+ * <li><b>Default:</b> Empty list.
+ * <li><b>Methods:</b>
+ * <ul>
+ * <li class='jm'>{@link ContextBuilder#annotations(Annotation...)}
+ * </ul>
+ * </ul>
+ *
+ * <h5 class='section'>Description:</h5>
+ * <p>
+ * Defines annotations to apply to specific classes and methods.
+ *
+ * <p>
+ * Allows you to dynamically apply Juneau annotations typically applied directly to classes and methods.
+ * Useful in cases where you want to use the functionality of the annotation on beans and bean properties but
+ * do not have access to the code to do so.
+ *
+ * <p>
+ * As a rule, any Juneau annotation with an <c>on()</c> method can be used with this property.
+ *
+ * <p>
+ * The following example shows the equivalent methods for applying the {@link Bean @Bean} annotation:
+ * <p class='bpcode w800'>
+ * <jc>// Class with explicit annotation.</jc>
+ * <ja>@Bean</ja>(bpi=<jk>"street,city,state"</js>)
+ * <jk>public class</jk> A {...}
+ *
+ * <jc>// Class with annotation applied via @BeanConfig</jc>
+ * <jk>public class</jk> B {...}
+ *
+ * <jc>// Java REST method with @BeanConfig annotation.</jc>
+ * <ja>@RestMethod</ja>(...)
+ * <ja>@BeanConfig</ja>(
+ * annotations={
+ * <ja>@Bean</ja>(on=<js>"B"</js>, bpi=<jk>"street,city,state"</js>)
+ * }
+ * )
+ * <jk>public void</jk> doFoo() {...}
+ * </p>
+ */
+ public static final String CONTEXT_annotations = PREFIX + ".annotations.lo";
+
+
private final PropertyStore propertyStore;
private final int identityCode;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java
index 63ae6cf..b143d44 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextBuilder.java
@@ -12,6 +12,9 @@
// ***************************************************************************************************************************
package org.apache.juneau;
+import static org.apache.juneau.BeanContext.*;
+
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -226,6 +229,29 @@
//-----------------------------------------------------------------------------------------------------------------
/**
+ * Configuration property: Annotations.
+ *
+ * <p>
+ * Defines annotations to apply to specific classes and methods.
+ *
+ * <p>
+ * Allows you to dynamically apply Juneau annotations typically applied directly to classes and methods.
+ * Useful in cases where you want to use the functionality of the annotation on beans and bean properties but
+ * do not have access to the code to do so.
+ *
+ * <ul class='seealso'>
+ * <li class='jf'>{@link Context#CONTEXT_annotations}
+ * </ul>
+ *
+ * @param values
+ * The values to add to this property.
+ * @return This object (for method chaining).
+ */
+ public ContextBuilder annotations(Annotation...values) {
+ return addTo(CONTEXT_annotations, values);
+ }
+
+ /**
* Sets a configuration property on this object.
*
* @param name The property name.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Bean.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Bean.java
index f967405..436291b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Bean.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Bean.java
@@ -265,6 +265,48 @@
Class<? extends PropertyNamer> propertyNamer() default PropertyNamerDefault.class;
/**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link BeanConfig#annotateBean()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * <p>
+ * The following example shows the equivalent methods for applying the {@link Bean @Bean} annotation:
+ * <p class='bpcode w800'>
+ * <jc>// Class with explicit annotation.</jc>
+ * <ja>@Bean</ja>(bpi=<jk>"street,city,state"</js>)
+ * <jk>public class</jk> A {...}
+ *
+ * <jc>// Class with annotation applied via @BeanConfig</jc>
+ * <jk>public class</jk> B {...}
+ *
+ * <jc>// Java REST method with @BeanConfig annotation.</jc>
+ * <ja>@RestMethod</ja>(...)
+ * <ja>@BeanConfig</ja>(
+ * annotateBean={
+ * <ja>@Bean</ja>(on=<js>"B"</js>, bpi=<jk>"street,city,state"</js>)
+ * }
+ * )
+ * <jk>public void</jk> doFoo() {...}
+ * </p>
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* Sort bean properties in alphabetical order.
*
* <p>
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
index be61696..5530d0b 100644
--- 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
@@ -50,6 +50,32 @@
//-----------------------------------------------------------------------------------------------------------------
/**
+ * Indirectly applies {@link Bean @Bean} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Bean#on() @Bean.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Bean[] annotateBean() default {};
+
+ /**
+ * Indirectly applies {@link Beanp @Beanp} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Beanp#on() @Beanp.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Beanp[] annotateBeanp() default {};
+
+ /**
* Configuration property: Minimum bean class visibility.
*
* <p>
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigApply.java
index 516a578..d498230 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigApply.java
@@ -165,6 +165,11 @@
psb.set(BEANTRAVERSE_initialDepth, integer(a.initialDepth(), "initialDepth"));
if (! a.maxDepth().isEmpty())
psb.set(BEANTRAVERSE_maxDepth, integer(a.maxDepth(), "maxDepth"));
+
+ if (a.annotateBean().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateBean());
+ if (a.annotateBeanp().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateBeanp());
}
private Locale locale(String in) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanp.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanp.java
index 2e81f8b..3a79aa3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanp.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanp.java
@@ -203,6 +203,28 @@
Class<?> type() default Object.class;
/**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link BeanConfig#annotateBeanp()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* For bean properties of maps and collections, this annotation can be used to identify the class types of the
* contents of the bean property object when the generic parameter types are interfaces or abstract classes.
*
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvCommon.java
new file mode 100644
index 0000000..1e7dc88
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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.csv;
+
+/**
+ * Configurable properties common to both the {@link CsvSerializer} and {@link CsvParser} classes.
+ */
+public interface CsvCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "Csv";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java
index 2c7ac84..3073f39 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvParser.java
@@ -20,7 +20,7 @@
* TODO - Work in progress. CSV parser.
*/
@ConfigurableContext
-public class CsvParser extends ReaderParser {
+public class CsvParser extends ReaderParser implements CsvCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
@@ -76,7 +76,7 @@
public CsvParserSession createSession(ParserSessionArgs args) {
return new CsvParserSession(this, args);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Other methods
//-----------------------------------------------------------------------------------------------------------------
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 63aa49b..773f123 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
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.csv;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -640,6 +641,12 @@
}
@Override /* ContextBuilder */
+ public CsvParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public CsvParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java
index 40811dd..440dcc3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/CsvSerializer.java
@@ -20,7 +20,7 @@
* TODO - Work in progress. CSV serializer.
*/
@ConfigurableContext
-public final class CsvSerializer extends WriterSerializer {
+public final class CsvSerializer extends WriterSerializer implements CsvCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
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 91adc0d..15021a5 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
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.csv;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -766,6 +767,12 @@
}
@Override /* ContextBuilder */
+ public CsvSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public CsvSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/Csv.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/Csv.java
new file mode 100644
index 0000000..e41a045
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/Csv.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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.csv.annotation;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.csv.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link CsvSerializer} and {@link CsvParser}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface Csv {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link CsvConfig#annotateCsv()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfig.java
index 1d731ef..e382a97 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfig.java
@@ -40,4 +40,29 @@
* Can be used to override default ordering and application of config annotations.
*/
int rank() default 0;
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // CsvCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link Csv @Csv} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Csv#on() @Csv.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Csv[] annotateCsv() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // CsvSerializer
+ //-------------------------------------------------------------------------------------------------------------------
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // CsvParser
+ //-------------------------------------------------------------------------------------------------------------------
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfigApply.java
index 59d5d6d..c465f0f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvConfigApply.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.csv.annotation;
+import static org.apache.juneau.Context.*;
+
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
import org.apache.juneau.svl.*;
@@ -33,5 +35,9 @@
@Override
public void apply(AnnotationInfo<CsvConfig> ai, PropertyStoreBuilder psb) {
+ CsvConfig a = ai.getAnnotation();
+
+ if (a.annotateCsv().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateCsv());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlCommon.java
new file mode 100644
index 0000000..74899d6
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link HtmlSerializer} and {@link HtmlParser} classes.
+ */
+public interface HtmlCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "Html";
+}
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
index 46b182b..a745703 100644
--- 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
@@ -14,6 +14,7 @@
import static org.apache.juneau.html.HtmlDocSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -1287,6 +1288,12 @@
}
@Override /* ContextBuilder */
+ public HtmlDocSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public HtmlDocSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java
index e6bd2c4..158f379 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParser.java
@@ -34,7 +34,7 @@
* This class is used primarily for automated testing of the {@link HtmlSerializer} class.
*/
@ConfigurableContext
-public class HtmlParser extends XmlParser implements HtmlMetaProvider {
+public class HtmlParser extends XmlParser implements HtmlMetaProvider, HtmlCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
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 06008ff..52c4d59 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
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -662,6 +663,12 @@
}
@Override /* ContextBuilder */
+ public HtmlParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public HtmlParserBuilder set(String name, Object value) {
super.set(name, value);
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 e119f20..64e49c3 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
@@ -14,6 +14,7 @@
import static org.apache.juneau.jsonschema.JsonSchemaGenerator.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -899,6 +900,12 @@
}
@Override /* ContextBuilder */
+ public HtmlSchemaSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public HtmlSchemaSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
index 1ba0e2f..bc3e869 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
@@ -125,7 +125,7 @@
* </p>
*/
@ConfigurableContext
-public class HtmlSerializer extends XmlSerializer implements HtmlMetaProvider {
+public class HtmlSerializer extends XmlSerializer implements HtmlMetaProvider, HtmlCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
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 8fb16c8..fc60b96 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
@@ -14,6 +14,7 @@
import static org.apache.juneau.html.HtmlSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -940,6 +941,12 @@
}
@Override /* ContextBuilder */
+ public HtmlSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public HtmlSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerBuilder.java
index 16845ad..2533cfb 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlStrippedDocSerializerBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.html;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -851,6 +852,12 @@
}
@Override /* ContextBuilder */
+ public HtmlStrippedDocSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public HtmlStrippedDocSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/Html.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/Html.java
index 3808c31..b9e1073 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/Html.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/Html.java
@@ -102,6 +102,28 @@
boolean noTables() default false;
/**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link HtmlConfig#annotateHtml()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* Associates an {@link HtmlRender} with a bean property for custom HTML rendering of the property.
*
* <p>
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfig.java
index 2f53268..6103ae1 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfig.java
@@ -43,6 +43,23 @@
int rank() default 0;
//-------------------------------------------------------------------------------------------------------------------
+ // HtmlCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link Html @Html} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Html#on() @Html.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Html[] annotateHtml() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
// HtmlSerializer
//-------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigApply.java
index 16acef2..1eb8c0c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigApply.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.html.annotation;
+import static org.apache.juneau.Context.*;
import static org.apache.juneau.html.HtmlSerializer.*;
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
@@ -47,5 +48,8 @@
psb.set(HTML_labelParameter, string(a.labelParameter()));
if (! a.uriAnchorText().isEmpty())
psb.set(HTML_uriAnchorText, string(a.uriAnchorText()));
+
+ if (a.annotateHtml().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateHtml());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoCommon.java
new file mode 100644
index 0000000..5500a7e
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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.jso;
+
+/**
+ * Configurable properties common to both the {@link JsoSerializer} and {@link JsoParser} classes.
+ */
+public interface JsoCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "Jso";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java
index 90dc384..b197364 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParser.java
@@ -26,7 +26,7 @@
* Consumes <c>Content-Type</c> types: <bc>application/x-java-serialized-object</bc>
*/
@ConfigurableContext
-public final class JsoParser extends InputStreamParser {
+public final class JsoParser extends InputStreamParser implements JsoCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserBuilder.java
index f0b4750..c4b5402 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoParserBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.jso;
+import java.lang.annotation.*;
import java.util.*;
import org.apache.juneau.*;
@@ -633,6 +634,12 @@
}
@Override /* ContextBuilder */
+ public JsoParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public JsoParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java
index 4efdc99..4fd10d2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializer.java
@@ -28,7 +28,7 @@
* Produces <c>Content-Type</c> types: <bc>application/x-java-serialized-object</bc>
*/
@ConfigurableContext
-public class JsoSerializer extends OutputStreamSerializer {
+public class JsoSerializer extends OutputStreamSerializer implements JsoCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerBuilder.java
index 29a6932..5e7b847 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/JsoSerializerBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.jso;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -723,6 +724,12 @@
}
@Override /* ContextBuilder */
+ public JsoSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public JsoSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/Jso.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/Jso.java
new file mode 100644
index 0000000..2bce85a
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/Jso.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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.jso.annotation;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.jso.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link JsoSerializer} and {@link JsoParser}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface Jso {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link JsoConfig#annotateJso()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfig.java
index 50c350b..56345fa 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfig.java
@@ -40,4 +40,29 @@
* Can be used to override default ordering and application of config annotations.
*/
int rank() default 0;
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // JsoCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link Jso @Jso} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Jso#on() @Jso.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Jso[] annotateJso() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // JsoSerializer
+ //-------------------------------------------------------------------------------------------------------------------
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // JsoParser
+ //-------------------------------------------------------------------------------------------------------------------
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfigApply.java
index 30d90e1..0bbaee4 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jso/annotation/JsoConfigApply.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.jso.annotation;
+import static org.apache.juneau.Context.*;
+
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
import org.apache.juneau.svl.*;
@@ -33,5 +35,9 @@
@Override
public void apply(AnnotationInfo<JsoConfig> ai, PropertyStoreBuilder psb) {
+ JsoConfig a = ai.getAnnotation();
+
+ if (a.annotateJso().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateJso());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonCommon.java
new file mode 100644
index 0000000..f781982
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link JsonSerializer} and {@link JsonParser} classes.
+ */
+public interface JsonCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "Json";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
index 4272382..760a226 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParser.java
@@ -103,7 +103,7 @@
* The end result should be the same.
*/
@ConfigurableContext
-public class JsonParser extends ReaderParser implements JsonMetaProvider {
+public class JsonParser extends ReaderParser implements JsonMetaProvider, JsonCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserBuilder.java
index 38a9427..bb35719 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.json.JsonParser.*;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -678,6 +679,12 @@
}
@Override /* ContextBuilder */
+ public JsonParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public JsonParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerBuilder.java
index 948a13e..ef97cb9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSchemaSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.jsonschema.JsonSchemaGenerator.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -965,6 +966,12 @@
}
@Override /* ContextBuilder */
+ public JsonSchemaSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public JsonSchemaSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java
index da53881..a8318d0 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializer.java
@@ -89,7 +89,7 @@
* </p>
*/
@ConfigurableContext
-public class JsonSerializer extends WriterSerializer implements JsonMetaProvider {
+public class JsonSerializer extends WriterSerializer implements JsonMetaProvider, JsonCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java
index ad9d4b7..8efd3ea 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.json.JsonSerializer.*;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -855,6 +856,12 @@
}
@Override /* ContextBuilder */
+ public JsonSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public JsonSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/Json.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/Json.java
index fdd542c..d231e09 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/Json.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/Json.java
@@ -37,6 +37,28 @@
public @interface Json {
/**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link JsonConfig#annotateJson()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* Wraps beans in a JSON object with the specified attribute name.
*
* <p>
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfig.java
index 4528785..ba77eb8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfig.java
@@ -43,6 +43,23 @@
int rank() default 0;
//-------------------------------------------------------------------------------------------------------------------
+ // JsonCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link Json @Json} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Json#on() @Json.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Json[] annotateJson() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
// JsonParser
//-------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigApply.java
index b0e5639..19b0b2e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigApply.java
@@ -45,5 +45,8 @@
if (! a.validateEnd().isEmpty())
psb.set(JSON_validateEnd, bool(a.validateEnd()));
+
+ if (a.annotateJson().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateJson());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorBuilder.java
index 1c0764e..c63df98 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.jsonschema.JsonSchemaGenerator.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -827,6 +828,12 @@
}
@Override /* ContextBuilder */
+ public JsonSchemaGeneratorBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public JsonSchemaGeneratorBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchema.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchema.java
new file mode 100644
index 0000000..37db694
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchema.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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 java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.jsonschema.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link JsonSchemaGenerator}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface JsonSchema {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link JsonSchemaConfig#annotateJsonSchema()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfig.java
index b289d54..4e10a24 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfig.java
@@ -171,6 +171,19 @@
String allowNestedExamples() default "";
/**
+ * Indirectly applies {@link JsonSchema @JsonSchema} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link JsonSchema#on() @JsonSchema.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ JsonSchema[] annotateJsonSchema() default {};
+
+ /**
* Configuration property: Bean schema definition mapper.
*
* <p>
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigApply.java
index 7f98599..20db787 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigApply.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.jsonschema.annotation;
+import static org.apache.juneau.Context.*;
import static org.apache.juneau.jsonschema.JsonSchemaGenerator.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
@@ -53,5 +54,8 @@
psb.set(JSONSCHEMA_ignoreTypes, string(a.ignoreTypes()));
if (! a.useBeanDefs().isEmpty())
psb.set(JSONSCHEMA_useBeanDefs, bool(a.useBeanDefs()));
+
+ if (a.annotateJsonSchema().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateJsonSchema());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackCommon.java
new file mode 100644
index 0000000..af93858
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link MsgPackSerializer} and {@link MsgPackParser} classes.
+ */
+public interface MsgPackCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "MsgPack";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
index 6b6d883..34bfc93 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParser.java
@@ -24,7 +24,7 @@
* Handles <c>Content-Type</c> types: <bc>octal/msgpack</bc>
*/
@ConfigurableContext
-public class MsgPackParser extends InputStreamParser {
+public class MsgPackParser extends InputStreamParser implements MsgPackCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserBuilder.java
index 344698a..b192d40 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackParserBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.msgpack;
+import java.lang.annotation.*;
import java.util.*;
import org.apache.juneau.*;
@@ -633,6 +634,12 @@
}
@Override /* ContextBuilder */
+ public MsgPackParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public MsgPackParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
index ba5ac98..3093033 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializer.java
@@ -26,7 +26,7 @@
* Produces <c>Content-Type</c> types: <bc>octal/msgpack</bc>
*/
@ConfigurableContext
-public class MsgPackSerializer extends OutputStreamSerializer {
+public class MsgPackSerializer extends OutputStreamSerializer implements MsgPackCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerBuilder.java
index 5f1c8b9..532ad0e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.msgpack;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -723,6 +724,12 @@
}
@Override /* ContextBuilder */
+ public MsgPackSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public MsgPackSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPack.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPack.java
new file mode 100644
index 0000000..a2272b7
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPack.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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 java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.msgpack.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link MsgPackSerializer} and {@link MsgPackParser}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface MsgPack {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link MsgPackConfig#annotateMsgPack()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfig.java
index 46293fc..a4016cf 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfig.java
@@ -43,6 +43,23 @@
int rank() default 0;
//-------------------------------------------------------------------------------------------------------------------
+ // MsgPackCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link MsgPack @MsgPack} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link MsgPack#on() @MsgPack.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ MsgPack[] annotateMsgPack() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
// MsgPackSerializer
//-------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigApply.java
index 1f4e6d6..ebba9ea 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigApply.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.msgpack.annotation;
+import static org.apache.juneau.Context.*;
import static org.apache.juneau.msgpack.MsgPackSerializer.*;
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
@@ -35,7 +36,11 @@
@Override
public void apply(AnnotationInfo<MsgPackConfig> ai, PropertyStoreBuilder psb) {
MsgPackConfig a = ai.getAnnotation();
+
if (! a.addBeanTypes().isEmpty())
psb.set(MSGPACK_addBeanTypes, bool(a.addBeanTypes()));
+
+ if (a.annotateMsgPack().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateMsgPack());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiCommon.java
new file mode 100644
index 0000000..32593a3
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link OpenApiSerializer} and {@link OpenApiParser} classes.
+ */
+public interface OpenApiCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "OpenApi";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParser.java
index c7cb930..0a66fd8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParser.java
@@ -25,7 +25,7 @@
* </ul>
*/
@ConfigurableContext
-public class OpenApiParser extends UonParser {
+public class OpenApiParser extends UonParser implements OpenApiCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParserBuilder.java
index f7b1daf..61eaa9b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiParserBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.oapi;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -615,6 +616,12 @@
}
@Override /* ContextBuilder */
+ public OpenApiParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public OpenApiParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializer.java
index 1a22687..f3ee5bd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializer.java
@@ -26,7 +26,7 @@
* </ul>
*/
@ConfigurableContext
-public class OpenApiSerializer extends UonSerializer {
+public class OpenApiSerializer extends UonSerializer implements OpenApiCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerBuilder.java
index 1d5fb08..b2f9749 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/OpenApiSerializerBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.oapi;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -767,6 +768,12 @@
}
@Override /* ContextBuilder */
+ public OpenApiSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public OpenApiSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApi.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApi.java
new file mode 100644
index 0000000..a19e6a1
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApi.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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 static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.oapi.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link OpenApiSerializer} and {@link OpenApiParser}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface OpenApi {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link OpenApiConfig#annotateOpenApi()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfig.java
index 7dbeb9b..5e51f24 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfig.java
@@ -40,4 +40,29 @@
* Can be used to override default ordering and application of config annotations.
*/
int rank() default 0;
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // OpenApiCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link OpenApi @OpenApi} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link OpenApi#on() @OpenApi.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ OpenApi[] annotateOpenApi() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // OpenApiSerializer
+ //-------------------------------------------------------------------------------------------------------------------
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // OpenApiParser
+ //-------------------------------------------------------------------------------------------------------------------
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigApply.java
index 27d0272..234fdb6 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigApply.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.oapi.annotation;
+import static org.apache.juneau.Context.*;
+
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
import org.apache.juneau.svl.*;
@@ -33,5 +35,9 @@
@Override
public void apply(AnnotationInfo<OpenApiConfig> ai, PropertyStoreBuilder psb) {
+ OpenApiConfig a = ai.getAnnotation();
+
+ if (a.annotateOpenApi().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateOpenApi());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserBuilder.java
index 5de2e88..7d46dc9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/InputStreamParserBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.parser.InputStreamParser.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -664,6 +665,12 @@
}
@Override /* ContextBuilder */
+ public InputStreamParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public InputStreamParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java
index ddb4373..21b0d99 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.parser.Parser.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -743,6 +744,12 @@
}
@Override /* ContextBuilder */
+ public ParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public ParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
index 6311847..128a67d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserGroupBuilder.java
@@ -16,6 +16,7 @@
import static org.apache.juneau.parser.InputStreamParser.*;
import static org.apache.juneau.parser.ReaderParser.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -887,6 +888,12 @@
}
@Override /* ContextBuilder */
+ public ParserGroupBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public ParserGroupBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserBuilder.java
index b21240f..860c504 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ReaderParserBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.parser.ReaderParser.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -663,6 +664,12 @@
}
@Override /* ContextBuilder */
+ public ReaderParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public ReaderParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextCommon.java
new file mode 100644
index 0000000..974e0cc
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link PlainTextSerializer} and {@link PlainTextParser} classes.
+ */
+public interface PlainTextCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "PlainText";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
index a441786..7f7cd69 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParser.java
@@ -39,7 +39,7 @@
* defined on it.
*/
@ConfigurableContext
-public class PlainTextParser extends ReaderParser {
+public class PlainTextParser extends ReaderParser implements PlainTextCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java
index d1d9580..c54b26f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextParserBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.plaintext;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -640,6 +641,12 @@
}
@Override /* ContextBuilder */
+ public PlainTextParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public PlainTextParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
index 6e65e1f..fc9c17a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializer.java
@@ -35,7 +35,7 @@
* transform defined on it.
*/
@ConfigurableContext
-public class PlainTextSerializer extends WriterSerializer {
+public class PlainTextSerializer extends WriterSerializer implements PlainTextCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java
index 79dadf4..3af9926 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/PlainTextSerializerBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.plaintext;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -766,6 +767,12 @@
}
@Override /* ContextBuilder */
+ public PlainTextSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public PlainTextSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainText.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainText.java
new file mode 100644
index 0000000..871fda0
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainText.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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 static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.plaintext.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link PlainTextSerializer} and {@link PlainTextParser}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface PlainText {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link PlainTextConfig#annotatePlainText()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfig.java
index ee433fa..f829dbe 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfig.java
@@ -40,4 +40,29 @@
* Can be used to override default ordering and application of config annotations.
*/
int rank() default 0;
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // PlainTextCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link PlainText @PlainText} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link PlainText#on() @PlainText.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ PlainText[] annotatePlainText() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // PlainTextSerializer
+ //-------------------------------------------------------------------------------------------------------------------
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // PlainTextParser
+ //-------------------------------------------------------------------------------------------------------------------
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfigApply.java
index b96d81e..7a5c5fe 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextConfigApply.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.plaintext.annotation;
+import static org.apache.juneau.Context.*;
+
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
import org.apache.juneau.svl.*;
@@ -33,5 +35,9 @@
@Override
public void apply(AnnotationInfo<PlainTextConfig> ai, PropertyStoreBuilder psb) {
+ PlainTextConfig a = ai.getAnnotation();
+
+ if (a.annotatePlainText().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotatePlainText());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerBuilder.java
index ced7148..1579a66 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/OutputStreamSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.serializer.OutputStreamSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -604,6 +605,12 @@
}
@Override /* ContextBuilder */
+ public OutputStreamSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public OutputStreamSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
index 60fca02..e39a1fd 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.serializer.Serializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -1018,6 +1019,12 @@
}
@Override /* ContextBuilder */
+ public SerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public SerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
index 9ed107f..f642095 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java
@@ -16,6 +16,7 @@
import static org.apache.juneau.serializer.OutputStreamSerializer.*;
import static org.apache.juneau.serializer.WriterSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -1192,6 +1193,12 @@
}
@Override /* ContextBuilder */
+ public SerializerGroupBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public SerializerGroupBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerBuilder.java
index 70eed8a..f103528 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/WriterSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.serializer.WriterSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -713,6 +714,12 @@
}
@Override /* ContextBuilder */
+ public WriterSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public WriterSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlCommon.java
new file mode 100644
index 0000000..3714b0d
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to the {@link SoapXmlSerializer} and future parser classes.
+ */
+public interface SoapXmlCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "SoapXml";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java
index dbe9422..1a7ca6a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java
@@ -31,7 +31,7 @@
* Essentially the same output as {@link XmlDocSerializer}, except wrapped in a standard SOAP envelope.
*/
@ConfigurableContext
-public final class SoapXmlSerializer extends XmlSerializer {
+public final class SoapXmlSerializer extends XmlSerializer implements SoapXmlCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
index fe54a57..8ecafba 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.soap.SoapXmlSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -785,6 +786,12 @@
}
@Override /* ContextBuilder */
+ public SoapXmlSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public SoapXmlSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXml.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXml.java
new file mode 100644
index 0000000..3c2bcf4
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXml.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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 java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.soap.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link SoapXmlSerializer}}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface SoapXml {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link SoapXmlConfig#annotateSoapXml()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfig.java
index 1c10d1b..b61de24 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfig.java
@@ -42,6 +42,23 @@
int rank() default 0;
//-------------------------------------------------------------------------------------------------------------------
+ // SoapXmlCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link SoapXml @SoapXml} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link SoapXml#on() @SoapXml.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ SoapXml[] annotateSoapXml() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
// SoapXmlSerializer
//-------------------------------------------------------------------------------------------------------------------
@@ -53,4 +70,8 @@
* </ul>
*/
String soapAction() default "";
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // SoapXmlParser
+ //-------------------------------------------------------------------------------------------------------------------
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigApply.java
index cb17533..957d929 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigApply.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.soap.annotation;
+import static org.apache.juneau.Context.*;
import static org.apache.juneau.soap.SoapXmlSerializer.*;
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
@@ -35,7 +36,11 @@
@Override
public void apply(AnnotationInfo<SoapXmlConfig> ai, PropertyStoreBuilder psb) {
SoapXmlConfig a = ai.getAnnotation();
+
if (! a.soapAction().isEmpty())
psb.set(SOAPXML_SOAPAction, string(a.soapAction()));
+
+ if (a.annotateSoapXml().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateSoapXml());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonCommon.java
new file mode 100644
index 0000000..432d79e
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link UonSerializer} and {@link UonParser} classes.
+ */
+public interface UonCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "Uon";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java
index aff7c9f..68317f1 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParser.java
@@ -32,7 +32,7 @@
* This parser uses a state machine, which makes it very fast and efficient.
*/
@ConfigurableContext
-public class UonParser extends ReaderParser implements HttpPartParser {
+public class UonParser extends ReaderParser implements HttpPartParser, UonCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
index d0dda7e..aa54741 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.uon.UonParser.*;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -715,6 +716,12 @@
}
@Override /* ContextBuilder */
+ public UonParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public UonParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java
index 2aad368..cd2525b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializer.java
@@ -116,7 +116,7 @@
* </p>
*/
@ConfigurableContext
-public class UonSerializer extends WriterSerializer implements HttpPartSerializer {
+public class UonSerializer extends WriterSerializer implements HttpPartSerializer, UonCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
index 1b357f1..9ae23ed 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.uon.UonSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -857,6 +858,12 @@
}
@Override /* ContextBuilder */
+ public UonSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public UonSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/Uon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/Uon.java
new file mode 100644
index 0000000..cca8bbb
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/Uon.java
@@ -0,0 +1,55 @@
+// ***************************************************************************************************************************
+// * 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 java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.*;
+
+import org.apache.juneau.uon.*;
+
+/**
+ * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link UonSerializer} and {@link UonParser}.
+ *
+ * <ul class='seealso'>
+ * </ul>
+ */
+@Documented
+@Target({TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+@Inherited
+public @interface Uon {
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link UonConfig#annotateUon()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfig.java
index 9e40c5b..f50f97d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfig.java
@@ -44,6 +44,23 @@
int rank() default 0;
//-------------------------------------------------------------------------------------------------------------------
+ // UonCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link Uon @Uon} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Uon#on() @Uon.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Uon[] annotateUon() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
// UonParser
//-------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigApply.java
index 81d66d9..4a24702 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigApply.java
@@ -47,5 +47,8 @@
psb.set(UON_decoding, bool(a.decoding()));
if (! a.validateEnd().isEmpty())
psb.set(UON_validateEnd, bool(a.validateEnd()));
+
+ if (a.annotateUon().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateUon());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingCommon.java
new file mode 100644
index 0000000..35747c7
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link UrlEncodingSerializer} and {@link UrlEncodingParser} classes.
+ */
+public interface UrlEncodingCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "UrlEncoding";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
index 0efa945..2bcd867 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParser.java
@@ -39,7 +39,7 @@
* This parser uses a state machine, which makes it very fast and efficient.
*/
@ConfigurableContext
-public class UrlEncodingParser extends UonParser implements UrlEncodingMetaProvider {
+public class UrlEncodingParser extends UonParser implements UrlEncodingMetaProvider, UrlEncodingCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
index 19d1629..58e0e60 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.urlencoding.UrlEncodingParser.*;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -660,6 +661,12 @@
}
@Override /* ContextBuilder */
+ public UrlEncodingParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public UrlEncodingParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
index 61bfd92..c25aa20 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializer.java
@@ -115,7 +115,7 @@
* </p>
*/
@ConfigurableContext
-public class UrlEncodingSerializer extends UonSerializer implements UrlEncodingMetaProvider {
+public class UrlEncodingSerializer extends UonSerializer implements UrlEncodingMetaProvider, UrlEncodingCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
index 98ab65e..aaa06c9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.urlencoding.UrlEncodingSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -829,6 +830,12 @@
}
@Override /* ContextBuilder */
+ public UrlEncodingSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public UrlEncodingSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java
index d8b9d2d..61b9d5f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncoding.java
@@ -37,4 +37,26 @@
* and {@link UrlEncodingParser#URLENC_expandedParams} properties, but applies to only instances of this bean.
*/
boolean expandedParams() default false;
+
+ /**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link UrlEncodingConfig#annotateUrlEncoding()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfig.java
index 090cc8d..a6c02dc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfig.java
@@ -42,6 +42,23 @@
int rank() default 0;
//-------------------------------------------------------------------------------------------------------------------
+ // UrlEncodingCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link UrlEncoding @UrlEncoding} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link UrlEncoding#on() @UrlEncoding.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ UrlEncoding[] annotateUrlEncoding() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
// UrlEncodingSerializer
//-------------------------------------------------------------------------------------------------------------------
@@ -79,4 +96,8 @@
* </ul>
*/
String expandedParams() default "";
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // UrlEncodingParser
+ //-------------------------------------------------------------------------------------------------------------------
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigApply.java
index eb43927..30de2a7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigApply.java
@@ -12,6 +12,8 @@
// ***************************************************************************************************************************
package org.apache.juneau.urlencoding.annotation;
+import static org.apache.juneau.Context.*;
+
import org.apache.juneau.*;
import org.apache.juneau.reflect.*;
import org.apache.juneau.svl.*;
@@ -35,9 +37,13 @@
@Override
public void apply(AnnotationInfo<UrlEncodingConfig> ai, PropertyStoreBuilder psb) {
UrlEncodingConfig a = ai.getAnnotation();
+
if (! a.expandedParams().isEmpty()) {
psb.set(UrlEncodingSerializer.URLENC_expandedParams, bool(a.expandedParams()));
psb.set(UrlEncodingParser.URLENC_expandedParams, bool(a.expandedParams()));
}
+
+ if (a.annotateUrlEncoding().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateUrlEncoding());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ReflectionMap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ReflectionMap.java
new file mode 100644
index 0000000..d6602d3
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ReflectionMap.java
@@ -0,0 +1,224 @@
+// ***************************************************************************************************************************
+// * 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.utils;
+
+import static org.apache.juneau.internal.StringUtils.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.stream.*;
+
+/**
+ * Allows arbitrary objects to be mapped to classes and methods base on class/method name keys.
+ *
+ * @param <V> The type of object in this map.
+ */
+public class ReflectionMap<V> {
+
+ private final List<ClassEntry<V>> classEntries;
+ private final List<MethodEntry<V>> methodEntries;
+
+ /**
+ * Constructor.
+ *
+ * @param b Initializer object.
+ */
+ ReflectionMap(Builder<V> b) {
+ this.classEntries = Collections.unmodifiableList(new ArrayList<>(b.classEntries));
+ this.methodEntries = Collections.unmodifiableList(new ArrayList<>(b.methodEntries));
+ }
+
+ /**
+ * Static builder creator.
+ *
+ * @param <V> The type of object in this map.
+ * @param c The type of object in this map.
+ * @return A new instance of this object.
+ */
+ public static <V> ReflectionMap.Builder<V> create(Class<V> c) {
+ return new ReflectionMap.Builder<>();
+ }
+
+ /**
+ * Creates a new builder object for {@link ReflectionMap} objects.
+ *
+ * @param <V> The type of object in this map.
+ */
+ public static class Builder<V> {
+ List<ClassEntry<V>> classEntries = new ArrayList<>();
+ List<MethodEntry<V>> methodEntries = new ArrayList<>();
+
+ /**
+ * Adds a mapping to this builder.
+ *
+ * @param key
+ * The mapping key.
+ * <br>Can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ * @param value The value for this mapping.
+ * @return This object (for method chaining).
+ */
+ public Builder<V> append(String key, V value) {
+ if (isEmpty(key))
+ throw new RuntimeException("Invalid reflection signature: [" + key + "]");
+ for (String s : split(key)) {
+ if (s.endsWith("."))
+ throw new RuntimeException("Invalid reflection signature: [" + key + "]");
+ int i = s.lastIndexOf('.');
+ if (i == -1) {
+ classEntries.add(new ClassEntry<>(s, value));
+ } else {
+ String s1 = s.substring(0, i), s2 = s.substring(i+1);
+ if (Character.isUpperCase(s2.charAt(0))) {
+ classEntries.add(new ClassEntry<>(s, value));
+ } else {
+ methodEntries.add(new MethodEntry<>(s1, s2, value));
+ }
+ }
+ }
+
+ return this;
+ }
+
+ /**
+ * Create new instance of {@link ReflectionMap} based on the contents of this builder.
+ *
+ * @return A new {@link ReflectionMap} object.
+ */
+ public ReflectionMap<V> build() {
+ return new ReflectionMap<>(this);
+ }
+ }
+
+ /**
+ * Finds all entries in this map that matches the specified class.
+ *
+ * @param c The class to test for.
+ * @return All matching objects. Never <jk>null</jk>.
+ */
+ public List<V> find(Class<?> c) {
+ return classEntries.stream().filter(x -> x.matches(c)).map(x -> x.value).collect(Collectors.toList());
+ }
+
+ /**
+ * Finds first in this map that matches the specified class.
+ *
+ * @param c The class to test for.
+ * @return The matching object. Never <jk>null</jk>.
+ */
+ public Optional<V> findFirst(Class<?> c) {
+ return classEntries.stream().filter(x -> x.matches(c)).map(x -> x.value).findFirst();
+ }
+
+ /**
+ * Finds all entries in this map that matches the specified class.
+ *
+ * @param c The class to test for.
+ * @param ofType Only return objects of the specified type.
+ * @return All matching objects. Never <jk>null</jk>.
+ */
+ public List<V> find(Class<?> c, Class<? extends V> ofType) {
+ return classEntries.stream().filter(x -> x.matches(c)).map(x -> x.value).filter(x -> ofType.isInstance(x)).collect(Collectors.toList());
+ }
+
+ /**
+ * Finds first in this map that matches the specified class.
+ *
+ * @param c The class to test for.
+ * @param ofType Only return objects of the specified type.
+ * @return The matching object. Never <jk>null</jk>.
+ */
+ public Optional<V> findFirst(Class<?> c, Class<? extends V> ofType) {
+ return classEntries.stream().filter(x -> x.matches(c)).map(x -> x.value).filter(x -> ofType.isInstance(x)).findFirst();
+ }
+
+ /**
+ * Finds all entries in this map that matches the specified method.
+ *
+ * @param m The method to test for.
+ * @return All matching objects. Never <jk>null</jk>.
+ */
+ public List<V> find(Method m) {
+ return methodEntries.stream().filter(x -> x.matches(m)).map(x -> x.value).collect(Collectors.toList());
+ }
+
+ /**
+ * Finds first entry in this map that matches the specified method.
+ *
+ * @param m The method to test for.
+ * @return The matching object. Never <jk>null</jk>.
+ */
+ public Optional<V> findFirst(Method m) {
+ return methodEntries.stream().filter(x -> x.matches(m)).map(x -> x.value).findFirst();
+ }
+
+ /**
+ * Finds all entries in this map that matches the specified method.
+ *
+ * @param m The method to test for.
+ * @param ofType Only return objects of the specified type.
+ * @return All matching objects. Never <jk>null</jk>.
+ */
+ public List<V> find(Method m, Class<? extends V> ofType) {
+ return methodEntries.stream().filter(x -> x.matches(m)).map(x -> x.value).filter(x -> ofType.isInstance(x)).collect(Collectors.toList());
+ }
+
+ /**
+ * Finds first entries in this map that matches the specified method.
+ *
+ * @param m The method to test for.
+ * @param ofType Only return objects of the specified type.
+ * @return The matching object. Never <jk>null</jk>.
+ */
+ public Optional<V> findFirst(Method m, Class<? extends V> ofType) {
+ return methodEntries.stream().filter(x -> x.matches(m)).map(x -> x.value).filter(x -> ofType.isInstance(x)).findFirst();
+ }
+
+ static class ClassEntry<V> {
+ String className;
+ V value;
+
+ ClassEntry(String className, V value) {
+ this.className = className;
+ this.value = value;
+ }
+
+ public boolean matches(Class<?> c) {
+ return c != null && (className.equals(c.getName()) || className.equals(c.getSimpleName()));
+ }
+ }
+
+ static class MethodEntry<V> {
+ String className, methodName;
+ V value;
+
+ MethodEntry(String className, String methodName, V value) {
+ this.className = className;
+ this.methodName = methodName;
+ this.value = value;
+ }
+
+ public boolean matches(Method m) {
+ if (m == null)
+ return false;
+ Class<?> c = m.getDeclaringClass();
+ return m.getName().equals(methodName) && (c.getName().equals(className) || c.getSimpleName().equals(className));
+ }
+ }
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlCommon.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlCommon.java
new file mode 100644
index 0000000..c4dbdc7
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlCommon.java
@@ -0,0 +1,24 @@
+// ***************************************************************************************************************************
+// * 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;
+
+/**
+ * Configurable properties common to both the {@link XmlSerializer} and {@link XmlParser} classes.
+ */
+public interface XmlCommon {
+
+ /**
+ * Property prefix.
+ */
+ static final String PREFIX = "Xml";
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
index 508bdaa..abd2a1b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParser.java
@@ -34,7 +34,7 @@
* See the {@link XmlSerializer} class for a description of Juneau-generated XML.
*/
@ConfigurableContext
-public class XmlParser extends ReaderParser implements XmlMetaProvider {
+public class XmlParser extends ReaderParser implements XmlMetaProvider, XmlCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
index 82abb6a..a9db043 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.xml.XmlParser.*;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -818,6 +819,12 @@
}
@Override /* ContextBuilder */
+ public XmlParserBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public XmlParserBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
index 095b967..f48d2f8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
@@ -114,7 +114,7 @@
* </ul>
*/
@ConfigurableContext
-public class XmlSerializer extends WriterSerializer implements XmlMetaProvider {
+public class XmlSerializer extends WriterSerializer implements XmlMetaProvider, XmlCommon {
//-------------------------------------------------------------------------------------------------------------------
// Configurable properties
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
index 8f5dc65..61ccc1f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
@@ -14,6 +14,7 @@
import static org.apache.juneau.xml.XmlSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -966,6 +967,12 @@
}
@Override /* ContextBuilder */
+ public XmlSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public XmlSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/Xml.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/Xml.java
index e2610f9..41e7a33 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/Xml.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/Xml.java
@@ -134,6 +134,28 @@
String namespace() default "";
/**
+ * Defines which classes/methods this annotation applies to.
+ *
+ * <p>
+ * Used in conjunction with the {@link XmlConfig#annotateXml()}.
+ * It is ignored when the annotation is applied directly to classes and methods.
+ *
+ * The format can be any of the following:
+ * <ul>
+ * <li>Full class name (e.g. <js>"com.foo.MyClass"</js>).
+ * <li>Simple class name (e.g. <js>"MyClass"</js>).
+ * <li>Full method name (e.g. <js>"com.foo.MyClass.myMethod"</js>).
+ * <li>Simple method name (e.g. <js>"MyClass.myMethod"</js>).
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* Sets the XML prefix of this property or class.
*
* <ul class='spaced-list'>
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java
index e436ce8..868b77d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java
@@ -48,6 +48,23 @@
int rank() default 0;
//-------------------------------------------------------------------------------------------------------------------
+ // XmlCommon
+ //-------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Indirectly applies {@link Xml @Xml} annotations to classes/methods.
+ *
+ * <p>
+ * Provides an alternate approach for applying annotations to classes/methods annotations using the {@link Xml#on() @Xml.on}
+ * annotation to specify the class/method names to apply the annotation to.
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * </ul>
+ */
+ Xml[] annotateXml() default {};
+
+ //-------------------------------------------------------------------------------------------------------------------
// XmlParser
//-------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java
index 8dbde6d..897f8f8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java
@@ -62,5 +62,8 @@
psb.set(XML_resolver, a.resolver());
if (! a.validating().isEmpty())
psb.set(XML_validating, bool(a.validating()));
+
+ if (a.annotateXml().length > 0)
+ psb.addTo(CONTEXT_annotations, a.annotateXml());
}
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerBuilder.java
index 956367b..f4d0a80 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerBuilder.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.xmlschema;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.*;
@@ -809,6 +810,12 @@
}
@Override /* ContextBuilder */
+ public XmlSchemaSerializerBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public XmlSchemaSerializerBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-doc/docs/Topics/02.juneau-marshall/08.ClassMethodAnnotations.html b/juneau-doc/docs/Topics/02.juneau-marshall/08.ClassMethodAnnotations.html
new file mode 100644
index 0000000..4264d4e
--- /dev/null
+++ b/juneau-doc/docs/Topics/02.juneau-marshall/08.ClassMethodAnnotations.html
@@ -0,0 +1,20 @@
+<!--
+/***************************************************************************************************************************
+ * 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.
+ ***************************************************************************************************************************/
+ -->
+
+{new} Class/Method Annotations
+
+<p>
+ TODO
+</p>
\ No newline at end of file
diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
index 266ea17..0a0fce8 100644
--- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
+++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
@@ -21,6 +21,7 @@
import static org.apache.juneau.serializer.WriterSerializer.*;
import static org.apache.juneau.uon.UonSerializer.*;
+import java.lang.annotation.*;
import java.lang.reflect.*;
import java.net.*;
import java.net.URI;
@@ -2797,6 +2798,12 @@
}
@Override /* ContextBuilder */
+ public RestClientBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public RestClientBuilder set(String name, Object value) {
super.set(name, value);
return this;
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
index be5097a..0610221 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
@@ -19,6 +19,7 @@
import static org.apache.juneau.serializer.Serializer.*;
import static org.apache.juneau.internal.CollectionUtils.*;
+import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
@@ -2872,6 +2873,12 @@
}
@Override /* ContextBuilder */
+ public RestContextBuilder annotations(Annotation...values) {
+ super.annotations(values);
+ return this;
+ }
+
+ @Override /* ContextBuilder */
public RestContextBuilder set(String name, Object value) {
super.set(name, value);
this.properties.put(name, value);