JUNEAU-169 Dynamic annotations.
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
index c7370f7..ec1cd9f 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
@@ -40,7 +40,8 @@
public class RoundTripTransformBeansTest extends RoundTripTest {
public RoundTripTransformBeansTest(String label, SerializerBuilder s, ParserBuilder p, int flags) throws Exception {
- super(label, s, p, flags);
+ super(label, s == null ? null : s.applyAnnotations(Bc.class, E1c.class, F1c.class, F2ac.class), p == null ? null : p.applyAnnotations(Bc.class, E1c.class, F1c.class, F2ac.class), flags);
+
}
//====================================================================================================
@@ -241,6 +242,33 @@
}
}
+ @Test
+ public void testSwaps_usingConfig() throws Exception {
+ Bc t = new Bc();
+ t.f1 = "bar";
+ t = roundTrip(t, Bc.class);
+
+ assertEquals("bar", t.f1);
+ }
+
+ @BeanConfig(applySwap=@Swap(on="Bc",value=BcSwap.class))
+ public static class Bc {
+ public String f1;
+ }
+
+ public static class BcSwap extends StringSwap<Bc> {
+ @Override /* PojoSwap */
+ public String swap(BeanSession session, Bc o) throws SerializeException {
+ return o.f1;
+ }
+ @Override /* PojoSwap */
+ public Bc unswap(BeanSession session, String f, ClassMeta<?> hint) throws ParseException {
+ Bc b1 = new Bc();
+ b1.f1 = f;
+ return b1;
+ }
+ }
+
//====================================================================================================
// testXMLGregorianCalendar - Test XMLGregorianCalendarSwap class.
//====================================================================================================
@@ -412,6 +440,48 @@
}
}
+ @Test
+ public void testSurrogatesThroughAnnotation_usingConfig() throws Exception {
+ JsonSerializer s = SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(E1c.class).build();
+ JsonParser p = JsonParser.DEFAULT.builder().applyAnnotations(E1c.class).build();
+ Object r;
+ E1c x = E1c.create();
+
+ r = s.serialize(x);
+ assertEquals("{f2:'f1'}", r);
+
+ x = p.parse(r, E1c.class);
+ assertEquals("f1", x.f1);
+
+ r = getSerializer().serialize(x);
+ assertTrue(TestUtils.toString(r).contains("f2"));
+
+ x = roundTrip(x, E1c.class);
+ }
+
+ @BeanConfig(applySwap=@Swap(on="E1c",value=E2c.class))
+ public static class E1c {
+ public String f1;
+
+ public static E1c create() {
+ E1c x = new E1c();
+ x.f1 = "f1";
+ return x;
+ }
+ }
+
+ public static class E2c implements Surrogate {
+ public String f2;
+ public E2c(E1c x) {
+ f2 = x.f1;
+ }
+ public E2c() {}
+ public E1c create() {
+ E1c x = new E1c();
+ x.f1 = this.f2;
+ return x;
+ }
+ }
//====================================================================================================
// Transforms on private fields.
@@ -454,6 +524,43 @@
x = roundTrip(x, F1.class);
}
+ @BeanConfig(applySwap=@Swap(on="F1c.c", value=TemporalCalendarSwap.IsoLocalDateTime.class))
+ public static class F1c {
+
+ private Calendar c;
+
+ public void setC(Calendar c) {
+ this.c = c;
+ }
+
+ public Calendar getC() {
+ return c;
+ }
+
+ public static F1c create() {
+ F1c x = new F1c();
+ x.setC(parseISO8601Calendar("2018-12-12T05:12:00"));
+ return x;
+ }
+ }
+
+ @Test
+ public void testSwapOnPrivateField_usingConfig() throws Exception {
+ JsonSerializer s = SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(F1c.class).build();
+ JsonParser p = JsonParser.DEFAULT.builder().applyAnnotations(F1c.class).build();
+
+ F1c x = F1c.create();
+ String r = null;
+
+ r = s.serialize(x);
+ assertEquals("{c:'2018-12-12T05:12:00'}", r);
+
+ x = p.parse(r, F1c.class);
+ assertObjectEquals("{c:'2018-12-12T05:12:00'}", x, s);
+
+ x = roundTrip(x, F1c.class);
+ }
+
public static class F2a {
@Swap(TemporalCalendarSwap.IsoLocalDateTime.class)
@@ -494,4 +601,44 @@
x = roundTrip(x, F2.class);
}
+
+ @BeanConfig(applySwap=@Swap(on="F2ac.c", value=TemporalCalendarSwap.IsoLocalDateTime.class))
+ public static class F2ac {
+ protected Calendar c;
+ }
+
+ public static class F2c extends F2ac {
+
+ public void setC(Calendar c) {
+ this.c = c;
+ }
+
+ public Calendar getC() {
+ return c;
+ }
+
+ public static F2c create() {
+ F2c x = new F2c();
+ x.setC(parseISO8601Calendar("2018-12-12T05:12:00"));
+ return x;
+ }
+ }
+
+ @Test
+ public void testSwapOnPrivateField_Inherited_usingConfig() throws Exception {
+ JsonSerializer s = SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(F2ac.class).build();
+ JsonParser p = JsonParser.DEFAULT.builder().applyAnnotations(F2ac.class).build();
+
+ F2 x = F2.create();
+ String r = null;
+
+ r = s.serialize(x);
+ assertEquals("{c:'2018-12-12T05:12:00'}", r);
+
+ x = p.parse(r, F2.class);
+ assertObjectEquals("{c:'2018-12-12T05:12:00'}", x, s);
+
+ x = roundTrip(x, F2.class);
+ }
+
}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/BasicHtmlTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/BasicHtmlTest.java
index f8b8139..cc30b3f 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/BasicHtmlTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/BasicHtmlTest.java
@@ -32,7 +32,7 @@
public class BasicHtmlTest {
private static final Class<?>[] ANNOTATED_CLASSES = {
- BeanWithWhitespaceTextFields2.class, BeanWithWhitespaceTextPwsFields2.class, BeanWithWhitespaceMixedFields2.class, BeanWithWhitespaceMixedPwsFields2.class
+ BeanWithWhitespaceTextFields2.class, BeanWithWhitespaceTextPwsFields2.class, BeanWithWhitespaceMixedFields2.class, BeanWithWhitespaceMixedPwsFields2.class, LinkBeanC.class
};
private static final HtmlSerializer
s1 = HtmlSerializer.DEFAULT_SQ.builder().addRootType().applyAnnotations(ANNOTATED_CLASSES).build(),
@@ -1477,6 +1477,146 @@
}
},
{ /* 28 */
+ new Input<LinkBeanC>(
+ "LinkBeanC-1",
+ LinkBeanC.class,
+ new LinkBeanC().init(),
+ "<a href='http://apache.org'>foo</a>",
+ "<a href='http://apache.org'>foo</a>",
+ "<a href='http://apache.org'>foo</a>"
+ )
+ {
+ @Override
+ public void verify(LinkBeanC o) {
+ assertInstanceOf(LinkBeanC.class, o);
+ }
+ }
+ },
+ { /* 29 */
+ new Input<LinkBeanC[]>(
+ "LinkBeanC-2",
+ LinkBeanC[].class,
+ new LinkBeanC[]{new LinkBeanC().init(),new LinkBeanC().init()},
+ "<ul><li><a href='http://apache.org'>foo</a></li><li><a href='http://apache.org'>foo</a></li></ul>",
+ "<ul>\n\t<li><a href='http://apache.org'>foo</a></li>\n\t<li><a href='http://apache.org'>foo</a></li>\n</ul>\n",
+ "<ul><li><a href='http://apache.org'>foo</a></li><li><a href='http://apache.org'>foo</a></li></ul>"
+ )
+ {
+ @Override
+ public void verify(LinkBeanC[] o) {
+ assertInstanceOf(LinkBeanC.class, o[0]);
+ }
+ }
+ },
+ { /* 30 */
+ new Input<List<LinkBeanC>>(
+ "ListWithLinkBeansC",
+ ListWithLinkBeansC.class,
+ new ListWithLinkBeansC().append(new LinkBeanC().init()).append(new LinkBeanC().init()),
+ "<ul><li><a href='http://apache.org'>foo</a></li><li><a href='http://apache.org'>foo</a></li></ul>",
+ "<ul>\n\t<li><a href='http://apache.org'>foo</a></li>\n\t<li><a href='http://apache.org'>foo</a></li>\n</ul>\n",
+ "<ul><li><a href='http://apache.org'>foo</a></li><li><a href='http://apache.org'>foo</a></li></ul>"
+ )
+ {
+ @Override
+ public void verify(List<LinkBeanC> o) {
+ assertInstanceOf(LinkBeanC.class, o.get(0));
+ }
+ }
+ },
+ { /* 31 */
+ new Input<BeanWithLinkBeanPropertiesC>(
+ "BeanWithLinkBeanPropertiesC",
+ BeanWithLinkBeanPropertiesC.class,
+ new BeanWithLinkBeanPropertiesC().init(),
+ "<table>"
+ +"<tr>"
+ +"<td>a</td>"
+ +"<td><a href='http://apache.org'>foo</a></td>"
+ +"</tr>"
+ +"<tr>"
+ +"<td>b</td>"
+ +"<td>"
+ +"<ul>"
+ +"<li><a href='http://apache.org'>foo</a></li>"
+ +"</ul>"
+ +"</td>"
+ +"</tr>"
+ +"<tr>"
+ +"<td>c</td>"
+ +"<td>"
+ +"<table>"
+ +"<tr>"
+ +"<td>c1</td>"
+ +"<td><a href='http://apache.org'>foo</a></td>"
+ +"</tr>"
+ +"</table>"
+ +"</td>"
+ +"</tr>"
+ +"</table>",
+
+ "<table>\n"
+ +"\t<tr>\n"
+ +"\t\t<td>a</td>\n"
+ +"\t\t<td><a href='http://apache.org'>foo</a></td>\n"
+ +"\t</tr>\n"
+ +"\t<tr>\n"
+ +"\t\t<td>b</td>\n"
+ +"\t\t<td>\n"
+ +"\t\t\t<ul>\n"
+ +"\t\t\t\t<li><a href='http://apache.org'>foo</a></li>\n"
+ +"\t\t\t</ul>\n"
+ +"\t\t</td>\n"
+ +"\t</tr>\n"
+ +"\t<tr>\n"
+ +"\t\t<td>c</td>\n"
+ +"\t\t<td>\n"
+ +"\t\t\t<table>\n"
+ +"\t\t\t\t<tr>\n"
+ +"\t\t\t\t\t<td>c1</td>\n"
+ +"\t\t\t\t\t<td><a href='http://apache.org'>foo</a></td>\n"
+ +"\t\t\t\t</tr>\n"
+ +"\t\t\t</table>\n"
+ +"\t\t</td>\n"
+ +"\t</tr>\n"
+ +"</table>\n",
+
+ "<table>"
+ +"<tr>"
+ +"<td>a</td>"
+ +"<td><a href='http://apache.org'>foo</a></td>"
+ +"</tr>"
+ +"<tr>"
+ +"<td>b</td>"
+ +"<td>"
+ +"<ul>"
+ +"<li><a href='http://apache.org'>foo</a></li>"
+ +"</ul>"
+ +"</td>"
+ +"</tr>"
+ +"<tr>"
+ +"<td>c</td>"
+ +"<td>"
+ +"<table>"
+ +"<tr>"
+ +"<td>c1</td>"
+ +"<td><a href='http://apache.org'>foo</a></td>"
+ +"</tr>"
+ +"</table>"
+ +"</td>"
+ +"</tr>"
+ +"</table>"
+ )
+ {
+ @Override
+ public void verify(BeanWithLinkBeanPropertiesC o) {
+ assertInstanceOf(LinkBeanC.class, o.a);
+ assertInstanceOf(LinkBeanC.class, o.b.get(0));
+ assertInstanceOf(LinkBeanC.class, o.c.get("c1"));
+ }
+ }
+ },
+ { /* 32 */
new Input<BeanWithSpecialCharacters>(
"BeanWithSpecialCharacters",
BeanWithSpecialCharacters.class,
@@ -1492,7 +1632,7 @@
}
}
},
- { /* 29 */
+ { /* 33 */
new Input<BeanWithSpecialCharacters>(
"BeanWithSpecialCharacters-2",
BeanWithSpecialCharacters.class,
@@ -1515,7 +1655,7 @@
}
}
},
- { /* 30 */
+ { /* 34 */
new Input<BeanWithNullProperties>(
"BeanWithNullProperties",
BeanWithNullProperties.class,
@@ -1531,7 +1671,7 @@
}
}
},
- { /* 31 */
+ { /* 35 */
new Input<BeanWithAbstractFields>(
"BeanWithAbstractFields",
BeanWithAbstractFields.class,
@@ -1687,7 +1827,7 @@
}
}
},
- { /* 32 */
+ { /* 36 */
new Input<BeanWithAbstractArrayFields>(
"BeanWithAbstractArrayFields",
BeanWithAbstractArrayFields.class,
@@ -1987,7 +2127,7 @@
}
}
},
- { /* 33 */
+ { /* 37 */
new Input<BeanWithAbstractMapFields>(
"BeanWithAbstractMapFields",
BeanWithAbstractMapFields.class,
@@ -2172,7 +2312,7 @@
}
}
},
- { /* 34 */
+ { /* 38 */
new Input<BeanWithWhitespaceTextFields>(
"BeanWithWhitespaceTextFields-1",
BeanWithWhitespaceTextFields.class,
@@ -2188,7 +2328,7 @@
}
}
},
- { /* 35 */
+ { /* 39 */
new Input<BeanWithWhitespaceTextFields>(
"BeanWithWhitespaceTextFields-2",
BeanWithWhitespaceTextFields.class,
@@ -2204,7 +2344,7 @@
}
}
},
- { /* 36 */
+ { /* 40 */
new Input<BeanWithWhitespaceTextFields>(
"BeanWithWhitespaceTextFields-3",
BeanWithWhitespaceTextFields.class,
@@ -2220,7 +2360,7 @@
}
}
},
- { /* 37 */
+ { /* 41 */
new Input<BeanWithWhitespaceTextFields>(
"BeanWithWhitespaceTextFields-4",
BeanWithWhitespaceTextFields.class,
@@ -2236,7 +2376,7 @@
}
}
},
- { /* 38 */
+ { /* 42 */
new Input<BeanWithWhitespaceTextFields>(
"BeanWithWhitespaceTextFields-5",
BeanWithWhitespaceTextFields.class,
@@ -2252,7 +2392,7 @@
}
}
},
- { /* 39 */
+ { /* 43 */
new Input<BeanWithWhitespaceTextPwsFields>(
"BeanWithWhitespaceTextPwsFields-1",
BeanWithWhitespaceTextPwsFields.class,
@@ -2268,7 +2408,7 @@
}
}
},
- { /* 40 */
+ { /* 44 */
new Input<BeanWithWhitespaceTextPwsFields>(
"BeanWithWhitespaceTextPwsFields-2",
BeanWithWhitespaceTextPwsFields.class,
@@ -2284,7 +2424,7 @@
}
}
},
- { /* 41 */
+ { /* 45 */
new Input<BeanWithWhitespaceTextPwsFields>(
"BeanWithWhitespaceTextPwsFields-3",
BeanWithWhitespaceTextPwsFields.class,
@@ -2300,7 +2440,7 @@
}
}
},
- { /* 42 */
+ { /* 46 */
new Input<BeanWithWhitespaceTextPwsFields>(
"BeanWithWhitespaceTextPwsFields-4",
BeanWithWhitespaceTextPwsFields.class,
@@ -2316,7 +2456,7 @@
}
}
},
- { /* 43 */
+ { /* 47 */
new Input<BeanWithWhitespaceTextPwsFields>(
"BeanWithWhitespaceTextPwsFields-5",
BeanWithWhitespaceTextPwsFields.class,
@@ -2332,7 +2472,7 @@
}
}
},
- { /* 44 */
+ { /* 48 */
new Input<BeanWithWhitespaceMixedFields>(
"BeanWithWhitespaceMixedFields-1",
BeanWithWhitespaceMixedFields.class,
@@ -2348,7 +2488,7 @@
}
}
},
- { /* 45 */
+ { /* 49 */
new Input<BeanWithWhitespaceMixedFields>(
"BeanWithWhitespaceMixedFields-2",
BeanWithWhitespaceMixedFields.class,
@@ -2364,7 +2504,7 @@
}
}
},
- { /* 46 */
+ { /* 50 */
new Input<BeanWithWhitespaceMixedFields>(
"BeanWithWhitespaceMixedFields-3",
BeanWithWhitespaceMixedFields.class,
@@ -2380,7 +2520,7 @@
}
}
},
- { /* 47 */
+ { /* 51 */
new Input<BeanWithWhitespaceMixedFields>(
"BeanWithWhitespaceMixedFields-4",
BeanWithWhitespaceMixedFields.class,
@@ -2396,7 +2536,7 @@
}
}
},
- { /* 48 */
+ { /* 52 */
new Input<BeanWithWhitespaceMixedFields>(
"BeanWithWhitespaceMixedFields-5",
BeanWithWhitespaceMixedFields.class,
@@ -2412,7 +2552,7 @@
}
}
},
- { /* 49 */
+ { /* 53 */
new Input<BeanWithWhitespaceMixedFields>(
"BeanWithWhitespaceMixedFields-6",
BeanWithWhitespaceMixedFields.class,
@@ -2428,7 +2568,7 @@
}
}
},
- { /* 50 */
+ { /* 54 */
new Input<BeanWithWhitespaceMixedPwsFields>(
"BeanWithWhitespaceMixedPwsFields-1",
BeanWithWhitespaceMixedPwsFields.class,
@@ -2444,7 +2584,7 @@
}
}
},
- { /* 51 */
+ { /* 55 */
new Input<BeanWithWhitespaceMixedPwsFields>(
"BeanWithWhitespaceMixedPwsFields-2",
BeanWithWhitespaceMixedPwsFields.class,
@@ -2460,7 +2600,7 @@
}
}
},
- { /* 52 */
+ { /* 56 */
new Input<BeanWithWhitespaceMixedPwsFields>(
"BeanWithWhitespaceMixedPwsFields-3",
BeanWithWhitespaceMixedPwsFields.class,
@@ -2476,7 +2616,7 @@
}
}
},
- { /* 53 */
+ { /* 57 */
new Input<BeanWithWhitespaceMixedPwsFields>(
"BeanWithWhitespaceMixedPwsFields-4",
BeanWithWhitespaceMixedPwsFields.class,
@@ -2492,7 +2632,7 @@
}
}
},
- { /* 54 */
+ { /* 58 */
new Input<BeanWithWhitespaceMixedPwsFields>(
"BeanWithWhitespaceMixedPwsFields-5",
BeanWithWhitespaceMixedPwsFields.class,
@@ -2508,7 +2648,7 @@
}
}
},
- { /* 55 */
+ { /* 59 */
new Input<BeanWithWhitespaceMixedPwsFields>(
"BeanWithWhitespaceMixedPwsFields-6",
BeanWithWhitespaceMixedPwsFields.class,
@@ -2524,7 +2664,7 @@
}
}
},
- { /* 56 */
+ { /* 60 */
new Input<BeanWithWhitespaceTextFields2>(
"BeanWithWhitespaceTextFields2-1",
BeanWithWhitespaceTextFields2.class,
@@ -2540,7 +2680,7 @@
}
}
},
- { /* 57 */
+ { /* 61 */
new Input<BeanWithWhitespaceTextFields2>(
"BeanWithWhitespaceTextFields2-2",
BeanWithWhitespaceTextFields2.class,
@@ -2556,7 +2696,7 @@
}
}
},
- { /* 58 */
+ { /* 62 */
new Input<BeanWithWhitespaceTextFields2>(
"BeanWithWhitespaceTextFields2-3",
BeanWithWhitespaceTextFields2.class,
@@ -2572,7 +2712,7 @@
}
}
},
- { /* 59 */
+ { /* 63 */
new Input<BeanWithWhitespaceTextFields2>(
"BeanWithWhitespaceTextFields2-4",
BeanWithWhitespaceTextFields2.class,
@@ -2588,7 +2728,7 @@
}
}
},
- { /* 60 */
+ { /* 64 */
new Input<BeanWithWhitespaceTextFields2>(
"BeanWithWhitespaceTextFields2-5",
BeanWithWhitespaceTextFields2.class,
@@ -2604,7 +2744,7 @@
}
}
},
- { /* 61 */
+ { /* 65 */
new Input<BeanWithWhitespaceTextPwsFields2>(
"BeanWithWhitespaceTextPwsFields2-1",
BeanWithWhitespaceTextPwsFields2.class,
@@ -2620,7 +2760,7 @@
}
}
},
- { /* 62 */
+ { /* 66 */
new Input<BeanWithWhitespaceTextPwsFields2>(
"BeanWithWhitespaceTextPwsFields2-2",
BeanWithWhitespaceTextPwsFields2.class,
@@ -2636,7 +2776,7 @@
}
}
},
- { /* 63 */
+ { /* 67 */
new Input<BeanWithWhitespaceTextPwsFields2>(
"BeanWithWhitespaceTextPwsFields2-3",
BeanWithWhitespaceTextPwsFields2.class,
@@ -2652,7 +2792,7 @@
}
}
},
- { /* 64 */
+ { /* 68 */
new Input<BeanWithWhitespaceTextPwsFields2>(
"BeanWithWhitespaceTextPwsFields2-4",
BeanWithWhitespaceTextPwsFields2.class,
@@ -2668,7 +2808,7 @@
}
}
},
- { /* 65 */
+ { /* 69 */
new Input<BeanWithWhitespaceTextPwsFields2>(
"BeanWithWhitespaceTextPwsFields2-5",
BeanWithWhitespaceTextPwsFields2.class,
@@ -2684,7 +2824,7 @@
}
}
},
- { /* 66 */
+ { /* 70 */
new Input<BeanWithWhitespaceMixedFields2>(
"BeanWithWhitespaceMixedFields2-1",
BeanWithWhitespaceMixedFields2.class,
@@ -2700,7 +2840,7 @@
}
}
},
- { /* 67 */
+ { /* 71 */
new Input<BeanWithWhitespaceMixedFields2>(
"BeanWithWhitespaceMixedFields2-2",
BeanWithWhitespaceMixedFields2.class,
@@ -2716,7 +2856,7 @@
}
}
},
- { /* 68 */
+ { /* 72 */
new Input<BeanWithWhitespaceMixedFields2>(
"BeanWithWhitespaceMixedFields2-3",
BeanWithWhitespaceMixedFields2.class,
@@ -2732,7 +2872,7 @@
}
}
},
- { /* 69 */
+ { /* 73 */
new Input<BeanWithWhitespaceMixedFields2>(
"BeanWithWhitespaceMixedFields2-4",
BeanWithWhitespaceMixedFields2.class,
@@ -2748,7 +2888,7 @@
}
}
},
- { /* 70 */
+ { /* 74 */
new Input<BeanWithWhitespaceMixedFields2>(
"BeanWithWhitespaceMixedFields2-5",
BeanWithWhitespaceMixedFields2.class,
@@ -2764,7 +2904,7 @@
}
}
},
- { /* 71 */
+ { /* 75 */
new Input<BeanWithWhitespaceMixedFields2>(
"BeanWithWhitespaceMixedFields2-6",
BeanWithWhitespaceMixedFields2.class,
@@ -2780,7 +2920,7 @@
}
}
},
- { /* 72 */
+ { /* 76 */
new Input<BeanWithWhitespaceMixedPwsFields2>(
"BeanWithWhitespaceMixedPwsFields2-1",
BeanWithWhitespaceMixedPwsFields2.class,
@@ -2796,7 +2936,7 @@
}
}
},
- { /* 73 */
+ { /* 77 */
new Input<BeanWithWhitespaceMixedPwsFields2>(
"BeanWithWhitespaceMixedPwsFields2-2",
BeanWithWhitespaceMixedPwsFields2.class,
@@ -2812,7 +2952,7 @@
}
}
},
- { /* 74 */
+ { /* 78 */
new Input<BeanWithWhitespaceMixedPwsFields2>(
"BeanWithWhitespaceMixedPwsFields2-3",
BeanWithWhitespaceMixedPwsFields2.class,
@@ -2828,7 +2968,7 @@
}
}
},
- { /* 75 */
+ { /* 79 */
new Input<BeanWithWhitespaceMixedPwsFields2>(
"BeanWithWhitespaceMixedPwsFields2-4",
BeanWithWhitespaceMixedPwsFields2.class,
@@ -2844,7 +2984,7 @@
}
}
},
- { /* 76 */
+ { /* 80 */
new Input<BeanWithWhitespaceMixedPwsFields2>(
"BeanWithWhitespaceMixedPwsFields2-5",
BeanWithWhitespaceMixedPwsFields2.class,
@@ -2860,7 +3000,7 @@
}
}
},
- { /* 77 */
+ { /* 81 */
new Input<BeanWithWhitespaceMixedPwsFields2>(
"BeanWithWhitespaceMixedPwsFields2-6",
BeanWithWhitespaceMixedPwsFields2.class,
@@ -3220,6 +3360,39 @@
}
}
+ @HtmlConfig(applyHtmlLink=@HtmlLink(on="LinkBeanC", nameProperty="a", uriProperty="b"))
+ public static class LinkBeanC {
+ public String a;
+ public String b;
+
+ LinkBeanC init() {
+ a = "foo";
+ b = "http://apache.org";
+ return this;
+ }
+ }
+
+ public static class ListWithLinkBeansC extends ArrayList<LinkBeanC> {
+ public ListWithLinkBeansC append(LinkBeanC value) {
+ this.add(value);
+ return this;
+ }
+ }
+
+ public static class BeanWithLinkBeanPropertiesC {
+ public LinkBeanC a;
+ public List<LinkBeanC> b;
+ public Map<String,LinkBeanC> c;
+
+ BeanWithLinkBeanPropertiesC init() {
+ a = new LinkBeanC().init();
+ b = new ListWithLinkBeansC().append(new LinkBeanC().init());
+ c = new LinkedHashMap<>();
+ c.put("c1", new LinkBeanC().init());
+ return this;
+ }
+ }
+
public static class BeanWithSpecialCharacters {
public String a;
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/CommonTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/CommonTest.java
index 176d951..5832564 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/CommonTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/html/CommonTest.java
@@ -303,12 +303,12 @@
}
public static class E1 {
- @Beanp(bpi="f1") public E2 x1 = new E2();
- @Beanp(bpi="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",3).append("f2",4);
- @Beanp(bpi="f1") public E2[] x3 = {new E2()};
- @Beanp(bpi="f1") public List<E2> x4 = new AList<E2>().append(new E2());
- @Beanp(bpi="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",5).append("f2",6)};
- @Beanp(bpi="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",7).append("f2",8));
+ @Beanp(properties="f1") public E2 x1 = new E2();
+ @Beanp(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",3).append("f2",4);
+ @Beanp(properties="f1") public E2[] x3 = {new E2()};
+ @Beanp(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
+ @Beanp(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",5).append("f2",6)};
+ @Beanp(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",7).append("f2",8));
}
public static class E2 {
@@ -343,7 +343,7 @@
}
public static class F {
- @Beanp(bpi="x2") public List<F> x1 = new LinkedList<>();
+ @Beanp(properties="x2") public List<F> x1 = new LinkedList<>();
public int x2 = 2;
}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jena/CommonTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jena/CommonTest.java
index 9bdb2e7..fa32c07 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jena/CommonTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jena/CommonTest.java
@@ -213,12 +213,12 @@
}
public static class E1 {
- @Beanp(bpi="f1") public E2 x1;
- @Beanp(bpi="f1") public Map<String,Integer> x2;
- @Beanp(bpi="f1") public E2[] x3;
- @Beanp(bpi="f1") public List<E2> x4;
- @Beanp(bpi="f1") public ObjectMap[] x5;
- @Beanp(bpi="f1") public List<ObjectMap> x6;
+ @Beanp(properties="f1") public E2 x1;
+ @Beanp(properties="f1") public Map<String,Integer> x2;
+ @Beanp(properties="f1") public E2[] x3;
+ @Beanp(properties="f1") public List<E2> x4;
+ @Beanp(properties="f1") public ObjectMap[] x5;
+ @Beanp(properties="f1") public List<ObjectMap> x6;
public static E1 create() {
E1 t = new E1();
@@ -256,7 +256,7 @@
}
public static class F {
- @Beanp(bpi="x2") public List<F> x1;
+ @Beanp(properties="x2") public List<F> x1;
public int x2;
public static F create() {
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/CommonTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/CommonTest.java
index 794bee5..09bfc49 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/CommonTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/json/CommonTest.java
@@ -195,12 +195,12 @@
}
public static class E1 {
- @Beanp(bpi="f1") public E2 x1 = new E2();
- @Beanp(bpi="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
- @Beanp(bpi="f1") public E2[] x3 = {new E2()};
- @Beanp(bpi="f1") public List<E2> x4 = new AList<E2>().append(new E2());
- @Beanp(bpi="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
- @Beanp(bpi="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
+ @Beanp(properties="f1") public E2 x1 = new E2();
+ @Beanp(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
+ @Beanp(properties="f1") public E2[] x3 = {new E2()};
+ @Beanp(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
+ @Beanp(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
+ @Beanp(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
}
public static class E2 {
@@ -223,7 +223,7 @@
}
public static class F {
- @Beanp(bpi="x2") public List<F> x1 = new LinkedList<>();
+ @Beanp(properties="x2") public List<F> x1 = new LinkedList<>();
public int x2 = 2;
}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURIc.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURIc.java
new file mode 100644
index 0000000..3b2c390
--- /dev/null
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURIc.java
@@ -0,0 +1,91 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.serializer;
+
+import java.net.URI;
+
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.jena.annotation.*;
+import org.apache.juneau.xml.annotation.*;
+
+@Bean(sort=true)
+@BeanConfig(
+ applyURI={
+ @org.apache.juneau.annotation.URI(on="TestURIc.f0,TestURIc.f2a,TestURIc.f2b,TestURIc.f2c,TestURIc.f2d,TestURIc.f2e,TestURIc.f2f,TestURIc.f2g,TestURIc.f2h,TestURIc.f2i,TestURIc.f2j,TestURIc.f2k,TestURIc.f2l,TestURIc.f2m,TestURIc.f2n,TestURIc.f2o,TestURIc.f3a,,TestURIc.f3b,TestURIc.f3c,TestURIc.getF5,TestURIbc")
+ }
+)
+public class TestURIc {
+
+ // String annotated as a URI
+ @Rdf(beanUri=true)
+ @Xml(format=XmlFormat.ATTR)
+ public String f0 = "f0/x0";
+
+ // URI properties
+ public URI
+ f1a = URI.create("http://www.apache.org/f1a"),
+ f1b = URI.create("/f1b"),
+ f1c = URI.create("/f1c/x/y"),
+ f1d = URI.create("f1d"),
+ f1e = URI.create("f1e/x/y"),
+ f1f = URI.create(""),
+ f1g = URI.create("servlet:/f1g/x"),
+ f1h = URI.create("servlet:/f1h"),
+ f1i = URI.create("servlet:/"),
+ f1j = URI.create("servlet:/.."),
+ f1k = URI.create("context:/f1j/x"),
+ f1l = URI.create("context:/f1k"),
+ f1m = URI.create("context:/"),
+ f1n = URI.create("context:/.."),
+ fio = null;
+
+ // Strings annotated with @URI properties
+ public String
+ f2a = "http://www.apache.org/f2a",
+ f2b = "/f2b",
+ f2c = "/f2c/x/y",
+ f2d = "f2d",
+ f2e = "f2e/x/y",
+ f2f = "",
+ f2g = "servlet:/f2g/x",
+ f2h = "servlet:/f2h",
+ f2i = "servlet:/",
+ f2j = "servlet:/..",
+ f2k = "context:/f2j/x",
+ f2l = "context:/f2k",
+ f2m = "context:/",
+ f2n = "context:/..",
+ f2o = null;
+
+ // Strings with labels
+ public String
+ f3a = "http://www.apache.org/f3a/x?label=MY_LABEL&foo=bar",
+ f3b = StringUtils.urlEncode("<>&'\""),
+ f3c = "<>&'\""; // Invalid URI, but should produce parsable output.
+
+ // @URI on bean
+ public TestURIbc f4 = new TestURIbc();
+
+ // @URI on bean property method.
+ public String getF5() {
+ return "f5/x";
+ }
+
+ public static class TestURIbc {
+ @Override /* Object */
+ public String toString() {
+ return "test/uri/b";
+ }
+ }
+}
\ No newline at end of file
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/UriResolutionTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/UriResolutionTest.java
index b1c712b..0ae0c65 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/UriResolutionTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/UriResolutionTest.java
@@ -543,11 +543,11 @@
});
};
- private void testSerialize(Serializer s, String expected) throws Exception {
+ private void testSerialize(Serializer s, String expected, Object testBean) throws Exception {
try {
boolean isRdf = s instanceof RdfSerializer;
- String r = s.serializeToString(new TestURI());
+ String r = s.serializeToString(testBean);
// Can't control RdfSerializer output well, so manually remove namespace declarations
// double-quotes with single-quotes, and spaces with tabs.
@@ -575,9 +575,9 @@
}
}
- private void testParse(Serializer s, Parser p) throws Exception {
+ private void testParse(Serializer s, Parser p, Object testBean) throws Exception {
try {
- String r = s.serializeToString(new TestURI());
+ String r = s.serializeToString(testBean);
TreeMap<String,String> m = p.parse(r, TreeMap.class, String.class, String.class);
@@ -595,78 +595,156 @@
@Test
public void a1_testJsonSerialize() throws Exception {
Serializer s = JsonSerializer.create().ssq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testSerialize(s, results.json);
+ testSerialize(s, results.json, new TestURI());
+ }
+
+ @Test
+ public void a1c_testJsonSerialize_usingConfig() throws Exception {
+ Serializer s = JsonSerializer.create().ssq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testSerialize(s, results.json, new TestURIc());
}
@Test
public void a2_testJsonParse() throws Exception {
Serializer s = JsonSerializer.create().ssq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testParse(s, JsonParser.DEFAULT);
+ testParse(s, JsonParser.DEFAULT, new TestURI());
+ }
+
+ @Test
+ public void a2c_testJsonParse_usingConfig() throws Exception {
+ Serializer s = JsonSerializer.create().ssq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testParse(s, JsonParser.DEFAULT.builder().applyAnnotations(TestURIc.class).build(), new TestURIc());
}
@Test
public void b1_testXmlSerialize() throws Exception {
Serializer s = XmlSerializer.create().sq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testSerialize(s, results.xml);
+ testSerialize(s, results.xml, new TestURI());
+ }
+
+ @Test
+ public void b1c_testXmlSerialize_usingConfig() throws Exception {
+ Serializer s = XmlSerializer.create().sq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testSerialize(s, results.xml, new TestURIc());
}
@Test
public void b2_testXmlParse() throws Exception {
Serializer s = XmlSerializer.create().sq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testParse(s, XmlParser.DEFAULT);
+ testParse(s, XmlParser.DEFAULT, new TestURI());
+ }
+
+ @Test
+ public void b2c_testXmlParse_usingConfig() throws Exception {
+ Serializer s = XmlSerializer.create().sq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testParse(s, XmlParser.DEFAULT.builder().applyAnnotations(TestURIc.class).build(), new TestURIc());
}
@Test
public void c1_testHtmlSerialize() throws Exception {
Serializer s = HtmlSerializer.create().sq().detectLabelParameters(true).uriAnchorText(AnchorText.LAST_TOKEN).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testSerialize(s, results.html);
+ testSerialize(s, results.html, new TestURI());
+ }
+
+ @Test
+ public void c1c_testHtmlSerialize_usingConfig() throws Exception {
+ Serializer s = HtmlSerializer.create().sq().detectLabelParameters(true).uriAnchorText(AnchorText.LAST_TOKEN).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testSerialize(s, results.html, new TestURIc());
}
@Test
public void c2_testHtmlParse() throws Exception {
Serializer s = HtmlSerializer.create().sq().detectLabelParameters(true).uriAnchorText(AnchorText.LAST_TOKEN).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testParse(s, HtmlParser.DEFAULT);
+ testParse(s, HtmlParser.DEFAULT, new TestURI());
+ }
+
+ @Test
+ public void c2c_testHtmlParse_usingConfig() throws Exception {
+ Serializer s = HtmlSerializer.create().sq().detectLabelParameters(true).uriAnchorText(AnchorText.LAST_TOKEN).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testParse(s, HtmlParser.DEFAULT.builder().applyAnnotations(TestURIc.class).build(), new TestURIc());
}
@Test
public void d1_testUonSerialize() throws Exception {
Serializer s = UonSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testSerialize(s, results.uon);
+ testSerialize(s, results.uon, new TestURI());
+ }
+
+ @Test
+ public void d1c_testUonSerialize_usingConfig() throws Exception {
+ Serializer s = UonSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testSerialize(s, results.uon, new TestURIc());
}
@Test
public void d2_testUonParse() throws Exception {
Serializer s = UonSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testParse(s, UonParser.DEFAULT);
+ testParse(s, UonParser.DEFAULT, new TestURI());
+ }
+
+ @Test
+ public void d2c_testUonParse_usingConfig() throws Exception {
+ Serializer s = UonSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testParse(s, UonParser.DEFAULT.builder().applyAnnotations(TestURIc.class).build(), new TestURIc());
}
@Test
public void e1_testUrlEncodingSerialize() throws Exception {
Serializer s = UrlEncodingSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testSerialize(s, results.urlEncoding);
+ testSerialize(s, results.urlEncoding, new TestURI());
+ }
+
+ @Test
+ public void e1c_testUrlEncodingSerialize_usingConfig() throws Exception {
+ Serializer s = UrlEncodingSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testSerialize(s, results.urlEncoding, new TestURIc());
}
@Test
public void e2_testUrlEncodingParse() throws Exception {
Serializer s = UrlEncodingSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testParse(s, UrlEncodingParser.DEFAULT);
+ testParse(s, UrlEncodingParser.DEFAULT, new TestURI());
+ }
+
+ @Test
+ public void e2c_testUrlEncodingParse_usingConfig() throws Exception {
+ Serializer s = UrlEncodingSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testParse(s, UrlEncodingParser.DEFAULT.builder().applyAnnotations(TestURIc.class).build(), new TestURIc());
}
@Test
public void f1_testMsgPackSerialize() throws Exception {
Serializer s = MsgPackSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testSerialize(s, results.msgPack);
+ testSerialize(s, results.msgPack, new TestURI());
+ }
+
+ @Test
+ public void f1c_testMsgPackSerialize_usingConfig() throws Exception {
+ Serializer s = MsgPackSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testSerialize(s, results.msgPack, new TestURIc());
}
@Test
public void f2_testMsgPackParse() throws Exception {
Serializer s = MsgPackSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testParse(s, MsgPackParser.DEFAULT);
+ testParse(s, MsgPackParser.DEFAULT, new TestURI());
+ }
+
+ @Test
+ public void f2c_testMsgPackParse_usingConfig() throws Exception {
+ Serializer s = MsgPackSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testParse(s, MsgPackParser.DEFAULT.builder().applyAnnotations(TestURIc.class).build(), new TestURIc());
}
@Test
public void g1_testRdfXmlSerialize() throws Exception {
Serializer s = RdfSerializer.create().language(Constants.LANG_RDF_XML_ABBREV).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).build();
- testSerialize(s, results.rdfXml);
+ testSerialize(s, results.rdfXml, new TestURI());
+ }
+
+ @Test
+ public void g1c_testRdfXmlSerialize_usingConfig() throws Exception {
+ Serializer s = RdfSerializer.create().language(Constants.LANG_RDF_XML_ABBREV).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ testSerialize(s, results.rdfXml, new TestURIc());
}
}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/DefaultSwapsTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/DefaultSwapsTest.java
index f53e79c..e5693b1 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/DefaultSwapsTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/DefaultSwapsTest.java
@@ -55,10 +55,18 @@
assertEquals(expected, SERIALIZER.serialize(o));
}
+ private void test(String expected, Object o, Class<?> configClass) throws Exception {
+ assertEquals(expected, SERIALIZER.builder().applyAnnotations(configClass).build().serialize(o));
+ }
+
private void test(String expected, Object o, PojoSwap<?,?> swap) throws Exception {
assertEquals(expected, SERIALIZER.builder().pojoSwaps(swap).build().serializeToString(o));
}
+ private void test(String expected, Object o, PojoSwap<?,?> swap, Class<?> configClass) throws Exception {
+ assertEquals(expected, SERIALIZER.builder().pojoSwaps(swap).applyAnnotations(configClass).build().serializeToString(o));
+ }
+
//------------------------------------------------------------------------------------------------------------------
// POJO_SWAPS.put(Enumeration.class, new EnumerationSwap());
//------------------------------------------------------------------------------------------------------------------
@@ -96,6 +104,41 @@
test("{f1:['foo','bar'],f2:'FOO'}", new ABean());
}
+ private static Vector<String> Ac = new Vector<>();
+ static {
+ Ac.add("foo");
+ Ac.add("bar");
+ }
+
+ public static class AcSwap extends StringSwap<Enumeration<?>> {
+ @Override /* PojoSwap */
+ public String swap(BeanSession session, Enumeration<?> o) throws Exception {
+ return "FOO";
+ }
+ }
+
+ @BeanConfig(applySwap=@Swap(on="AcBean.f2", value=AcSwap.class))
+ public static class AcBean {
+ public Enumeration<String> f1 = A.elements();
+
+ public Enumeration<String> f2 = A.elements();
+ }
+
+ @Test
+ public void a01c_Enumeration_usingConfig() throws Exception {
+ test("['foo','bar']", Ac.elements(), AcBean.class);
+ }
+
+ @Test
+ public void a02c_Enumeration_overrideSwap_usingConfig() throws Exception {
+ test("'FOO'", Ac.elements(), new AcSwap(), AcBean.class);
+ }
+
+ @Test
+ public void a03c_Enumeration_overrideAnnotation_usingConfig() throws Exception {
+ test("{f1:['foo','bar'],f2:'FOO'}", new AcBean(), AcBean.class);
+ }
+
//------------------------------------------------------------------------------------------------------------------
// POJO_SWAPS.put(Iterator.class, new IteratorSwap());
//------------------------------------------------------------------------------------------------------------------
@@ -129,6 +172,36 @@
test("{f1:['foo','bar'],f2:'FOO'}", new BBean());
}
+ private static List<String> Bc = new AList<String>().appendAll("foo","bar");
+
+ public static class BcSwap extends StringSwap<Iterator<?>> {
+ @Override /* PojoSwap */
+ public String swap(BeanSession session, Iterator<?> o) throws Exception {
+ return "FOO";
+ }
+ }
+
+ @BeanConfig(applySwap=@Swap(on="BcBean.f2", value=BcSwap.class))
+ public static class BcBean {
+ public Iterator<?> f1 = B.iterator();
+ public Iterator<?> f2 = B.iterator();
+ }
+
+ @Test
+ public void b01c_Iterator_usingConfig() throws Exception {
+ test("['foo','bar']", Bc.iterator(), BcBean.class);
+ }
+
+ @Test
+ public void b02c_Iterator_overrideSwap_usingConfig() throws Exception {
+ test("'FOO'", Bc.iterator(), new BcSwap(), BcBean.class);
+ }
+
+ @Test
+ public void b03c_Iterator_overrideAnnotation_usingConfig() throws Exception {
+ test("{f1:['foo','bar'],f2:'FOO'}", new BcBean(), BcBean.class);
+ }
+
//------------------------------------------------------------------------------------------------------------------
// POJO_SWAPS.put(Locale.class, new LocaleSwap());
//------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/ReaderObjectSwapTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/ReaderObjectSwapTest.java
index b9214b0..4208b6e 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/ReaderObjectSwapTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transforms/ReaderObjectSwapTest.java
@@ -18,6 +18,7 @@
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.serializer.*;
import org.apache.juneau.transform.*;
import org.apache.juneau.utils.*;
import org.junit.runner.*;
@@ -349,6 +350,11 @@
super(comboInput);
}
+ @Override
+ protected Serializer applySettings(Serializer s) throws Exception {
+ return s;
+ }
+
@Swap(PojoToSimpleReaderSwap.class)
public static class PojoToSimpleReader {}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/uon/Common_UonTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/uon/Common_UonTest.java
index c3d8892..c5d68cf 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/uon/Common_UonTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/uon/Common_UonTest.java
@@ -188,12 +188,12 @@
}
public static class E1 {
- @Beanp(bpi="f1") public E2 x1 = new E2();
- @Beanp(bpi="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
- @Beanp(bpi="f1") public E2[] x3 = {new E2()};
- @Beanp(bpi="f1") public List<E2> x4 = new AList<E2>().append(new E2());
- @Beanp(bpi="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
- @Beanp(bpi="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
+ @Beanp(properties="f1") public E2 x1 = new E2();
+ @Beanp(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
+ @Beanp(properties="f1") public E2[] x3 = {new E2()};
+ @Beanp(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
+ @Beanp(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
+ @Beanp(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
}
public static class E2 {
@@ -216,7 +216,7 @@
}
public static class F {
- @Beanp(bpi="x2") public List<F> x1 = new LinkedList<>();
+ @Beanp(properties="x2") public List<F> x1 = new LinkedList<>();
public int x2 = 2;
}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java
index 446c711..2338911 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java
@@ -187,12 +187,12 @@
}
public static class E1 {
- @Beanp(bpi="f1") public E2 x1 = new E2();
- @Beanp(bpi="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
- @Beanp(bpi="f1") public E2[] x3 = {new E2()};
- @Beanp(bpi="f1") public List<E2> x4 = new AList<E2>().append(new E2());
- @Beanp(bpi="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
- @Beanp(bpi="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
+ @Beanp(properties="f1") public E2 x1 = new E2();
+ @Beanp(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
+ @Beanp(properties="f1") public E2[] x3 = {new E2()};
+ @Beanp(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
+ @Beanp(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
+ @Beanp(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
}
public static class E2 {
@@ -218,7 +218,7 @@
}
public static class F {
- @Beanp(bpi="x2") public List<F> x1 = new LinkedList<>();
+ @Beanp(properties="x2") public List<F> x1 = new LinkedList<>();
public int x2 = 2;
}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/CommonTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/CommonTest.java
index 17cb49d..15746fa 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/CommonTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/CommonTest.java
@@ -205,12 +205,12 @@
}
public static class E1 {
- @Beanp(bpi="f1,f2") public E2 x1 = new E2();
- @Beanp(bpi="f1,f2") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f3",3);
- @Beanp(bpi="f1,f2") public E2[] x3 = {new E2()};
- @Beanp(bpi="f1,f2") public List<E2> x4 = new AList<E2>().append(new E2());
- @Beanp(bpi="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f3",3)};
- @Beanp(bpi="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f3",3));
+ @Beanp(properties="f1,f2") public E2 x1 = new E2();
+ @Beanp(properties="f1,f2") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f3",3);
+ @Beanp(properties="f1,f2") public E2[] x3 = {new E2()};
+ @Beanp(properties="f1,f2") public List<E2> x4 = new AList<E2>().append(new E2());
+ @Beanp(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f3",3)};
+ @Beanp(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f3",3));
}
public static class E2 {
@@ -235,7 +235,7 @@
}
public static class Test7b {
- @Beanp(bpi="x2") public List<Test7b> x1 = new LinkedList<>();
+ @Beanp(properties="x2") public List<Test7b> x1 = new LinkedList<>();
public int x2 = 2;
}
diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/XmlTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/XmlTest.java
index 1821365..44ae856 100755
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/XmlTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/xml/XmlTest.java
@@ -294,7 +294,7 @@
@Bean(typeName="foo")
public static class J1 {
- @Beanp(bpi="f2") public List<J2> f1 = new AList<J2>().append(new J2());
+ @Beanp(properties="f2") public List<J2> f1 = new AList<J2>().append(new J2());
}
@Bean(typeName="bar")
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 f7f2973..0879852 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,23 +67,41 @@
String namespace() default "";
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link RdfConfig#applyRdf()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
index 05a688c..e4244e0 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
@@ -885,7 +885,7 @@
* <li><b>Annotations:</b>
* <ul>
* <li class='ja'>{@link org.apache.juneau.annotation.Bean#bpi()}
- * <li class='ja'>{@link org.apache.juneau.annotation.Beanp#bpi()}
+ * <li class='ja'>{@link org.apache.juneau.annotation.Beanp#properties()}
* <li class='ja'>{@link org.apache.juneau.annotation.BeanConfig#bpi()}
* </ul>
* <li><b>Methods:</b>
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMetaFiltered.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMetaFiltered.java
index 45eac2b..0d67345 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMetaFiltered.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMetaFiltered.java
@@ -17,7 +17,7 @@
import org.apache.juneau.annotation.*;
/**
- * Same as {@link BeanMeta}, except the list of bean properties are limited by a {@link Beanp#bpi() @Beanp(bpi)} annotation.
+ * Same as {@link BeanMeta}, except the list of bean properties are limited by a {@link Beanp#properties() @Beanp(bpi)} annotation.
*
* @param <T> The class type that this metadata applies to.
*/
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
index 56fb06c..0dfa3ec 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -188,8 +188,8 @@
bdClasses.addAll(Arrays.asList(px.beanDictionary()));
}
if (p != null) {
- if (! p.bpi().isEmpty())
- properties = split(p.bpi());
+ if (! p.properties().isEmpty())
+ properties = split(p.properties());
bdClasses.addAll(Arrays.asList(p.dictionary()));
if (! p.ro().isEmpty())
readOnly = Boolean.valueOf(p.ro());
@@ -215,8 +215,8 @@
bdClasses.addAll(Arrays.asList(px.beanDictionary()));
}
if (p != null) {
- if (properties != null && ! p.bpi().isEmpty())
- properties = split(p.bpi());
+ if (properties != null && ! p.properties().isEmpty())
+ properties = split(p.properties());
bdClasses.addAll(Arrays.asList(p.dictionary()));
if (! p.ro().isEmpty())
readOnly = Boolean.valueOf(p.ro());
@@ -234,7 +234,7 @@
Beanp p = bc.getAnnotation(Beanp.class, setter);
if (rawTypeMeta == null)
rawTypeMeta = bc.resolveClassMeta(px, p, setter.getGenericParameterTypes()[0], typeVarImpls);
- isUri |= (rawTypeMeta.isUri() || setter.isAnnotationPresent(org.apache.juneau.annotation.URI.class));
+ isUri |= (rawTypeMeta.isUri() || bc.hasAnnotation(org.apache.juneau.annotation.URI.class, setter));
if (px != null) {
if (swap == null)
swap = getPropertyPojoSwap(px);
@@ -245,8 +245,8 @@
if (p != null) {
if (swap == null)
swap = getPropertyPojoSwap(p);
- if (properties != null && ! p.bpi().isEmpty())
- properties = split(p.bpi());
+ if (properties != null && ! p.properties().isEmpty())
+ properties = split(p.properties());
bdClasses.addAll(Arrays.asList(p.dictionary()));
if (! p.ro().isEmpty())
readOnly = Boolean.valueOf(p.ro());
@@ -550,7 +550,7 @@
}
/**
- * Returns the override list of properties defined through a {@link Beanp#bpi() @Beanp(bpi)} annotation
+ * Returns the override list of properties defined through a {@link Beanp#properties() @Beanp(bpi)} annotation
* on this property.
*
* @return The list of override properties, or <jk>null</jk> if annotation not specified.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index 9a3a7bf..1882fe8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -420,7 +420,7 @@
cc = DATE;
else if (c.isArray())
cc = ARRAY;
- else if (ci.isChildOfAny(URL.class, URI.class) || c.isAnnotationPresent(org.apache.juneau.annotation.URI.class))
+ else if (ci.isChildOfAny(URL.class, URI.class) || bc.hasAnnotation(org.apache.juneau.annotation.URI.class, c))
cc = URI;
else if (ci.isChildOf(Reader.class))
cc = READER;
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 7dd1b21..91ea168 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
@@ -253,6 +253,7 @@
* <jk>public void</jk> doFoo() {...}
* </p>
*
+ * <p>
* The valid pattern matches are:
* <ul>
* <li>Classes:
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 24044d4..e462431 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
@@ -115,19 +115,6 @@
Example[] applyExample() default {};
/**
- * Dynamically applies {@link Name @Name} annotations to specified methods/fields.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link Name#on() @Name.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
- * </ul>
- */
- Name[] applyName() default {};
-
- /**
* Dynamically applies {@link NameProperty @NameProperty} annotations to specified methods/fields.
*
* <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 716b836..e2e2a6d 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
@@ -176,8 +176,6 @@
psb.addTo(BEAN_annotations, a.applyBeanIgnore());
if (a.applyExample().length > 0)
psb.addTo(BEAN_annotations, a.applyExample());
- if (a.applyName().length > 0)
- psb.addTo(BEAN_annotations, a.applyName());
if (a.applyNameProperty().length > 0)
psb.addTo(BEAN_annotations, a.applyNameProperty());
if (a.applyParentProperty().length > 0)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnore.java
index 811bd4c..c21d46a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnore.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnore.java
@@ -47,6 +47,7 @@
* Used in conjunction with the {@link BeanConfig#applyBeanIgnore()}.
* It is ignored when the annotation is applied directly to classes/methods/fields/constructors.
*
+ * <p>
* The valid pattern matches are:
* <ul>
* <li>Classes:
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanc.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanc.java
index 160d55b..42298a2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanc.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Beanc.java
@@ -95,6 +95,7 @@
* <jk>int</jk> age = p.getAge(); <jc>// 45</jc>
* </p>
*
+ * <p>
* The valid pattern matches are:
* <ul>
* <li>Constructors:
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 462ef57..216983f 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,18 +203,29 @@
Class<?> type() default Object.class;
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified fields/methods.
*
* <p>
* Used in conjunction with the {@link BeanConfig#applyBeanp()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to fields/methods.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
@@ -273,7 +284,7 @@
* <jk>public class</jk> MyClass {
*
* <jc>// Only render 'f1' when serializing this bean property.</jc>
- * <ja>@Beanp</ja>(bpi=<js>"f1"</js>)
+ * <ja>@Beanp</ja>(properties=<js>"f1"</js>)
* <jk>public</jk> MyChildClass x1 = <jk>new</jk> MyChildClass();
* }
*
@@ -293,7 +304,7 @@
* <p class='bcode w800'>
* <jk>public class</jk> MyBean {
*
- * <ja>@Beanp</ja>(bpi=<js>"f1"</js>)
+ * <ja>@Beanp</ja>(properties=<js>"f1"</js>)
* <jk>private</jk> MyChildClass <jf>x1</jf>;
*
* <jk>public</jk> MyChildClass getX1() {
@@ -302,7 +313,7 @@
* }
* </p>
*/
- String bpi() default "";
+ String properties() default "";
/**
* Bean dictionary.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Example.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Example.java
index 1c5d0a4..e51fd9d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Example.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Example.java
@@ -62,13 +62,14 @@
public @interface Example {
/**
- * Defines which classes/methods/fields this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link BeanConfig#applyExample()}.
* It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <ul>
* <li>Classes:
* <ul>
@@ -91,12 +92,6 @@
* <li>Simple: <js>"MyClass.muyField"</js>
* <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
* </ul>
- * <li>Constructors:
- * <ul>
- * <li>Fully qualified with args: <js>"com.foo.MyClass(String,int)"</js> or <js>"com.foo.MyClass(java.lang.String,int)"</js> or <js>"com.foo.MyClass()"</js>
- * <li>Simple with args: <js>"MyClass(String,int)"</js> or <js>"MyClass(java.lang.String,int)"</js> or <js>"MyClass()"</js>
- * <li>Simple inner class: <js>"MyClass$Inner1$Inner2()"</js> or <js>"Inner1$Inner2()"</js> or <js>"Inner2()"</js>
- * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Name.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Name.java
index 54d9911..ecc2410 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Name.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Name.java
@@ -23,7 +23,6 @@
* <p>
* Can be used in the following locations:
* <ul>
- * <li>In place of <code><ja>@Beanp</ja>(name=<js>"foo"</js>)</code> when just the name is specified.
* <li>On constructor and method arguments when the parameter names are not in the compiled bytecode.
* </ul>
*
@@ -33,25 +32,16 @@
* // The field name can be anything.</jc>
* <jk>public class</jk> MyBean {
*
- * <jc>// Same as @Beanp(bpi="bar")</jc>
- * <jk>public</jk> MyBean(@Name("bar") <jk>int</jk> foo) {}
- *
- * <ja>@Name</ja>(<js>"bar"</js>) <jc>// Same as @Beanp(name="bar")</jc>
- * <jk>public int</jk> foo;
- *
- * <ja>@Name</ja>(<js>"*"</js>) <jc>// Same as @Beanp(name="*")</jc>
- * <jk>public</jk> Map<String,Object> extraStuff = <jk>new</jk> LinkedHashMap<String,Object>();
+ * <jk>public</jk> MyBean(<ja>@Name</ja>("bar") <jk>int</jk> foo) {}
* }
* </p>
*/
@Documented
-@Target({PARAMETER,METHOD,FIELD})
+@Target({PARAMETER})
@Retention(RUNTIME)
@Inherited
public @interface Name {
- String on() default "";
-
/**
* The bean property or parameter name.
*/
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NameProperty.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NameProperty.java
index 53dfccf..2472b70 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NameProperty.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NameProperty.java
@@ -33,6 +33,37 @@
@Retention(RUNTIME)
@Inherited
public @interface NameProperty {
- String on() default "";
+ /**
+ * Dynamically apply this annotation to the specified methods/fields.
+ *
+ * <p>
+ * Used in conjunction with the {@link BeanConfig#applyNameProperty()}.
+ * It is ignored when the annotation is applied directly to methods/fields.
+ *
+ * <p>
+ * The valid pattern matches are:
+ * <ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
+ * </ul>
+ */
+ String on() default "";
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentProperty.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentProperty.java
index 1c42a71..0cfbbdc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentProperty.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentProperty.java
@@ -37,6 +37,36 @@
@Inherited
public @interface ParentProperty {
+ /**
+ * Dynamically apply this annotation to the specified methods/fields.
+ *
+ * <p>
+ * Used in conjunction with the {@link BeanConfig#applyParentProperty()}.
+ * It is ignored when the annotation is applied directly to methods/fields.
+ *
+ * <p>
+ * The valid pattern matches are:
+ * <ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
+ * </ul>
+ */
String on() default "";
-
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Swap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Swap.java
index b02edc1..839ed93 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Swap.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Swap.java
@@ -40,8 +40,6 @@
@Inherited
public @interface Swap {
- String on() default "";
-
/**
* The {@link PojoSwap} and {@link Surrogate} class.
*
@@ -74,6 +72,46 @@
String[] mediaTypes() default {};
/**
+ * Dynamically apply this annotation to the specified classes/methods/fields.
+ *
+ * <p>
+ * Used in conjunction with the {@link BeanConfig#applySwap()}.
+ * It is ignored when the annotation is applied directly to classes.
+ *
+ * <p>
+ * The valid pattern matches are:
+ * <ul>
+ * <li>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* Identifies a template string along with this swap.
*
* <p>
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java
index ca4e75c..8459664 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/URI.java
@@ -33,6 +33,43 @@
@Inherited
public @interface URI {
+ /**
+ * Dynamically apply this annotation to the specified class/method/fields.
+ *
+ * <p>
+ * Used in conjunction with the {@link BeanConfig#applyURI()}.
+ * It is ignored when the annotation is applied directly to class/method/fields.
+ *
+ * <p>
+ * The valid pattern matches are:
+ * <ul>
+ * <li>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
+ * </ul>
+ */
String on() default "";
-
}
\ No newline at end of file
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
index 3af72d1..f5c1fec 100644
--- 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
@@ -32,23 +32,41 @@
public @interface Csv {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link CsvConfig#applyCsv()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
- * <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+\ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
index 9a5ac72..6076ae2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
@@ -721,7 +721,7 @@
if (cm == null || ! cm.isMapOrBean())
return null;
- if (cm.getInnerClass().isAnnotationPresent(HtmlLink.class))
+ if (cm.hasAnnotation(HtmlLink.class))
return null;
HtmlClassMeta cHtml = getHtmlClassMeta(cm);
@@ -788,7 +788,7 @@
continue;
if (cm == null || ! (cm.isMap() || cm.isBean()))
return null;
- if (cm.getInnerClass().isAnnotationPresent(HtmlLink.class))
+ if (cm.hasAnnotation(HtmlLink.class))
return null;
if (canIgnoreValue(cm, null, o))
return null;
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 fa57496..eaa8615 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,23 +102,41 @@
boolean noTables() default false;
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link HtmlConfig#applyHtml()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLink.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLink.java
index 8894b7c..97b92fa 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLink.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLink.java
@@ -41,14 +41,38 @@
@Inherited
public @interface HtmlLink {
- String on() default "";
-
/**
* The bean property whose value becomes the name in the hyperlink.
*/
String nameProperty() default "name";
/**
+ * Dynamically apply this annotation to the specified classes.
+ *
+ * <p>
+ * Used in conjunction with the {@link HtmlConfig#applyHtmlLink()}.
+ * It is ignored when the annotation is applied directly to classes.
+ *
+ * <p>
+ * The valid pattern matches are:
+ * <ul>
+ * <li>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>A comma-delimited list of anything on this list.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
+ * </ul>
+ */
+ String on() default "";
+
+ /**
* The bean property whose value becomes the url in the hyperlink.
*/
String uriProperty() default "uri";
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
index d984db0..16e2afc 100644
--- 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
@@ -32,23 +32,41 @@
public @interface Jso {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link JsoConfig#applyJso()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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 175e76d..84795a2 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
@@ -31,29 +31,47 @@
* </ul>
*/
@Documented
-@Target({TYPE})
+@Target({TYPE,METHOD,FIELD})
@Retention(RUNTIME)
@Inherited
public @interface Json {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link JsonConfig#applyJson()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/Schema.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/Schema.java
index 3519ba0..1b5c0f5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/Schema.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/Schema.java
@@ -721,23 +721,41 @@
String[] value() default {};
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link JsonSchemaConfig#applySchema()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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
index d2f7185..2359243 100644
--- 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
@@ -32,23 +32,41 @@
public @interface MsgPack {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link MsgPackConfig#applyMsgPack()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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
index 523f7b4..510d769 100644
--- 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
@@ -32,23 +32,41 @@
public @interface OpenApi {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link OpenApiConfig#applyOpenApi()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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
index 175d5db..f48b106 100644
--- 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
@@ -32,23 +32,41 @@
public @interface PlainText {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link PlainTextConfig#applyPlainText()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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
index 6970204..fd5b56c 100644
--- 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
@@ -32,23 +32,40 @@
public @interface SoapXml {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link SoapXmlConfig#applySoapXml()}.
- * It is ignored when the annotation is applied directly to classes and methods.
- *
- * The format can be any of the following:
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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
index 57b515a..2db9a4f 100644
--- 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
@@ -32,23 +32,41 @@
public @interface Uon {
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link UonConfig#applyUon()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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 dbebcb6..a211974 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
@@ -24,7 +24,7 @@
* {@link UrlEncodingSerializer} and {@link UrlEncodingParser}.
*/
@Documented
-@Target({TYPE})
+@Target({TYPE,FIELD,METHOD})
@Retention(RUNTIME)
@Inherited
public @interface UrlEncoding {
@@ -39,23 +39,41 @@
boolean expandedParams() default false;
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link UrlEncodingConfig#applyUrlEncoding()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
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
index af358f9..94cf4a5 100644
--- 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
@@ -23,6 +23,7 @@
/**
* Allows arbitrary objects to be mapped to classes and methods base on class/method name keys.
*
+ * <p>
* The valid pattern matches are:
* <ul>
* <li>Classes:
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 8e77b4d..5ecbb6d 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,23 +134,41 @@
String namespace() default "";
/**
- * Defines which classes/methods this annotation applies to.
+ * Dynamically apply this annotation to the specified classes/methods/fields.
*
* <p>
* Used in conjunction with the {@link XmlConfig#applyXml()}.
- * It is ignored when the annotation is applied directly to classes and methods.
+ * It is ignored when the annotation is applied directly to classes/methods/fields.
*
- * The format can be any of the following:
+ * <p>
+ * The valid pattern matches are:
* <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>Classes:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass"</js>
+ * <li>Fully qualified inner class: <js>"com.foo.MyClass$Inner1$Inner2"</js>
+ * <li>Simple: <js>"MyClass"</js>
+ * <li>Simple inner: <js>"MyClass$Inner1$Inner2"</js> or <js>"Inner1$Inner2"</js> or <js>"Inner2"</js>
+ * </ul>
+ * <li>Methods:
+ * <ul>
+ * <li>Fully qualified with args: <js>"com.foo.MyClass.myMethod(String,int)"</js> or <js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> or <js>"com.foo.MyClass.myMethod()"</js>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myMethod"</js>
+ * <li>Simple with args: <js>"MyClass.myMethod(String,int)"</js> or <js>"MyClass.myMethod(java.lang.String,int)"</js> or <js>"MyClass.myMethod()"</js>
+ * <li>Simple: <js>"MyClass.myMethod"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myMethod"</js> or <js>"Inner1$Inner2.myMethod"</js> or <js>"Inner2.myMethod"</js>
+ * </ul>
+ * <li>Fields:
+ * <ul>
+ * <li>Fully qualified: <js>"com.foo.MyClass.myField"</js>
+ * <li>Simple: <js>"MyClass.muyField"</js>
+ * <li>Simple inner class: <js>"MyClass$Inner1$Inner2.myField"</js> or <js>"Inner1$Inner2.myField"</js> or <js>"Inner2.myField"</js>
+ * </ul>
* <li>A comma-delimited list of anything on this list.
* </ul>
*
* <ul class='seealso'>
- * <li class='link'>{@doc juneau-marshall.ClassMethodAnnotations}
+ * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations}
* </ul>
*/
String on() default "";
diff --git a/juneau-doc/docs/Topics/02.juneau-marshall/08.ClassMethodAnnotations.html b/juneau-doc/docs/Topics/02.juneau-marshall/08.DynamicallyAppliedAnnotations.html
similarity index 100%
rename from juneau-doc/docs/Topics/02.juneau-marshall/08.ClassMethodAnnotations.html
rename to juneau-doc/docs/Topics/02.juneau-marshall/08.DynamicallyAppliedAnnotations.html