This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new d80acb8 Annotation improvements.
d80acb8 is described below
commit d80acb8cd4c9fce4e1ec9d2cb5cdab71fd837699
Author: JamesBognar <[email protected]>
AuthorDate: Wed Nov 11 19:01:28 2020 -0500
Annotation improvements.
---
.../java/org/apache/juneau/BeanConfigTest.java | 11 +-
.../java/org/apache/juneau/BeanFilterTest.java | 24 ++--
.../java/org/apache/juneau/BeanMapErrorsTest.java | 32 +++--
.../test/java/org/apache/juneau/BeanMapTest.java | 36 ++++--
.../java/org/apache/juneau/PojoExamplesTest.java | 40 +++++--
.../apache/juneau/ReadWriteOnlyPropertiesTest.java | 32 ++---
.../a/rttests/RoundTripTransformBeansTest.java | 34 ++++--
.../a/rttests/RountTripBeansWithBuilders.java | 8 +-
.../apache/juneau/annotation/BeanIgnore_Test.java | 18 +--
.../org/apache/juneau/annotation/Bean_Test.java | 17 ++-
.../juneau/jsonschema/JsonSchemaGeneratorTest.java | 84 ++++++++-----
.../org/apache/juneau/serializer/TestURIc.java | 10 +-
.../juneau/serializer/UriResolutionTest.java | 36 +++---
.../org/apache/juneau/testutils/pojos/XBeans.java | 3 +-
.../apache/juneau/transform/AutoListSwapTest.java | 26 +++--
.../apache/juneau/transform/AutoMapSwapTest.java | 24 ++--
.../juneau/transform/AutoNumberSwapTest.java | 24 ++--
.../juneau/transform/AutoObjectSwapTest.java | 24 ++--
.../apache/juneau/transforms/DefaultSwapsTest.java | 24 ++--
.../java/org/apache/juneau/urlencoding/DTOs2.java | 4 +-
.../main/java/org/apache/juneau/BeanContext.java | 5 -
.../main/java/org/apache/juneau/MetaProvider.java | 21 ++--
.../org/apache/juneau/PropertyStoreBuilder.java | 1 +
.../org/apache/juneau/annotation/BeanConfig.java | 130 ---------------------
.../juneau/annotation/BeanConfigAnnotation.java | 21 ----
.../org/apache/juneau/annotation/BeanIgnore.java | 4 +-
.../java/org/apache/juneau/annotation/Beanc.java | 21 ++--
.../java/org/apache/juneau/annotation/Beanp.java | 2 +-
.../java/org/apache/juneau/annotation/Example.java | 4 +-
.../juneau/annotation/ExampleAnnotation.java | 2 +-
.../org/apache/juneau/annotation/Marshalled.java | 8 +-
.../org/apache/juneau/annotation/NameProperty.java | 4 +-
.../apache/juneau/annotation/ParentProperty.java | 4 +-
.../annotation/ParentPropertyAnnotation.java | 2 +-
.../java/org/apache/juneau/annotation/Swap.java | 3 +-
.../apache/juneau/annotation/SwapAnnotation.java | 2 +-
.../java/org/apache/juneau/annotation/Uri.java | 4 +-
.../juneau/examples/rest/RequestEchoResource.java | 8 +-
.../juneau/examples/rest/dto/AtomFeedResource.java | 4 +-
.../examples/rest/dto/JsonSchemaResource.java | 4 +-
.../apache/juneau/rest/annotation/Body_Test.java | 6 +-
41 files changed, 377 insertions(+), 394 deletions(-)
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java
index 1c5e5ac..78eaebe 100755
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java
@@ -432,7 +432,7 @@ public class BeanConfigTest {
@Test
public void testReadOnlyProperties_usingConfig() throws Exception {
- BeanSession session =
BeanContext.DEFAULT.builder().applyAnnotations(ReadOnlyPerson2.class).build().createSession();
+ BeanSession session =
BeanContext.DEFAULT.builder().applyAnnotations(ReadOnlyPerson2Config.class).build().createSession();
Object o;
// Bean to String
@@ -445,7 +445,6 @@ public class BeanConfigTest {
}
-
@BeanConfig(applyBean=@Bean(on="ReadOnlyPerson2",p="name,age"),applyBeanc=@Beanc(on="ReadOnlyPerson2(String,int)",properties="name,age"))
public static class ReadOnlyPerson2 {
private final String name;
private final int age;
@@ -470,6 +469,14 @@ public class BeanConfigTest {
}
}
+ @Bean(on="Dummy1",p="dummy")
+ @Bean(on="ReadOnlyPerson2",p="name,age")
+ @Bean(on="Dummy2",p="dummy")
+ @Beanc(on="Dummy1",properties="dummy")
+ @Beanc(on="ReadOnlyPerson2(String,int)",properties="name,age")
+ @Beanc(on="Dummy2",properties="dummy")
+ private static class ReadOnlyPerson2Config {}
+
//====================================================================================================
// testEnums
//====================================================================================================
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanFilterTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanFilterTest.java
index bf090df..8e7c159 100755
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanFilterTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanFilterTest.java
@@ -87,8 +87,8 @@ public class BeanFilterTest {
@Test
public void testSubTypes_usingConfig() throws Exception {
- JsonSerializer s =
SimpleJsonSerializer.DEFAULT.builder().addBeanTypes().addRootType().applyAnnotations(E.class).build();
- JsonParser p =
JsonParser.create().applyAnnotations(E1.class).build();
+ JsonSerializer s =
SimpleJsonSerializer.DEFAULT.builder().addBeanTypes().addRootType().applyAnnotations(EConfig.class).build();
+ JsonParser p =
JsonParser.create().applyAnnotations(EConfig2.class).build();
E1 e1 = new E1();
e1.f1 = "f1";
@@ -112,16 +112,16 @@ public class BeanFilterTest {
assertEquals("f2", ((F2)e.fb).f2);
}
- @BeanConfig(
- applyBean={
- @Bean(on="E", dictionary={E1.class, E2.class}),
- @Bean(on="E1", typeName="E1"),
- @Bean(on="E2", typeName="E2"),
- @Bean(on="F", dictionary={F1.class,F2.class}),
- @Bean(on="F1", typeName="F1"),
- @Bean(on="F2", typeName="F2")
- }
- )
+ @Bean(on="E", dictionary={E1.class, E2.class})
+ @Bean(on="E1", typeName="E1")
+ @Bean(on="E2", typeName="E2")
+ @Bean(on="F", dictionary={F1.class,F2.class})
+ @Bean(on="F1", typeName="F1")
+ @Bean(on="F2", typeName="F2")
+ private static class EConfig {}
+
+ private static class EConfig2 extends EConfig {}
+
public static abstract class E {
public String f0 = "f0";
public F fb;
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapErrorsTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapErrorsTest.java
index 00d2bf4..cad81f9 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapErrorsTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapErrorsTest.java
@@ -60,7 +60,7 @@ public class BeanMapErrorsTest {
@Test
public void beanPropertyMethodNotInBeanProperties_usingConfig() {
- BeanContext bc =
BeanContext.create().applyAnnotations(B1.class).build();
+ BeanContext bc =
BeanContext.create().applyAnnotations(B1Config.class).build();
BeanMap<B1> bm = bc.createBeanSession().newBeanMap(B1.class);
assertTrue(bm.containsKey("f2"));
@@ -71,14 +71,12 @@ public class BeanMapErrorsTest {
assertFalse(bm.entrySet().stream().map(x ->
x.getKey()).collect(Collectors.toList()).contains("f2"));
}
- @BeanConfig(
- applyBean={
- @Bean(on="B1", p="f1"),
- },
- applyBeanp={
- @Beanp(on="B1.f2", value="f2")
- }
- )
+ @Bean(on="Dummy",p="dummy")
+ @Bean(on="B1", p="f1")
+ @Beanp(on="Dummy", value="dummy")
+ @Beanp(on="B1.f2", value="f2")
+ private static class B1Config {}
+
public static class B1 {
public int f1;
private int f2 = -1;
@@ -119,7 +117,7 @@ public class BeanMapErrorsTest {
@Test
public void beanPropertyFieldNotInBeanProperties_usingBeanConfig() {
- BeanContext bc =
BeanContext.create().applyAnnotations(B2.class).build();
+ BeanContext bc =
BeanContext.create().applyAnnotations(B2Config.class).build();
BeanMap<B2> bm = bc.createBeanSession().newBeanMap(B2.class);
assertTrue(bm.containsKey("f2"));
@@ -130,14 +128,12 @@ public class BeanMapErrorsTest {
assertFalse(bm.entrySet().stream().map(x ->
x.getKey()).collect(Collectors.toList()).contains("f2"));
}
- @BeanConfig(
- applyBean={
- @Bean(on="B2", p="f1")
- },
- applyBeanp={
- @Beanp(on="B2.f2", value="f2")
- }
- )
+ @Bean(on="Dummy",p="dummy")
+ @Bean(on="B2", p="f1")
+ @Beanp(on="Dummy", value="dummy")
+ @Beanp(on="B2.f2", value="f2")
+ private static class B2Config {}
+
public static class B2 {
public int f1;
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapTest.java
index bfff957..b841d4a 100755
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanMapTest.java
@@ -533,7 +533,7 @@ public class BeanMapTest {
m.put("b", new D2c());
assertEquals("default", t.b.s);
- JsonParser p =
JsonParser.create().dictionary(D2c.class).applyAnnotations(D1c.class).build();
+ JsonParser p =
JsonParser.create().dictionary(D2c.class).applyAnnotations(D1cConfig.class).build();
m.put("lb1", OList.ofText("[{_type:'D2',s:'foobar'}]", p));
assertEquals(OList.class.getName(), t.lb1.getClass().getName());
assertEquals(D2c.class.getName(),
t.lb1.get(0).getClass().getName());
@@ -555,11 +555,11 @@ public class BeanMapTest {
assertEquals("foobar", t.ab2[0].s);
}
- @BeanConfig(
- applyBean={
- @Bean(on="D2c", typeName="D2")
- }
- )
+ @Bean(on="Dummy1", typeName="dummy")
+ @Bean(on="D2c", typeName="D2")
+ @Bean(on="Dummy2", typeName="dummy")
+ private static class D1cConfig {}
+
public static class D1c {
public D2c b;
public List<D2c> lb1;
@@ -1090,7 +1090,7 @@ public class BeanMapTest {
@Test
public void testPropertyNameFactoryDashedLC1_usingConfig() throws
Exception {
- BeanMap<P1c> m =
bc.builder().applyAnnotations(P1c.class).build().createSession().newBeanMap(P1c.class).load("{'foo':1,'bar-baz':2,'bing-boo-url':3}");
+ BeanMap<P1c> m =
bc.builder().applyAnnotations(P1cConfig.class).build().createSession().newBeanMap(P1c.class).load("{'foo':1,'bar-baz':2,'bing-boo-url':3}");
assertEquals(1, m.get("foo"));
assertEquals(2, m.get("bar-baz"));
assertEquals(3, m.get("bing-boo-url"));
@@ -1106,7 +1106,11 @@ public class BeanMapTest {
assertEquals(6, b.bingBooURL);
}
- @BeanConfig(applyBean=@Bean(on="P1c",
propertyNamer=PropertyNamerDLC.class))
+ @Bean(on="Dummy1", propertyNamer=PropertyNamerDLC.class)
+ @Bean(on="P1c", propertyNamer=PropertyNamerDLC.class)
+ @Bean(on="Dummy2", propertyNamer=PropertyNamerDLC.class)
+ private static class P1cConfig {}
+
public static class P1c {
public int foo, barBaz, bingBooURL;
}
@@ -1826,7 +1830,7 @@ public class BeanMapTest {
@Test
public void testHiddenProperties_usingConfig() throws Exception {
- JsonSerializer s =
SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(Uc.class).build();
+ JsonSerializer s =
SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(UcConfig.class).build();
BeanMeta bm = s.getBeanMeta(U.class);
assertNotNull(bm.getPropertyMeta("a"));
assertNotNull(bm.getPropertyMeta("b"));
@@ -1844,7 +1848,11 @@ public class BeanMapTest {
assertEquals("b(setter)", t.b);
}
-
@BeanConfig(applyBeanIgnore=@BeanIgnore(on="Uc.getB,Uc.c,Uc.getD,Uc.setD"))
+ @BeanIgnore(on="Dummy1")
+ @BeanIgnore(on="Uc.getB,Uc.c,Uc.getD,Uc.setD")
+ @BeanIgnore(on="Dummy2")
+ private static class UcConfig {}
+
public static class Uc {
public String a, b;
@@ -1902,12 +1910,16 @@ public class BeanMapTest {
@Test
public void testBeanPropertyOrder_usingConfig() throws Exception {
- WriterSerializer ws =
JsonSerializer.create().simple().sq().applyAnnotations(Vc.class).build();
+ WriterSerializer ws =
JsonSerializer.create().simple().sq().applyAnnotations(VcConfig.class).build();
assertEquals("{a1:'1',a2:'2',a3:'3',a4:'4'}", ws.toString(new
V2c()));
assertEquals("{a3:'3',a4:'4',a5:'5',a6:'6'}", ws.toString(new
V3c()));
}
- @BeanConfig(applyBean=@Bean(on="V3c", stopClass=Vc.class))
+ @Bean(on="Dummy1", stopClass=Vc.class)
+ @Bean(on="V3c", stopClass=Vc.class)
+ @Bean(on="Dummy2", stopClass=Vc.class)
+ private static class VcConfig {}
+
public static class Vc {
public String a1="1", a2="2";
}
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PojoExamplesTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PojoExamplesTest.java
index 0d29464..50e429c 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PojoExamplesTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PojoExamplesTest.java
@@ -65,11 +65,15 @@ public class PojoExamplesTest {
@Test
public void testExampleField_usingConfig() throws Exception {
- BeanSession bs =
BeanContext.create().applyAnnotations(B1c.class).build().createSession();
+ BeanSession bs =
BeanContext.create().applyAnnotations(B1cConfig.class).build().createSession();
assertObject(bs.getClassMeta(B1c.class).getExample(bs)).json().is("{f1:'f1b'}");
}
- @BeanConfig(applyExample=@Example(on="B1c.EXAMPLE"))
+ @Example(on="Dummy1.EXAMPLE")
+ @Example(on="B1c.EXAMPLE")
+ @Example(on="Dummy2.EXAMPLE")
+ private static class B1cConfig {}
+
public static class B1c {
public String f1;
@@ -104,11 +108,15 @@ public class PojoExamplesTest {
@Test
public void testExampleFieldPrivate_usingConfig() throws Exception {
- BeanSession bs =
BeanContext.create().applyAnnotations(B2c.class).build().createSession();
+ BeanSession bs =
BeanContext.create().applyAnnotations(B2cConfig.class).build().createSession();
assertObject(bs.getClassMeta(B2c.class).getExample(bs)).json().is("{f1:'f1b'}");
}
- @BeanConfig(applyExample=@Example(on="B2c.EXAMPLE"))
+ @Example(on="Dummy1.EXAMPLE")
+ @Example(on="B2c.EXAMPLE")
+ @Example(on="Dummy2.EXAMPLE")
+ private static class B2cConfig {}
+
public static class B2c {
public String f1;
@@ -146,11 +154,15 @@ public class PojoExamplesTest {
@Test
public void testExampleOnPublicNoArgMethod_usingConfig() throws
Exception {
- BeanSession bs =
BeanContext.create().applyAnnotations(C1c.class).build().createSession();
+ BeanSession bs =
BeanContext.create().applyAnnotations(C1cConfig.class).build().createSession();
assertObject(bs.getClassMeta(C1c.class).getExample(bs)).json().is("{f1:'f1c'}");
}
- @BeanConfig(applyExample=@Example(on="C1c.x"))
+ @Example(on="Dummy1.x")
+ @Example(on="C1c.x")
+ @Example(on="Dummy2.x")
+ private static class C1cConfig {}
+
public static class C1c {
public String f1;
@@ -189,11 +201,15 @@ public class PojoExamplesTest {
@Test
public void testExampleOnPrivateNoArgMethod_usingConfig() throws
Exception {
- BeanSession bs =
BeanContext.create().applyAnnotations(C2c.class).build().createSession();
+ BeanSession bs =
BeanContext.create().applyAnnotations(C2cConfig.class).build().createSession();
assertObject(bs.getClassMeta(C2c.class).getExample(bs)).json().is("{f1:'f1c'}");
}
- @BeanConfig(applyExample=@Example(on="C2c.x"))
+ @Example(on="Dummy1.x")
+ @Example(on="C2c.x")
+ @Example(on="Dummy2.x")
+ private static class C2cConfig {}
+
public static class C2c {
public String f1;
@@ -233,11 +249,15 @@ public class PojoExamplesTest {
@Test
public void testExampleOnPublicOneArgMethod_usingConfig() throws
Exception {
- BeanSession bs =
BeanContext.create().applyAnnotations(D1c.class).build().createSession();
+ BeanSession bs =
BeanContext.create().applyAnnotations(D1cConfig.class).build().createSession();
assertObject(bs.getClassMeta(D1c.class).getExample(bs)).json().is("{f1:'f1d'}");
}
- @BeanConfig(applyExample=@Example(on="D1c.x(BeanSession)"))
+ @Example(on="Dummy1.x(BeanSession)")
+ @Example(on="D1c.x(BeanSession)")
+ @Example(on="Dummy2.x(BeanSession)")
+ private static class D1cConfig {}
+
public static class D1c {
public String f1;
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ReadWriteOnlyPropertiesTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ReadWriteOnlyPropertiesTest.java
index 183dcc6..c884160 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ReadWriteOnlyPropertiesTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/ReadWriteOnlyPropertiesTest.java
@@ -85,18 +85,18 @@ public class ReadWriteOnlyPropertiesTest {
@Test
public void b02_beanAnnotationParser() throws Exception {
- Bc x =
JsonParser.DEFAULT.builder().applyAnnotations(Bc.class).build().parse("{f1:1,f2:2}",
Bc.class);
+ Bc x =
JsonParser.DEFAULT.builder().applyAnnotations(BcConfig.class).build().parse("{f1:1,f2:2}",
Bc.class);
assertEquals(0, x.f1);
assertEquals(2, x.f2);
}
- @BeanConfig(
- applyBean=@Bean(on="Bc", readOnlyProperties="f1",
writeOnlyProperties="f2"),
- applyBeanp={
- @Beanp(on="Bc.f1", ro="true"),
- @Beanp(on="Bc.f2", wo="true")
- }
- )
+ @Bean(on="Dummy1", readOnlyProperties="f1", writeOnlyProperties="f2")
+ @Bean(on="Bc", readOnlyProperties="f1", writeOnlyProperties="f2")
+ @Bean(on="Dummy2", readOnlyProperties="f1", writeOnlyProperties="f2")
+ @Beanp(on="Bc.f1", ro="true")
+ @Beanp(on="Bc.f2", wo="true")
+ private static class BcConfig {}
+
public static class Bc {
public int f1;
public int f2;
@@ -247,7 +247,9 @@ public class ReadWriteOnlyPropertiesTest {
assertEquals(0, x.f2);
}
- @BeanConfig(applyBean=@Bean(on="Dc",readOnlyProperties="*"))
+ @Bean(on="Dc",readOnlyProperties="*")
+ private static class DcConfig {}
+
public static class Dc {
public int f1;
public int f2;
@@ -262,12 +264,12 @@ public class ReadWriteOnlyPropertiesTest {
@Test
public void d03_beanAnnotation_bproAll_serializer_usingConfig() throws
Exception {
-
assertObject(Dc.create()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(Dc.class).build()).is("{f1:1,f2:2}");
+
assertObject(Dc.create()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(DcConfig.class).build()).is("{f1:1,f2:2}");
}
@Test
public void d04_beanAnnotation_bproAll_Parser_usingConfig() throws
Exception {
- Dc x =
JsonParser.DEFAULT.builder().applyAnnotations(Dc.class).build().parse("{f1:1,f2:2}",
Dc.class);
+ Dc x =
JsonParser.DEFAULT.builder().applyAnnotations(DcConfig.class).build().parse("{f1:1,f2:2}",
Dc.class);
assertEquals(0, x.f1);
assertEquals(0, x.f2);
}
@@ -301,7 +303,9 @@ public class ReadWriteOnlyPropertiesTest {
assertEquals(2, x.f2);
}
- @BeanConfig(applyBean=@Bean(on="Ec", writeOnlyProperties="*"))
+ @Bean(on="Ec", writeOnlyProperties="*")
+ private static class EcConfig {}
+
public static class Ec {
public int f1;
public int f2;
@@ -316,12 +320,12 @@ public class ReadWriteOnlyPropertiesTest {
@Test
public void e03_beanAnnotation_bpwoAll_serializer_usingConfig() throws
Exception {
-
assertObject(E.create()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(Ec.class).build()).is("{}");
+
assertObject(E.create()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(EcConfig.class).build()).is("{}");
}
@Test
public void e04_beanAnnotation_bpwoAll_Parser_usingConfig() throws
Exception {
- Ec x =
JsonParser.DEFAULT.builder().applyAnnotations(Ec.class).build().parse("{f1:1,f2:2}",
Ec.class);
+ Ec x =
JsonParser.DEFAULT.builder().applyAnnotations(EcConfig.class).build().parse("{f1:1,f2:2}",
Ec.class);
assertEquals(1, x.f1);
assertEquals(2, x.f2);
}
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 45af51f..c76ebdb 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
@@ -42,7 +42,7 @@ import org.junit.*;
public class RoundTripTransformBeansTest extends RoundTripTest {
public RoundTripTransformBeansTest(String label, SerializerBuilder s,
ParserBuilder p, int flags) throws Exception {
- 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);
+ super(label, s == null ? null :
s.applyAnnotations(BcConfig.class, E1cConfig.class, F1cConfig.class,
F2acConfig.class), p == null ? null : p.applyAnnotations(BcConfig.class,
E1cConfig.class, F1cConfig.class, F2acConfig.class), flags);
}
@@ -239,7 +239,11 @@ public class RoundTripTransformBeansTest extends
RoundTripTest {
assertEquals("bar", t.f1);
}
- @BeanConfig(applySwap=@Swap(on="Bc",value=BcSwap.class))
+ @Swap(on="Dummy1",value=BcSwap.class)
+ @Swap(on="Bc",value=BcSwap.class)
+ @Swap(on="Dummy2",value=BcSwap.class)
+ private static class BcConfig {}
+
public static class Bc {
public String f1;
}
@@ -430,8 +434,8 @@ public class RoundTripTransformBeansTest extends
RoundTripTest {
@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();
+ JsonSerializer s =
SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(E1cConfig.class).build();
+ JsonParser p =
JsonParser.DEFAULT.builder().applyAnnotations(E1cConfig.class).build();
Object r;
E1c x = E1c.create();
@@ -447,7 +451,11 @@ public class RoundTripTransformBeansTest extends
RoundTripTest {
x = roundTrip(x, E1c.class);
}
- @BeanConfig(applySwap=@Swap(on="E1c",value=E2c.class))
+ @Swap(on="Dummy1",value=E2c.class)
+ @Swap(on="E1c",value=E2c.class)
+ @Swap(on="Dummy2",value=E2c.class)
+ private static class E1cConfig {}
+
public static class E1c {
public String f1;
@@ -512,7 +520,11 @@ public class RoundTripTransformBeansTest extends
RoundTripTest {
x = roundTrip(x, F1.class);
}
- @BeanConfig(applySwap=@Swap(on="F1c.c",
value=TemporalCalendarSwap.IsoLocalDateTime.class))
+ @Swap(on="Dummy1.c", value=TemporalCalendarSwap.IsoLocalDateTime.class)
+ @Swap(on="F1c.c", value=TemporalCalendarSwap.IsoLocalDateTime.class)
+ @Swap(on="Dummy2.c", value=TemporalCalendarSwap.IsoLocalDateTime.class)
+ private static class F1cConfig {}
+
public static class F1c {
private Calendar c;
@@ -534,8 +546,8 @@ public class RoundTripTransformBeansTest extends
RoundTripTest {
@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();
+ JsonSerializer s =
SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(F1cConfig.class).build();
+ JsonParser p =
JsonParser.DEFAULT.builder().applyAnnotations(F1cConfig.class).build();
F1c x = F1c.create();
String r = null;
@@ -590,7 +602,11 @@ public class RoundTripTransformBeansTest extends
RoundTripTest {
x = roundTrip(x, F2.class);
}
- @BeanConfig(applySwap=@Swap(on="F2ac.c",
value=TemporalCalendarSwap.IsoLocalDateTime.class))
+ @Swap(on="Dummy1.c", value=TemporalCalendarSwap.IsoLocalDateTime.class)
+ @Swap(on="F2ac.c", value=TemporalCalendarSwap.IsoLocalDateTime.class)
+ @Swap(on="Dummy2.c", value=TemporalCalendarSwap.IsoLocalDateTime.class)
+ private static class F2acConfig {}
+
public static class F2ac {
protected Calendar c;
}
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
index 0ead3f9..8729a83 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
@@ -32,7 +32,7 @@ public class RountTripBeansWithBuilders extends RoundTripTest
{
public RountTripBeansWithBuilders(String label, SerializerBuilder s,
ParserBuilder p, int flags) throws Exception {
super(label, s, p, flags);
- applyAnnotations(Ac.class);
+ applyAnnotations(AcConfig.class);
}
//====================================================================================================
@@ -83,7 +83,11 @@ public class RountTripBeansWithBuilders extends
RoundTripTest {
assertObject(a).json().is("{f1:1}");
}
- @BeanConfig(applyBean=@Bean(on="Builder", fluentSetters=true))
+ @Bean(on="Dummy1", fluentSetters=true)
+ @Bean(on="Builder", fluentSetters=true)
+ @Bean(on="Dummy2", fluentSetters=true)
+ private static class AcConfig {}
+
public static class Ac {
private final int f1;
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnore_Test.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnore_Test.java
index 43c792e..ef7b7c5 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnore_Test.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnore_Test.java
@@ -45,12 +45,10 @@ public class BeanIgnore_Test {
assertObject(new A()).json().is("{c:'c',a:'a'}");
}
- @BeanConfig(
- applyBeanIgnore={
- @BeanIgnore(on="Ac.getB"),
- @BeanIgnore(on="Ac.d")
- }
- )
+ @BeanIgnore(on="Ac.getB")
+ @BeanIgnore(on="Ac.d")
+ private static class AcConfig {}
+
public static class Ac {
public String getA() {
return "a";
@@ -67,7 +65,7 @@ public class BeanIgnore_Test {
@Test
public void testBeanIgnoreOnProperties_usingConfig() throws Exception {
- assertObject(new
Ac()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(Ac.class).build()).is("{c:'c',a:'a'}");
+ assertObject(new
Ac()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(AcConfig.class).build()).is("{c:'c',a:'a'}");
}
//------------------------------------------------------------------------------------------------------------------
@@ -98,7 +96,9 @@ public class BeanIgnore_Test {
assertObject(new B()).json().is("{f2:2,f3:'xxx',f4:'xxx'}");
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="B1c"))
+ @BeanIgnore(on="B1c")
+ private static class B1cConfig {}
+
public static class B1c {
public int f = 1;
@@ -119,7 +119,7 @@ public class BeanIgnore_Test {
@Test
public void testBeanIgnoreOnBean_usingConfig() throws Exception {
- assertObject(new
Bc()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(B1c.class).build()).is("{f2:2,f3:'xxx',f4:'xxx'}");
+ assertObject(new
Bc()).serialized(SimpleJsonSerializer.DEFAULT.builder().applyAnnotations(B1cConfig.class).build()).is("{f2:2,f3:'xxx',f4:'xxx'}");
}
}
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
index b22fa66..29acbce 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/Bean_Test.java
@@ -52,7 +52,11 @@ public class Bean_Test {
assertEquals("{f1:1}", json);
}
- @BeanConfig(applyBean=@Bean(on="A2"))
+ @Bean(on="Dummy1")
+ @Bean(on="A2")
+ @Bean(on="Dummy2")
+ private static class A2Config {}
+
@SuppressWarnings("unused")
private static class A2 {
public int f1;
@@ -63,7 +67,7 @@ public class Bean_Test {
return a;
}
}
- static ClassInfo a2ci = ClassInfo.of(A2.class);
+ static ClassInfo a2ci = ClassInfo.of(A2Config.class);
@Test
public void testBeanAnnotationOverridesPrivate_usingConfig() throws
Exception {
@@ -119,7 +123,12 @@ public class Bean_Test {
assertEquals("{f1:1,f2:2}", json);
}
-
@BeanConfig(applyBeanc=@Beanc(on="B2()"),applyBeanp={@Beanp(on="B2.f1"),@Beanp(on="B2.setF2"),@Beanp(on="B2.getF2")})
+ @Beanc(on="B2()")
+ @Beanp(on="B2.f1")
+ @Beanp(on="B2.setF2")
+ @Beanp(on="B2.getF2")
+ private static class B2Config {}
+
@SuppressWarnings("unused")
public static class B2 {
@@ -144,7 +153,7 @@ public class Bean_Test {
return b;
}
}
- static ClassInfo b2ci = ClassInfo.of(B2.class);
+ static ClassInfo b2ci = ClassInfo.of(B2Config.class);
@Test
public void testBeanxAnnotationOverridesPrivate_usingConfig() throws
Exception {
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
index 0c4e962..9dfbd54 100755
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java
@@ -334,7 +334,7 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_BEAN_exampleMethod_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B1c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B1cConfig.class).build().createSession();
assertObject(s.getSchema(B1c.class)).json().is("{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'foobar'}}");
}
@@ -342,17 +342,21 @@ public class JsonSchemaGeneratorTest {
public void addExample_BEAN_exampleMethod_wDefault_usingConfig() throws
Exception {
B1c b = new B1c();
b.f1 = "baz";
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B1c.class).example(B1c.class,
b).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B1cConfig.class).example(B1c.class,
b).build().createSession();
assertObject(s.getSchema(B1c.class)).json().is("{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'baz'}}");
}
@Test
public void addExample_BEAN_exampleMethod_array2d_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B1c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B1cConfig.class).build().createSession();
assertObject(s.getSchema(B1c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'foobar'}}}}");
}
- @BeanConfig(applyExample=@Example(on="B1c.example"))
+ @Example(on="Dummy1.example")
+ @Example(on="B1c.example")
+ @Example(on="Dummy2.example")
+ private static class B1cConfig {}
+
public static class B1c extends SimpleBean {
public static B1c example() {
@@ -390,17 +394,21 @@ public class JsonSchemaGeneratorTest {
public void
addExample_BEAN_exampleMethodOverridden_wDefault_usingConfig() throws Exception
{
B2c b = new B2c();
b.f1 = "baz";
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B2c.class).example(B2c.class,
b).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B2cConfig.class).example(B2c.class,
b).build().createSession();
assertObject(s.getSchema(B2c.class)).json().is("{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'baz'}}");
}
@Test
public void
addExample_BEAN_exampleMethodOverridden_array2d_usingConfig() throws Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B2c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B2cConfig.class).build().createSession();
assertObject(s.getSchema(B2c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'foobar'}}}}");
}
- @BeanConfig(applyExample=@Example(on="B2c.example2"))
+ @Example(on="Dummy1.example2")
+ @Example(on="B2c.example2")
+ @Example(on="Dummy2.example2")
+ private static class B2cConfig {}
+
public static class B2c extends B1c {
public static B2c example2() {
@@ -436,17 +444,19 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_BEAN_exampleField_usingConfig() throws Exception
{
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B3c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B3cConfig.class).build().createSession();
assertObject(s.getSchema(B3c.class)).json().is("{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'foobar'}}");
}
@Test
public void addExample_BEAN_exampleField_array2d_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B3c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B3cConfig.class).build().createSession();
assertObject(s.getSchema(B3c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'foobar'}}}}");
}
- @BeanConfig(applyExample=@Example(on="B3c.EXAMPLE"))
+ @Example(on="B3c.EXAMPLE")
+ private static class B3cConfig {}
+
public static class B3c extends SimpleBean {
public static B3c EXAMPLE = getExample();
@@ -475,17 +485,19 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_BEAN_exampleBeanAnnotation_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B4c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B4cConfig.class).build().createSession();
assertObject(s.getSchema(B4c.class)).json().is("{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'foobar'}}");
}
@Test
public void addExample_BEAN_exampleBeanAnnotation_2darray_usingConfig()
throws Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B4c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("bean").applyAnnotations(B4cConfig.class).build().createSession();
assertObject(s.getSchema(B4c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'object',properties:{f1:{type:'string'}},'x-example':{f1:'foobar'}}}}");
}
- @BeanConfig(applyExample=@Example(on="B4c", value="{f1:'foobar'}"))
+ @Example(on="B4c", value="{f1:'foobar'}")
+ private static class B4cConfig {}
+
public static class B4c extends SimpleBean {}
@Test
@@ -541,7 +553,7 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_MAP_exampleMethod_usingConfig() throws Exception
{
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C1c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C1cConfig.class).build().createSession();
assertObject(s.getSchema(C1c.class)).json().is("{type:'object',additionalProperties:{type:'object',properties:{f1:{type:'string'}}},'x-example':{'123':{f1:'foobar'}}}");
}
@@ -549,11 +561,13 @@ public class JsonSchemaGeneratorTest {
public void addExample_MAP_exampleMethod_wDefault_usingConfig() throws
Exception {
C1c b = new C1c();
b.put(456, B1.example());
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C1c.class).example(C1c.class,
b).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C1cConfig.class).example(C1c.class,
b).build().createSession();
assertObject(s.getSchema(C1c.class)).json().is("{type:'object',additionalProperties:{type:'object',properties:{f1:{type:'string'}}},'x-example':{'456':{f1:'foobar'}}}");
}
- @BeanConfig(applyExample=@Example(on="C1c.example"))
+ @Example(on="C1c.example")
+ private static class C1cConfig {}
+
@SuppressWarnings("serial")
public static class C1c extends BeanMap {
@@ -591,18 +605,20 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_MAP_exampleField_usingConfig() throws Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C2c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C2cConfig.class).build().createSession();
assertObject(s.getSchema(C2c.class)).json().is("{type:'object',additionalProperties:{type:'object',properties:{f1:{type:'string'}}},'x-example':{'123':{f1:'foobar'}}}");
}
@Test
public void addExample_MAP_exampleField_array2d_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C2c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C2cConfig.class).build().createSession();
assertObject(s.getSchema(C2c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'object',additionalProperties:{type:'object',properties:{f1:{type:'string'}}},'x-example':{'123':{f1:'foobar'}}}}}");
}
+ @Example(on="C2c.EXAMPLE")
+ private static class C2cConfig {}
+
@SuppressWarnings("serial")
- @BeanConfig(applyExample=@Example(on="C2c.EXAMPLE"))
public static class C2c extends BeanMap {
public static C2c EXAMPLE = getExample();
@@ -632,18 +648,20 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_MAP_exampleBeanAnnotation_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C3c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C3cConfig.class).build().createSession();
assertObject(s.getSchema(C3c.class)).json().is("{type:'object',additionalProperties:{type:'object',properties:{f1:{type:'string'}}},'x-example':{'123':{f1:'baz'}}}");
}
@Test
public void addExample_MAP_exampleBeanAnnotation_2darray_usingConfig()
throws Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C3c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("map").applyAnnotations(C3cConfig.class).build().createSession();
assertObject(s.getSchema(C3c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'object',additionalProperties:{type:'object',properties:{f1:{type:'string'}}},'x-example':{'123':{f1:'baz'}}}}}");
}
+ @Example(on="C3c", value="{'123':{f1:'baz'}}")
+ private static class C3cConfig {}
+
@SuppressWarnings("serial")
- @BeanConfig(applyExample=@Example(on="C3c", value="{'123':{f1:'baz'}}"))
public static class C3c extends BeanMap {}
@Test
@@ -707,11 +725,13 @@ public class JsonSchemaGeneratorTest {
SimpleBean sb = new SimpleBean();
sb.f1 = "baz";
b.add(sb);
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("collection").applyAnnotations(D1c.class).example(D1c.class,
b).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("collection").applyAnnotations(D1cConfig.class).example(D1c.class,
b).build().createSession();
assertObject(s.getSchema(D1c.class)).json().is("{type:'array',items:{type:'object',properties:{f1:{type:'string'}}},'x-example':[{f1:'baz'}]}");
}
- @BeanConfig(applyExample=@Example(on="D1c.example"))
+ @Example(on="D1c.example")
+ private static class D1cConfig {}
+
@SuppressWarnings("serial")
public static class D1c extends BeanList {
@@ -749,18 +769,20 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_COLLECTION_exampleField_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("collection").applyAnnotations(D2c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("collection").applyAnnotations(D2cConfig.class).build().createSession();
assertObject(s.getSchema(D2c.class)).json().is("{type:'array',items:{type:'object',properties:{f1:{type:'string'}}},'x-example':[{f1:'foobar'}]}");
}
@Test
public void addExample_ARRAY_exampleField_array2d_usingConfig() throws
Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("array").applyAnnotations(D2c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("array").applyAnnotations(D2cConfig.class).build().createSession();
assertObject(s.getSchema(D2c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'array',items:{type:'object',properties:{f1:{type:'string'}}}}},'x-example':[[[{f1:'foobar'}]]]}");
}
+ @Example(on="D2c.EXAMPLE")
+ private static class D2cConfig {}
+
@SuppressWarnings("serial")
- @BeanConfig(applyExample=@Example(on="D2c.EXAMPLE"))
public static class D2c extends BeanList {
public static D2c EXAMPLE = getExample();
@@ -790,18 +812,20 @@ public class JsonSchemaGeneratorTest {
@Test
public void addExample_COLLECTION_exampleBeanAnnotation_usingConfig()
throws Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("collection").applyAnnotations(D3c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("collection").applyAnnotations(D3cConfig.class).build().createSession();
assertObject(s.getSchema(D3c.class)).json().is("{type:'array',items:{type:'object',properties:{f1:{type:'string'}}},'x-example':[{f1:'baz'}]}");
}
@Test
public void
addExample_ARRAY_exampleBeanAnnotation_2darray_usingConfig() throws Exception {
- JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("array").applyAnnotations(D3c.class).build().createSession();
+ JsonSchemaGeneratorSession s =
JsonSchemaGenerator.DEFAULT.builder().addExamplesTo("array").applyAnnotations(D3cConfig.class).build().createSession();
assertObject(s.getSchema(D3c[][].class)).json().is("{type:'array',items:{type:'array',items:{type:'array',items:{type:'object',properties:{f1:{type:'string'}}}}},'x-example':[[[{f1:'baz'}]]]}");
}
+ @Example(on="D3c", value="[{f1:'baz'}]")
+ private static class D3cConfig {}
+
@SuppressWarnings("serial")
- @BeanConfig(applyExample=@Example(on="D3c", value="[{f1:'baz'}]"))
public static class D3c extends BeanList {}
@Test
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
index 7063b50..014c961 100644
---
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
@@ -20,13 +20,13 @@ import org.apache.juneau.jena.annotation.*;
import org.apache.juneau.xml.annotation.*;
@Bean(sort=true)
-@BeanConfig(
- applyURI={
-
@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 {
+ @Uri(on="Dummy1")
+
@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")
+ @Uri(on="Dummy2")
+ public static class Config {}
+
// String annotated as a URI
@Rdf(beanUri=true)
@Xml(format=XmlFormat.ATTR)
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 ce70eae..94a15ed 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
@@ -603,7 +603,7 @@ public class UriResolutionTest {
@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();
+ Serializer s =
JsonSerializer.create().ssq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testSerialize(s, results.json, new TestURIc());
}
@@ -615,7 +615,7 @@ public class UriResolutionTest {
@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();
+ Serializer s =
JsonSerializer.create().ssq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testParse(s,
JsonParser.DEFAULT.builder().applyAnnotations(TestURIc.class).build(), new
TestURIc());
}
@@ -627,7 +627,7 @@ public class UriResolutionTest {
@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();
+ Serializer s =
XmlSerializer.create().sq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testSerialize(s, results.xml, new TestURIc());
}
@@ -639,8 +639,8 @@ public class UriResolutionTest {
@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());
+ Serializer s =
XmlSerializer.create().sq().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
+ testParse(s,
XmlParser.DEFAULT.builder().applyAnnotations(TestURIc.Config.class).build(),
new TestURIc());
}
@Test
@@ -651,7 +651,7 @@ public class UriResolutionTest {
@Test
public void c1c_testHtmlSerialize_usingConfig() throws Exception {
- Serializer s =
HtmlSerializer.create().sq().uriAnchorText(AnchorText.LAST_TOKEN).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.class).build();
+ Serializer s =
HtmlSerializer.create().sq().uriAnchorText(AnchorText.LAST_TOKEN).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testSerialize(s, results.html, new TestURIc());
}
@@ -663,8 +663,8 @@ public class UriResolutionTest {
@Test
public void c2c_testHtmlParse_usingConfig() throws Exception {
- Serializer s =
HtmlSerializer.create().sq().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());
+ Serializer s =
HtmlSerializer.create().sq().uriAnchorText(AnchorText.LAST_TOKEN).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
+ testParse(s,
HtmlParser.DEFAULT.builder().applyAnnotations(TestURIc.Config.class).build(),
new TestURIc());
}
@Test
@@ -675,7 +675,7 @@ public class UriResolutionTest {
@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();
+ Serializer s =
UonSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testSerialize(s, results.uon, new TestURIc());
}
@@ -687,8 +687,8 @@ public class UriResolutionTest {
@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());
+ Serializer s =
UonSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
+ testParse(s,
UonParser.DEFAULT.builder().applyAnnotations(TestURIc.Config.class).build(),
new TestURIc());
}
@Test
@@ -699,7 +699,7 @@ public class UriResolutionTest {
@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();
+ Serializer s =
UrlEncodingSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testSerialize(s, results.urlEncoding, new TestURIc());
}
@@ -711,8 +711,8 @@ public class UriResolutionTest {
@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());
+ Serializer s =
UrlEncodingSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
+ testParse(s,
UrlEncodingParser.DEFAULT.builder().applyAnnotations(TestURIc.Config.class).build(),
new TestURIc());
}
@Test
@@ -723,7 +723,7 @@ public class UriResolutionTest {
@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();
+ Serializer s =
MsgPackSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testSerialize(s, results.msgPack, new TestURIc());
}
@@ -735,8 +735,8 @@ public class UriResolutionTest {
@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());
+ Serializer s =
MsgPackSerializer.create().uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
+ testParse(s,
MsgPackParser.DEFAULT.builder().applyAnnotations(TestURIc.Config.class).build(),
new TestURIc());
}
@Test
@@ -747,7 +747,7 @@ public class UriResolutionTest {
@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();
+ Serializer s =
RdfSerializer.create().language(Constants.LANG_RDF_XML_ABBREV).uriContext(input.context).uriResolution(input.resolution).uriRelativity(input.relativity).applyAnnotations(TestURIc.Config.class).build();
testSerialize(s, results.rdfXml, new TestURIc());
}
}
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/pojos/XBeans.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/pojos/XBeans.java
index 9c507a3..9fbbfde 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/pojos/XBeans.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/pojos/XBeans.java
@@ -140,7 +140,8 @@ public class XBeans {
public static XC INSTANCE = get();
}
- @BeanConfig(applyBean={@Bean(on="XD,XE,XF",sort=true)})
+
+ @Bean(on="XD,XE,XF",sort=true)
@UrlEncodingConfig(applyUrlEncoding={@UrlEncoding(on="C",expandedParams=true)})
public static class Annotations {}
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoListSwapTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoListSwapTest.java
index d656101..39a3d5d 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoListSwapTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoListSwapTest.java
@@ -193,7 +193,9 @@ public class AutoListSwapTest {
assertNull(find(D02.D02A.class));
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="D01c"))
+ @BeanIgnore(on="D01c")
+ private static class D01cConfig {}
+
public static class D01c {
public List<String> toList() {
return STRINGLIST;
@@ -209,25 +211,27 @@ public class AutoListSwapTest {
@Test
public void d03_ignoreClass_beanIgnore_usingConfig() throws Exception {
- assertNull(find(bc(D01c.class), D01c.class));
+ assertNull(find(bc(D01cConfig.class), D01c.class));
}
@Test
public void d04_ignoreClass_memberClass_usingConfig() throws Exception {
- assertNull(find(bc(D01c.class), D02c.D02Ac.class));
+ assertNull(find(bc(D01cConfig.class), D02c.D02Ac.class));
}
//------------------------------------------------------------------------------------------------------------------
// Ignore swap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="E01c.toList")
+ private static class E01Config {}
+
public static class E01 {
@BeanIgnore
public List<String> toList() {
return STRINGLIST;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="E01c.toList"))
public static class E01c {
public List<String> toList() {
return STRINGLIST;
@@ -262,7 +266,7 @@ public class AutoListSwapTest {
@Test
public void e01c_ignoreSwapMethod_beanIgnore_usingConfig() throws
Exception {
-
assertNull(find(BeanContext.DEFAULT.builder().applyAnnotations(E01c.class).build(),
E01c.class));
+
assertNull(find(BeanContext.DEFAULT.builder().applyAnnotations(E01Config.class).build(),
E01c.class));
}
@Test
@@ -289,6 +293,9 @@ public class AutoListSwapTest {
// Ignore unswap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="F01c.create")
+ private static class F01Config {}
+
public static class F01 {
public List<String> toList() {
return STRINGLIST;
@@ -298,7 +305,6 @@ public class AutoListSwapTest {
return null;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="F01c.create"))
public static class F01c {
public List<String> toList() {
return STRINGLIST;
@@ -356,7 +362,7 @@ public class AutoListSwapTest {
@Test(expected = ParseException.class)
public void f01c_ignoreUnswapMethod_beanIgnore_applyConfig() throws
Exception {
- find(bc(F01c.class), F01c.class).unswap(null, null, null);
+ find(bc(F01Config.class), F01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
@@ -388,6 +394,9 @@ public class AutoListSwapTest {
// Ignore constructor
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="G01c(List)")
+ private static class G01Config {}
+
public static class G01 {
@BeanIgnore
public G01(List<String> o) {}
@@ -396,7 +405,6 @@ public class AutoListSwapTest {
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="G01c(List)"))
public static class G01c {
public G01c(List<String> o) {}
public List<String> toList() {
@@ -419,7 +427,7 @@ public class AutoListSwapTest {
@Test(expected = ParseException.class)
public void g01c_ignoreUnswapConstructor_beanIgnore_usingConfig()
throws Exception {
- find(bc(G01c.class), G01c.class).unswap(null, null, null);
+ find(bc(G01Config.class), G01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoMapSwapTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoMapSwapTest.java
index 0667471..7602762 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoMapSwapTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoMapSwapTest.java
@@ -170,13 +170,15 @@ public class AutoMapSwapTest {
// Ignore class
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="D01c")
+ private static class D01Config {}
+
@BeanIgnore
public static class D01 {
public Map<String,String> toMap() {
return STRINGMAP;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="D01c"))
public static class D01c {
public Map<String,String> toMap() {
return STRINGMAP;
@@ -197,7 +199,7 @@ public class AutoMapSwapTest {
@Test
public void d01c_ignoreClass_beanIgnore_usingConfig() throws Exception {
- assertNull(find(bc(D01c.class), D01c.class));
+ assertNull(find(bc(D01Config.class), D01c.class));
}
@Test
@@ -209,13 +211,15 @@ public class AutoMapSwapTest {
// Ignore swap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="E01c.toMap")
+ private static class E01Config {}
+
public static class E01 {
@BeanIgnore
public Map<String,String> toMap() {
return STRINGMAP;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="E01c.toMap"))
public static class E01c {
public Map<String,String> toMap() {
return STRINGMAP;
@@ -250,7 +254,7 @@ public class AutoMapSwapTest {
@Test
public void e01c_ignoreSwapMethod_beanIgnore_usingConfig() throws
Exception {
- assertNull(find(bc(E01c.class), E01c.class));
+ assertNull(find(bc(E01Config.class), E01c.class));
}
@Test
@@ -277,6 +281,9 @@ public class AutoMapSwapTest {
// Ignore unswap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="F01c.create(Map)")
+ private static class F01Config {}
+
public static class F01 {
public Map<String,String> toMap() {
return STRINGMAP;
@@ -286,7 +293,6 @@ public class AutoMapSwapTest {
return null;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="F01c.create(Map)"))
public static class F01c {
public Map<String,String> toMap() {
return STRINGMAP;
@@ -344,7 +350,7 @@ public class AutoMapSwapTest {
@Test(expected = ParseException.class)
public void f01c_ignoreUnswapMethod_beanIgnore_usingConfig() throws
Exception {
- find(bc(F01c.class), F01c.class).unswap(null, null, null);
+ find(bc(F01Config.class), F01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
@@ -376,6 +382,9 @@ public class AutoMapSwapTest {
// Ignore constructor
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="G01c(Map)")
+ private static class G01Config {}
+
public static class G01 {
@BeanIgnore
public G01(Map<String,String> o) {}
@@ -384,7 +393,6 @@ public class AutoMapSwapTest {
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="G01c(Map)"))
public static class G01c {
public G01c(Map<String,String> o) {}
public Map<String,String> toMap() {
@@ -407,7 +415,7 @@ public class AutoMapSwapTest {
@Test(expected = ParseException.class)
public void g01c_ignoreUnswapConstructor_beanIgnore_usingConfig()
throws Exception {
- find(bc(G01c.class), G01c.class).unswap(null, null, null);
+ find(bc(G01Config.class), G01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoNumberSwapTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoNumberSwapTest.java
index 5fb691f..5563d9d 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoNumberSwapTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoNumberSwapTest.java
@@ -596,13 +596,15 @@ public class AutoNumberSwapTest {
// Ignore class
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="D01c")
+ private static class D01Config {}
+
@BeanIgnore
public static class D01 {
public Integer toInteger() {
return 1;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="D01c"))
public static class D01c {
public Integer toInteger() {
return 1;
@@ -623,7 +625,7 @@ public class AutoNumberSwapTest {
@Test
public void d01c_ignoreClass_beanIgnore_usingConfig() throws Exception {
- assertNull(find(bc(D01c.class), D01c.class));
+ assertNull(find(bc(D01Config.class), D01c.class));
}
@Test
@@ -647,13 +649,15 @@ public class AutoNumberSwapTest {
// Ignore swap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="E01c.toInteger")
+ private static class E01Config {}
+
public static class E01 {
@BeanIgnore
public Integer toInteger() {
return 1;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="E01c.toInteger"))
public static class E01c {
public Integer toInteger() {
return 1;
@@ -688,7 +692,7 @@ public class AutoNumberSwapTest {
@Test
public void e01c_ignoreSwapMethod_beanIgnore_usingConfig() throws
Exception {
- assertNull(find(bc(E01c.class), E01c.class));
+ assertNull(find(bc(E01Config.class), E01c.class));
}
@Test
@@ -715,6 +719,9 @@ public class AutoNumberSwapTest {
// Ignore unswap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="F01c.create(java.lang.Integer)")
+ private static class F01Config {}
+
public static class F01 {
public Integer toInteger() {
return 1;
@@ -724,7 +731,6 @@ public class AutoNumberSwapTest {
return null;
}
}
-
@BeanConfig(applyBeanIgnore=@BeanIgnore(on="F01c.create(java.lang.Integer)"))
public static class F01c {
public Integer toInteger() {
return 1;
@@ -782,7 +788,7 @@ public class AutoNumberSwapTest {
@Test(expected = ParseException.class)
public void f01c_ignoreUnswapMethod_beanIgnore_usingConfig() throws
Exception {
- find(bc(F01c.class), F01c.class).unswap(null, null, null);
+ find(bc(F01Config.class), F01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
@@ -814,6 +820,9 @@ public class AutoNumberSwapTest {
// Ignore constructor
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="G01c(java.lang.Integer)")
+ private static class G01Config {}
+
public static class G01 {
@BeanIgnore
public G01(Integer o) {}
@@ -822,7 +831,6 @@ public class AutoNumberSwapTest {
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="G01c(java.lang.Integer)"))
public static class G01c {
public G01c(Integer o) {}
public Integer toInteger() {
@@ -845,7 +853,7 @@ public class AutoNumberSwapTest {
@Test(expected = ParseException.class)
public void g01c_ignoreUnswapConstructor_beanIgnore_usingConfig()
throws Exception {
- find(bc(G01c.class), G01c.class).unswap(null, null, null);
+ find(bc(G01Config.class), G01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoObjectSwapTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoObjectSwapTest.java
index e04d660..42ebf28 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoObjectSwapTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/transform/AutoObjectSwapTest.java
@@ -173,13 +173,15 @@ public class AutoObjectSwapTest {
// Ignore class
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="D01c")
+ private static class D01Config {}
+
@BeanIgnore
public static class D01 {
public Map<String,String> swap() {
return STRINGMAP;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="D01c"))
public static class D01c {
public Map<String,String> swap() {
return STRINGMAP;
@@ -200,7 +202,7 @@ public class AutoObjectSwapTest {
@Test
public void d01c_ignoreClass_beanIgnore_usingConfig() throws Exception {
- assertNull(find(bc(D01c.class), D01c.class));
+ assertNull(find(bc(D01Config.class), D01c.class));
}
@Test
@@ -212,13 +214,15 @@ public class AutoObjectSwapTest {
// Ignore swap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="E01c.swap")
+ private static class E01Config {}
+
public static class E01 {
@BeanIgnore
public Map<String,String> swap() {
return STRINGMAP;
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="E01c.swap"))
public static class E01c {
public Map<String,String> swap() {
return STRINGMAP;
@@ -248,7 +252,7 @@ public class AutoObjectSwapTest {
@Test
public void e01c_ignoreSwapMethod_beanIgnore_usingConfig() throws
Exception {
- assertNull(find(bc(E01c.class), E01c.class));
+ assertNull(find(bc(E01Config.class), E01c.class));
}
@Test
@@ -270,6 +274,9 @@ public class AutoObjectSwapTest {
// Ignore unswap method
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="F01c.create(java.util.Map)")
+ private static class F01Config {}
+
public static class F01 {
public Map<String,String> swap() {
return STRINGMAP;
@@ -279,7 +286,6 @@ public class AutoObjectSwapTest {
return null;
}
}
-
@BeanConfig(applyBeanIgnore=@BeanIgnore(on="F01c.create(java.util.Map)"))
public static class F01c {
public Map<String,String> swap() {
return STRINGMAP;
@@ -337,7 +343,7 @@ public class AutoObjectSwapTest {
@Test(expected = ParseException.class)
public void f01c_ignoreUnswapMethod_beanIgnore_usingConfig() throws
Exception {
- find(bc(F01c.class), F01c.class).unswap(null, null, null);
+ find(bc(F01Config.class), F01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
@@ -369,6 +375,9 @@ public class AutoObjectSwapTest {
// Ignore constructor
//------------------------------------------------------------------------------------------------------------------
+ @BeanIgnore(on="G01c(Map)")
+ private static class G01Config {}
+
public static class G01 {
@BeanIgnore
public G01(Map<String,String> o) {}
@@ -377,7 +386,6 @@ public class AutoObjectSwapTest {
}
}
- @BeanConfig(applyBeanIgnore=@BeanIgnore(on="G01c(Map)"))
public static class G01c {
public G01c(Map<String,String> o) {}
public Map<String,String> swap() {
@@ -400,7 +408,7 @@ public class AutoObjectSwapTest {
@Test(expected = ParseException.class)
public void g01c_ignoreUnswapConstructor_beanIgnore_usingConfig()
throws Exception {
- find(bc(G01c.class), G01c.class).unswap(null, null, null);
+ find(bc(G01Config.class), G01c.class).unswap(null, null, null);
}
@Test(expected = ParseException.class)
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 5eb643d..a0b9dbf 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
@@ -117,7 +117,11 @@ public class DefaultSwapsTest {
}
}
- @BeanConfig(applySwap=@Swap(on="AcBean.f2", value=AcSwap.class))
+ @Swap(on="Dummy1.f2", value=AcSwap.class)
+ @Swap(on="AcBean.f2", value=AcSwap.class)
+ @Swap(on="Dummy2.f2", value=AcSwap.class)
+ private static class AcBeanConfig {}
+
public static class AcBean {
public Enumeration<String> f1 = A.elements();
@@ -126,17 +130,17 @@ public class DefaultSwapsTest {
@Test
public void a01c_Enumeration_usingConfig() throws Exception {
- test("['foo','bar']", Ac.elements(), AcBean.class);
+ test("['foo','bar']", Ac.elements(), AcBeanConfig.class);
}
@Test
public void a02c_Enumeration_overrideSwap_usingConfig() throws
Exception {
- test("'FOO'", Ac.elements(), new AcSwap(), AcBean.class);
+ test("'FOO'", Ac.elements(), new AcSwap(), AcBeanConfig.class);
}
@Test
public void a03c_Enumeration_overrideAnnotation_usingConfig() throws
Exception {
- test("{f1:['foo','bar'],f2:'FOO'}", new AcBean(), AcBean.class);
+ test("{f1:['foo','bar'],f2:'FOO'}", new AcBean(),
AcBeanConfig.class);
}
//------------------------------------------------------------------------------------------------------------------
@@ -181,7 +185,11 @@ public class DefaultSwapsTest {
}
}
- @BeanConfig(applySwap=@Swap(on="BcBean.f2", value=BcSwap.class))
+ @Swap(on="Dummy1.f2", value=BcSwap.class)
+ @Swap(on="BcBean.f2", value=BcSwap.class)
+ @Swap(on="Dummy2.f2", value=BcSwap.class)
+ private static class BcBeanConfig {}
+
public static class BcBean {
public Iterator<?> f1 = B.iterator();
public Iterator<?> f2 = B.iterator();
@@ -189,17 +197,17 @@ public class DefaultSwapsTest {
@Test
public void b01c_Iterator_usingConfig() throws Exception {
- test("['foo','bar']", Bc.iterator(), BcBean.class);
+ test("['foo','bar']", Bc.iterator(), BcBeanConfig.class);
}
@Test
public void b02c_Iterator_overrideSwap_usingConfig() throws Exception {
- test("'FOO'", Bc.iterator(), new BcSwap(), BcBean.class);
+ test("'FOO'", Bc.iterator(), new BcSwap(), BcBeanConfig.class);
}
@Test
public void b03c_Iterator_overrideAnnotation_usingConfig() throws
Exception {
- test("{f1:['foo','bar'],f2:'FOO'}", new BcBean(), BcBean.class);
+ test("{f1:['foo','bar'],f2:'FOO'}", new BcBean(),
BcBeanConfig.class);
}
//------------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/DTOs2.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/DTOs2.java
index b1b7bf7..04b2170 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/DTOs2.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/urlencoding/DTOs2.java
@@ -20,7 +20,9 @@ import org.apache.juneau.urlencoding.annotation.*;
public class DTOs2 {
- @BeanConfig(applyBean={@Bean(on="A,B,C",sort=true)})
+ @Bean(on="Dummy1",sort=true)
+ @Bean(on="A,B,C",sort=true)
+ @Bean(on="Dummy2",sort=true)
@UrlEncodingConfig(applyUrlEncoding={@UrlEncoding(on="C",expandedParams=true)})
public static class Annotations {}
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 18165a7..b69c25f 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
@@ -160,11 +160,6 @@ public class BeanContext extends Context implements
MetaProvider {
* <li><b>Name:</b> <js>"BeanContext.annotations.lo"</js>
* <li><b>Data type:</b> <c>List<{@link
java.lang.annotation.Annotation}></c>
* <li><b>Default:</b> Empty list.
- * <li><b>Annotations:</b>
- * <ul>
- * <li class='ja'>{@link
org.apache.juneau.annotation.BeanConfig#applyBean()}
- * <li class='ja'>{@link
org.apache.juneau.annotation.BeanConfig#applyBeanp()}
- * </ul>
* <li><b>Methods:</b>
* <ul>
* <li class='jm'>{@link
org.apache.juneau.BeanContextBuilder#annotations(Annotation...)}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/MetaProvider.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/MetaProvider.java
index 789bada..ef16b1c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/MetaProvider.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/MetaProvider.java
@@ -15,6 +15,7 @@ package org.apache.juneau;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
+
import static java.util.Collections.*;
/**
@@ -31,40 +32,40 @@ public interface MetaProvider {
public <A extends Annotation> List<A> getAnnotations(Class<A>
a, Class<?> c) {
if (a == null || c == null)
return emptyList();
- A aa = c.getAnnotation(a);
- return aa == null ? emptyList() : singletonList(aa);
+ A[] aa = c.getAnnotationsByType(a);
+ return Arrays.asList(aa);
}
@Override /* MetaProvider */
public <A extends Annotation> List<A>
getDeclaredAnnotations(Class<A> a, Class<?> c) {
if (a == null || c == null)
return emptyList();
- A aa = c.getDeclaredAnnotation(a);
- return aa == null ? emptyList() : singletonList(aa);
+ A[] aa = c.getDeclaredAnnotationsByType(a);
+ return Arrays.asList(aa);
}
@Override /* MetaProvider */
public <A extends Annotation> List<A> getAnnotations(Class<A>
a, Method m) {
if (a == null || m == null)
return emptyList();
- A aa = m.getAnnotation(a);
- return aa == null ? emptyList() : singletonList(aa);
+ A[] aa = m.getAnnotationsByType(a);
+ return Arrays.asList(aa);
}
@Override /* MetaProvider */
public <A extends Annotation> List<A> getAnnotations(Class<A>
a, Field f) {
if (a == null || f == null)
return emptyList();
- A aa = f.getAnnotation(a);
- return aa == null ? emptyList() : singletonList(aa);
+ A[] aa = f.getAnnotationsByType(a);
+ return Arrays.asList(aa);
}
@Override /* MetaProvider */
public <A extends Annotation> List<A> getAnnotations(Class<A>
a, Constructor<?> c) {
if (a == null || c == null)
return emptyList();
- A aa = c.getAnnotation(a);
- return aa == null ? emptyList() : singletonList(aa);
+ A[] aa = c.getAnnotationsByType(a);
+ return Arrays.asList(aa);
}
};
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java
index c5dcf1a..7c12c78 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStoreBuilder.java
@@ -110,6 +110,7 @@ public class PropertyStoreBuilder {
*/
@SuppressWarnings("unchecked")
public PropertyStoreBuilder applyAnnotations(AnnotationList al,
VarResolverSession vr) {
+ vr = vr == null ? VarResolver.DEFAULT.createSession() : vr;
for (AnnotationInfo<?> ai : al.sort()) {
try {
ai.getConfigApply(vr).apply((AnnotationInfo<Annotation>)ai, this, vr);
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 023eddb..44d384c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfig.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfig.java
@@ -50,136 +50,6 @@ public @interface BeanConfig {
//-----------------------------------------------------------------------------------------------------------------
/**
- * Dynamically applies {@link Bean @Bean} annotations to specified
classes.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
Bean#on() @Bean.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- Bean[] applyBean() default {};
-
- /**
- * Dynamically applies {@link Beanc @Beanc} annotations to specified
constructors.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
Beanc#on() @Beanc.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- Beanc[] applyBeanc() default {};
-
- /**
- * Dynamically applies {@link Beanp @Beanp} annotations to specified
methods.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
Beanp#on() @Beanp.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- Beanp[] applyBeanp() default {};
-
- /**
- * Dynamically applies {@link BeanIgnore @BeanIgnore} annotations to
specified classes/methods/fields/constructors.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
BeanIgnore#on() @BeanIgnore.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- BeanIgnore[] applyBeanIgnore() default {};
-
- /**
- * Dynamically applies {@link Example @Example} annotations to
specified classes/methods/fields.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
Example#on() @Example.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- Example[] applyExample() default {};
-
- /**
- * Dynamically applies {@link Marshalled Marshalled} annotations to
specified classes.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
Marshalled#on() Marshalled.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- Marshalled[] applyMarshalled() default {};
-
- /**
- * Dynamically applies {@link NameProperty @NameProperty} annotations
to specified methods/fields.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
NameProperty#on() @NameProperty.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- NameProperty[] applyNameProperty() default {};
-
- /**
- * Dynamically applies {@link ParentProperty @ParentProperty}
annotations to specified methods/fields.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
ParentProperty#on() @ParentProperty.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- ParentProperty[] applyParentProperty() default {};
-
- /**
- * Dynamically applies {@link Swap @Swap} annotations to specified
classes/methods/fields.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
Swap#on() @Swap.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- Swap[] applySwap() default {};
-
- /**
- * Dynamically applies {@link Uri @Uri} annotations to specified
classes/methods/fields.
- *
- * <p>
- * Provides an alternate approach for applying annotations using {@link
Uri#on() @URI.on} to specify the names
- * to apply the annotation to.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc DynamicallyAppliedAnnotations}
- * </ul>
- */
- Uri[] applyURI() default {};
-
- /**
* Configuration property: Minimum bean class visibility.
*
* <p>
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigAnnotation.java
index 24537eb..8dfa7c9 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanConfigAnnotation.java
@@ -132,27 +132,6 @@ public class BeanConfigAnnotation {
psb.set(BEANTRAVERSE_initialDepth,
integer(a.initialDepth(), "initialDepth"));
if (! a.maxDepth().isEmpty())
psb.set(BEANTRAVERSE_maxDepth,
integer(a.maxDepth(), "maxDepth"));
-
- if (a.applyBean().length > 0)
- psb.prependTo(BEAN_annotations, a.applyBean());
- if (a.applyBeanp().length > 0)
- psb.prependTo(BEAN_annotations, a.applyBeanp());
- if (a.applyBeanc().length > 0)
- psb.prependTo(BEAN_annotations, a.applyBeanc());
- if (a.applyBeanIgnore().length > 0)
- psb.prependTo(BEAN_annotations,
a.applyBeanIgnore());
- if (a.applyExample().length > 0)
- psb.prependTo(BEAN_annotations,
a.applyExample());
- if (a.applyMarshalled().length > 0)
- psb.prependTo(BEAN_annotations,
a.applyMarshalled());
- if (a.applyNameProperty().length > 0)
- psb.prependTo(BEAN_annotations,
a.applyNameProperty());
- if (a.applyParentProperty().length > 0)
- psb.prependTo(BEAN_annotations,
a.applyParentProperty());
- if (a.applyURI().length > 0)
- psb.prependTo(BEAN_annotations, a.applyURI());
- if (a.applySwap().length > 0)
- psb.prependTo(BEAN_annotations, a.applySwap());
}
private Locale locale(String in) {
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 1ed821b..05fd282 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
@@ -17,6 +17,8 @@ import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
+import org.apache.juneau.*;
+
/**
* Ignore classes, fields, and methods from being interpreted as bean or bean
components.
*
@@ -44,7 +46,7 @@ public @interface BeanIgnore {
* Dynamically apply this annotation to the specified
classes/methods/fields/constructors.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applyBeanIgnore()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing class/method/field/constructor.
* It is ignored when the annotation is applied directly to
classes/methods/fields/constructors.
*
* <h5 class='section'>Valid patterns:</h5>
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 c7d1be9..e60875b 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
@@ -65,7 +65,7 @@ public @interface Beanc {
* Dynamically apply this annotation to the specified constructors.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applyBeanc()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing constructor.
* It is ignored when the annotation is applied directly to
constructors.
*
* <p>
@@ -76,9 +76,9 @@ public @interface Beanc {
* <jk>private final</jk> String <jf>name</jf>;
* <jk>private final int</jk> <jf>age</jf>;
*
- * <jk>public</jk> Person(String name,
<jk>int</jk> age) {
- * <jk>this</jk>.<jf>name</jf> = name;
- * <jk>this</jk>.<jf>age</jf> = age;
+ * <jk>public</jk> Person(String <jv>name</jv>,
<jk>int</jk> <jv>age</jv>) {
+ * <jk>this</jk>.<jf>name</jf> =
<jv>name</jv>;
+ * <jk>this</jk>.<jf>age</jf> =
<jv>age</jv>;
* }
*
* <jc>// Read only properties.</jc>
@@ -93,15 +93,16 @@ public @interface Beanc {
* }
* }
*
- *
<ja>@BeanConfig</ja>(applyBeanc=<ja>@Beanc</ja>(on="Person(String,int)",
properties=<js>"name,age"</js>))
- * public static class X {}
+ * <ja>@BeanConfig</ja>
+ * <ja>@Beanc</ja>(on=<js>"Person(String,int)"</js>,
properties=<js>"name,age"</js>))
+ * <jk>public static class</jk> MyConfig {}
* </p>
* <p class='bpcode w800'>
* <jc>// Parsing into a read-only bean.</jc>
- * String json = <js>"{name:'John Smith',age:45}"</js>;
- * Person p =
JsonParser.<jsf>DEFAULT</jsf>.builder().applyAnnotations(X.<jk>class</jk>).build().parse(json);
- * String name = p.getName(); <jc>// "John Smith"</jc>
- * <jk>int</jk> age = p.getAge(); <jc>// 45</jc>
+ * String <jv>json</jv> = <js>"{name:'John
Smith',age:45}"</js>;
+ * Person <jv>person</jv> =
JsonParser.<jsf>DEFAULT</jsf>.builder().applyAnnotations(MyConfig.<jk>class</jk>).build().parse(<jv>json</jv>);
+ * String <jv>name</jv> = <jv>person</jv>.getName();
<jc>// "John Smith"</jc>
+ * <jk>int</jk> <jv>age</jv> = <jv>person</jv>.getAge();
<jc>// 45</jc>
* </p>
*
* <h5 class='section'>Valid patterns:</h5>
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 495ddfc..0ba4fe4 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
@@ -210,7 +210,7 @@ public @interface Beanp {
* Dynamically apply this annotation to the specified fields/methods.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applyBeanp()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing field/method.
* It is ignored when the annotation is applied directly to
fields/methods.
*
* <h5 class='section'>Valid patterns:</h5>
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 9ebc09f..193b89a 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
@@ -17,6 +17,8 @@ import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
+import org.apache.juneau.*;
+
/**
* Identifies examples for POJOs.
*
@@ -68,7 +70,7 @@ public @interface Example {
* Dynamically apply this annotation to the specified
classes/methods/fields.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applyExample()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing class/method/field.
* It is ignored when the annotation is applied directly to
classes/methods/fields.
*
* <h5 class='section'>Valid patterns:</h5>
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ExampleAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ExampleAnnotation.java
index 989cc8f..04a25c7 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ExampleAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ExampleAnnotation.java
@@ -168,7 +168,7 @@ public class ExampleAnnotation {
/**
* Applies targeted {@link Example} annotations to a {@link
PropertyStoreBuilder}.
*/
- public class Apply extends ConfigApply<Example> {
+ public static class Apply extends ConfigApply<Example> {
/**
* Constructor.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Marshalled.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Marshalled.java
index d89c876..9669cfe 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Marshalled.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Marshalled.java
@@ -99,7 +99,7 @@ public @interface Marshalled {
* Dynamically apply this annotation to the specified classes.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applyMarshalled()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing class.
* It is ignored when the annotation is applied directly to classes.
*
* <p>
@@ -114,11 +114,7 @@ public @interface Marshalled {
*
* <jc>// Java REST method with @BeanConfig annotation.</jc>
* <ja>@RestMethod</ja>(...)
- * <ja>@BeanConfig</ja>(
- * applyMarshalled={
- * <ja>@Marshalled</ja>(on=<js>"B"</js>,
example=<js>"{foo:'bar'}"</js>)
- * }
- * )
+ * <ja>@Marshalled</ja>(on=<js>"B"</js>,
example=<js>"{foo:'bar'}"</js>)
* <jk>public void</jk> doFoo() {...}
* </p>
*
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 d55433b..61a0fbd 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
@@ -17,6 +17,8 @@ import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
+import org.apache.juneau.*;
+
/**
* Identifies a setter as a method for setting the name of a POJO as it's
known by its parent object.
*
@@ -47,7 +49,7 @@ public @interface NameProperty {
* Dynamically apply this annotation to the specified methods/fields.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applyNameProperty()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing method/field.
* It is ignored when the annotation is applied directly to
methods/fields.
*
* <h5 class='section'>Valid patterns:</h5>
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 cf16dbf..bd7a0c2 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
@@ -17,6 +17,8 @@ import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
+import org.apache.juneau.*;
+
/**
* Identifies a setter as a method for adding a parent reference to a child
object.
*
@@ -50,7 +52,7 @@ public @interface ParentProperty {
* Dynamically apply this annotation to the specified methods/fields.
*
* <p>
- * Used in conjunction with the {@link
BeanConfig#applyParentProperty()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing method/field.
* It is ignored when the annotation is applied directly to
methods/fields.
*
* <h5 class='section'>Valid patterns:</h5>
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentPropertyAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentPropertyAnnotation.java
index 0622111..0d3bf40 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentPropertyAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/ParentPropertyAnnotation.java
@@ -123,7 +123,7 @@ public class ParentPropertyAnnotation {
/**
* Applies targeted {@link ParentProperty} annotations to a {@link
PropertyStoreBuilder}.
*/
- public class Apply extends ConfigApply<ParentProperty> {
+ public static class Apply extends ConfigApply<ParentProperty> {
/**
* Constructor.
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 9d992be..6ebe078 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
@@ -17,6 +17,7 @@ import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
+import org.apache.juneau.*;
import org.apache.juneau.transform.*;
/**
@@ -77,7 +78,7 @@ public @interface Swap {
* Dynamically apply this annotation to the specified
classes/methods/fields.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applySwap()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing class.
* It is ignored when the annotation is applied directly to classes.
*
* <h5 class='section'>Valid patterns:</h5>
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SwapAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SwapAnnotation.java
index 045b801..62e57ee 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SwapAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SwapAnnotation.java
@@ -227,7 +227,7 @@ public class SwapAnnotation {
/**
* Applies targeted {@link Swap} annotations to a {@link
PropertyStoreBuilder}.
*/
- public class Apply extends ConfigApply<Swap> {
+ public static class Apply extends ConfigApply<Swap> {
/**
* Constructor.
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 2222456..6004aee 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
@@ -17,6 +17,8 @@ import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
+import org.apache.juneau.*;
+
/**
* Used to identify a class or bean property as a URI.
*
@@ -47,7 +49,7 @@ public @interface Uri {
* Dynamically apply this annotation to the specified
class/method/fields.
*
* <p>
- * Used in conjunction with the {@link BeanConfig#applyURI()}.
+ * Used in conjunction with {@link
BeanContextBuilder#applyAnnotations(Class...)} to dynamically apply an
annotation to an existing class/method/field.
* It is ignored when the annotation is applied directly to
class/method/fields.
*
* <h5 class='section'>Valid patterns:</h5>
diff --git
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
index 0d9f322..1ee69bc 100644
---
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
+++
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RequestEchoResource.java
@@ -69,16 +69,14 @@ import org.apache.juneau.transforms.*;
@BeanConfig(
maxDepth="5",
detectRecursions="true",
- applyBean={
-
@Bean(on="HttpServletRequest",interfaceClass=HttpServletRequest.class),
- @Bean(on="HttpSession",interfaceClass=HttpSession.class),
- @Bean(on="ServletContext",interfaceClass=ServletContext.class)
- },
swaps={
// Add a special filter for Enumerations
EnumerationSwap.class
}
)
+@Bean(on="HttpServletRequest",interfaceClass=HttpServletRequest.class)
+@Bean(on="HttpSession",interfaceClass=HttpSession.class)
+@Bean(on="ServletContext",interfaceClass=ServletContext.class)
public class RequestEchoResource extends BasicRest {
/**
diff --git
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java
index 22e093d..38c2b92 100644
---
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java
+++
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/AtomFeedResource.java
@@ -70,9 +70,7 @@ import org.apache.juneau.serializer.annotation.*;
rdfxml_tab="5",
addRootProperty="true"
)
-@BeanConfig(
-
applyMarshalled=@Marshalled(onClass=Feed.class,example="$F{AtomFeedResource_example.json}")
-)
+@Marshalled(onClass=Feed.class,example="$F{AtomFeedResource_example.json}")
public class AtomFeedResource extends BasicRestServletJena {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java
index 3c367c9..2cc70d0 100644
---
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java
+++
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/dto/JsonSchemaResource.java
@@ -61,9 +61,7 @@ import org.apache.juneau.rest.widget.*;
"</div>"
}
)
-@BeanConfig(
-
applyMarshalled=@Marshalled(on="Schema",example="$F{JsonSchemaResource_example.json}")
-)
+@Marshalled(on="Schema",example="$F{JsonSchemaResource_example.json}")
public class JsonSchemaResource extends BasicRestServletJena {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java
b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java
index 15e54f7..506e4b7 100644
---
a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java
+++
b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java
@@ -686,7 +686,7 @@ public class Body_Test {
}
@Rest(serializers=SimpleJsonSerializer.class, parsers=JsonParser.class,
defaultAccept="application/json")
- @BeanConfig(applyBean={@Bean(on="A,B,C",sort=true)})
+ @Bean(on="A,B,C",sort=true)
@UrlEncodingConfig(applyUrlEncoding={@UrlEncoding(on="C",expandedParams=true)})
public static class E2 {
@RestMethod(name=PUT, path="/B")
@@ -853,7 +853,7 @@ public class Body_Test {
}
@Rest(serializers=UrlEncodingSerializer.class,parsers=UrlEncodingParser.class)
- @BeanConfig(applyBean={@Bean(on="A,B,C",sort=true)})
+ @Bean(on="A,B,C",sort=true)
@UrlEncodingConfig(applyUrlEncoding={@UrlEncoding(on="C",expandedParams=true)})
public static class H2 {
@RestMethod(name=POST,path="/",
@@ -907,7 +907,7 @@ public class Body_Test {
return content;
}
@RestMethod(name=POST)
- @BeanConfig(applyBean={@Bean(on="A,B,C",sort=true)})
+ @Bean(on="A,B,C",sort=true)
@UrlEncodingConfig(applyUrlEncoding={@UrlEncoding(on="C",expandedParams=true)})
public XBeans.XE b(@Body(r=true) XBeans.XE content) throws
Exception {
return content;