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 ff39e12 ClassInfo refactoring.
ff39e12 is described below
commit ff39e1293a441f33ca0483153faff332def3611e
Author: JamesBognar <[email protected]>
AuthorDate: Sun Jan 30 12:02:11 2022 -0500
ClassInfo refactoring.
---
.../juneau/jena/annotation/RdfAnnotation.java | 4 +-
.../jena/annotation/RdfConfigAnnotation.java | 4 +-
.../src/main/java/org/apache/juneau/Context.java | 14 +++---
.../src/main/java/org/apache/juneau/Value.java | 5 +++
.../apache/juneau/annotation/BeanAnnotation.java | 2 +-
.../juneau/annotation/BeanConfigAnnotation.java | 2 +-
.../juneau/annotation/BeanIgnoreAnnotation.java | 2 +-
.../apache/juneau/annotation/BeancAnnotation.java | 2 +-
.../apache/juneau/annotation/BeanpAnnotation.java | 2 +-
.../juneau/annotation/ExampleAnnotation.java | 2 +-
.../juneau/annotation/MarshalledAnnotation.java | 2 +-
.../juneau/annotation/NamePropertyAnnotation.java | 2 +-
.../annotation/ParentPropertyAnnotation.java | 2 +-
.../apache/juneau/annotation/SwapAnnotation.java | 2 +-
.../apache/juneau/annotation/UriAnnotation.java | 2 +-
.../juneau/csv/annotation/CsvAnnotation.java | 2 +-
.../juneau/html/annotation/HtmlAnnotation.java | 2 +-
.../html/annotation/HtmlConfigAnnotation.java | 2 +-
.../html/annotation/HtmlDocConfigAnnotation.java | 2 +-
.../juneau/html/annotation/HtmlLinkAnnotation.java | 2 +-
.../juneau/http/annotation/BodyAnnotation.java | 2 +-
.../juneau/http/annotation/FormDataAnnotation.java | 2 +-
.../juneau/http/annotation/HeaderAnnotation.java | 2 +-
.../juneau/http/annotation/PathAnnotation.java | 2 +-
.../juneau/http/annotation/QueryAnnotation.java | 2 +-
.../juneau/http/annotation/RequestAnnotation.java | 2 +-
.../juneau/http/annotation/ResponseAnnotation.java | 2 +-
.../juneau/http/annotation/SchemaAnnotation.java | 2 +-
.../http/annotation/StatusCodeAnnotation.java | 2 +-
.../juneau/json/annotation/JsonAnnotation.java | 2 +-
.../json/annotation/JsonConfigAnnotation.java | 4 +-
.../annotation/JsonSchemaConfigAnnotation.java | 2 +-
.../msgpack/annotation/MsgPackAnnotation.java | 2 +-
.../annotation/MsgPackConfigAnnotation.java | 2 +-
.../juneau/oapi/annotation/OpenApiAnnotation.java | 2 +-
.../oapi/annotation/OpenApiConfigAnnotation.java | 4 +-
.../parser/annotation/ParserConfigAnnotation.java | 6 +--
.../plaintext/annotation/PlainTextAnnotation.java | 2 +-
.../org/apache/juneau/reflect/AnnotationInfo.java | 2 +-
.../org/apache/juneau/reflect/AnnotationList.java | 39 ++++++++++++++---
.../java/org/apache/juneau/reflect/ClassInfo.java | 19 +++++++-
.../java/org/apache/juneau/reflect/MethodInfo.java | 50 +++++++++++++---------
.../annotation/SerializerConfigAnnotation.java | 6 +--
.../juneau/soap/annotation/SoapXmlAnnotation.java | 2 +-
.../soap/annotation/SoapXmlConfigAnnotation.java | 2 +-
.../juneau/uon/annotation/UonAnnotation.java | 2 +-
.../juneau/uon/annotation/UonConfigAnnotation.java | 4 +-
.../annotation/UrlEncodingAnnotation.java | 2 +-
.../annotation/UrlEncodingConfigAnnotation.java | 4 +-
.../juneau/xml/annotation/XmlAnnotation.java | 2 +-
.../juneau/xml/annotation/XmlConfigAnnotation.java | 4 +-
.../rest/client/remote/RemoteOperationMeta.java | 21 +++++----
.../juneau/rest/annotation/RestAnnotation.java | 4 +-
.../rest/annotation/RestDeleteAnnotation.java | 2 +-
.../juneau/rest/annotation/RestGetAnnotation.java | 2 +-
.../juneau/rest/annotation/RestOpAnnotation.java | 2 +-
.../juneau/rest/annotation/RestPostAnnotation.java | 2 +-
.../juneau/rest/annotation/RestPutAnnotation.java | 2 +-
.../apache/juneau/reflection/ClassInfoTest.java | 2 +-
.../apache/juneau/reflection/MethodInfoTest.java | 2 +-
60 files changed, 172 insertions(+), 108 deletions(-)
diff --git
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfAnnotation.java
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfAnnotation.java
index 2a11fd7..3fb6c39 100644
---
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfAnnotation.java
+++
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfAnnotation.java
@@ -261,7 +261,7 @@ public class RdfAnnotation {
@Override
public void apply(AnnotationInfo<Rdf> ai, RdfSerializer.Builder
b) {
- Rdf a = ai.getAnnotation();
+ Rdf a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
@@ -286,7 +286,7 @@ public class RdfAnnotation {
@Override
public void apply(AnnotationInfo<Rdf> ai, RdfParser.Builder b) {
- Rdf a = ai.getAnnotation();
+ Rdf a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java
index b6044df..1022289 100644
---
a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java
+++
b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java
@@ -46,7 +46,7 @@ public class RdfConfigAnnotation {
@Override
public void apply(AnnotationInfo<RdfConfig> ai,
RdfSerializer.Builder b) {
- RdfConfig a = ai.getAnnotation();
+ RdfConfig a = ai.inner();
string(a.language()).ifPresent(x -> b.language(x));
string(a.juneauNs()).map(Namespace::of).ifPresent(x ->
b.juneauNs(x));
@@ -100,7 +100,7 @@ public class RdfConfigAnnotation {
@Override
public void apply(AnnotationInfo<RdfConfig> ai,
RdfParser.Builder b) {
- RdfConfig a = ai.getAnnotation();
+ RdfConfig a = ai.inner();
string(a.language()).ifPresent(x -> b.language(x));
string(a.juneauNs()).map(Namespace::of).ifPresent(x ->
b.juneauNs(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
index 5d348e8..53067c5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
@@ -448,11 +448,15 @@ public abstract class Context implements
AnnotationProvider {
@FluentSetter
public Builder applyAnnotations(Class<?>...fromClasses) {
VarResolverSession vrs =
VarResolver.DEFAULT.createSession();
- AnnotationWorkList work = stream(fromClasses)
- .map(ClassInfo::of)
- .map(x ->
x.getAnnotationList(ContextApplyFilter.INSTANCE).getWork(vrs))
- .flatMap(Collection::stream)
- .collect(toCollection(AnnotationWorkList::new));
+ AnnotationWorkList work = new AnnotationWorkList();
+ for (Class<?> c : fromClasses) {
+ ClassInfo ci = ClassInfo.of(c);
+ AnnotationList al = new AnnotationList();
+
ci.getAnnotationInfos(ContextApplyFilter.INSTANCE, x -> al.add(x));
+ for (AnnotationInfo<?> ai : al.sort())
+ for
(AnnotationApplier<Annotation,Object> aa : ai.getApplies(vrs))
+ work.add(ai, aa);
+ }
return apply(work);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java
index 0d9e51c..c519566 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java
@@ -239,4 +239,9 @@ public class Value<T> {
return t;
throw exceptionSupplier.get();
}
+
+ @Override /* Object */
+ public String toString() {
+ return "Value("+t+")";
+ }
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanAnnotation.java
index 824edaa..30c2bf4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanAnnotation.java
@@ -523,7 +523,7 @@ public class BeanAnnotation {
@Override
public void apply(AnnotationInfo<Bean> ai, BeanContext.Builder
b) {
- Bean a = ai.getAnnotation();
+ Bean a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
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 31fc9ca..993bc7e 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
@@ -46,7 +46,7 @@ public class BeanConfigAnnotation {
@Override
public void apply(AnnotationInfo<BeanConfig> ai,
BeanContext.Builder b) {
- BeanConfig a = ai.getAnnotation();
+ BeanConfig a = ai.inner();
string(a.beanClassVisibility()).map(Visibility::valueOf).ifPresent(x ->
b.beanClassVisibility(x));
string(a.beanConstructorVisibility()).map(Visibility::valueOf).ifPresent(x ->
b.beanConstructorVisibility(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnoreAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnoreAnnotation.java
index bdf7f98..38d7f2f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnoreAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanIgnoreAnnotation.java
@@ -184,7 +184,7 @@ public class BeanIgnoreAnnotation {
@Override
public void apply(AnnotationInfo<BeanIgnore> ai,
BeanContext.Builder b) {
- BeanIgnore a = ai.getAnnotation();
+ BeanIgnore a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeancAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeancAnnotation.java
index 32304a3..d1da1b9 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeancAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeancAnnotation.java
@@ -170,7 +170,7 @@ public class BeancAnnotation {
@Override
public void apply(AnnotationInfo<Beanc> ai, BeanContext.Builder
b) {
- Beanc a = ai.getAnnotation();
+ Beanc a = ai.inner();
if (isEmpty(a.on()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanpAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanpAnnotation.java
index b7f3b16..6a1fda2 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanpAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/BeanpAnnotation.java
@@ -326,7 +326,7 @@ public class BeanpAnnotation {
@Override
public void apply(AnnotationInfo<Beanp> ai, BeanContext.Builder
b) {
- Beanp a = ai.getAnnotation();
+ Beanp a = ai.inner();
if (isEmpty(a.on()))
return;
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 b758d6b..8021ec6 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
@@ -199,7 +199,7 @@ public class ExampleAnnotation {
@Override
public void apply(AnnotationInfo<Example> ai,
BeanContext.Builder b) {
- Example a = ai.getAnnotation();
+ Example a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/MarshalledAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/MarshalledAnnotation.java
index 7f609af..16189ae 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/MarshalledAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/MarshalledAnnotation.java
@@ -206,7 +206,7 @@ public class MarshalledAnnotation {
@Override
public void apply(AnnotationInfo<Marshalled> ai,
BeanContext.Builder b) {
- Marshalled a = ai.getAnnotation();
+ Marshalled a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NamePropertyAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NamePropertyAnnotation.java
index 245acd6..10b6abc 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NamePropertyAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/NamePropertyAnnotation.java
@@ -154,7 +154,7 @@ public class NamePropertyAnnotation {
@Override
public void apply(AnnotationInfo<NameProperty> ai,
BeanContext.Builder b) {
- NameProperty a = ai.getAnnotation();
+ NameProperty a = ai.inner();
if (isEmpty(a.on()))
return;
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 8c7f4d9..b3e123a 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
@@ -154,7 +154,7 @@ public class ParentPropertyAnnotation {
@Override
public void apply(AnnotationInfo<ParentProperty> ai,
BeanContext.Builder b) {
- ParentProperty a = ai.getAnnotation();
+ ParentProperty a = ai.inner();
if (isEmpty(a.on()))
return;
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 e166e88..ca4bedb 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
@@ -259,7 +259,7 @@ public class SwapAnnotation {
@Override
public void apply(AnnotationInfo<Swap> ai, BeanContext.Builder
b) {
- Swap a = ai.getAnnotation();
+ Swap a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java
index e03a7d2..d3f0782 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java
@@ -177,7 +177,7 @@ public class UriAnnotation {
@Override
public void apply(AnnotationInfo<Uri> ai, BeanContext.Builder
b) {
- Uri a = ai.getAnnotation();
+ Uri a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvAnnotation.java
index 1b90130..8d741bf 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/csv/annotation/CsvAnnotation.java
@@ -180,7 +180,7 @@ public class CsvAnnotation {
@Override
public void apply(AnnotationInfo<Csv> ai, Context.Builder b) {
- Csv a = ai.getAnnotation();
+ Csv a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlAnnotation.java
index e21baa0..8372cbf 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlAnnotation.java
@@ -299,7 +299,7 @@ public class HtmlAnnotation {
@Override
public void apply(AnnotationInfo<Html> ai, Context.Builder b) {
- Html a = ai.getAnnotation();
+ Html a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigAnnotation.java
index 66de37b..2e868a2 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlConfigAnnotation.java
@@ -43,7 +43,7 @@ public class HtmlConfigAnnotation {
@Override
public void apply(AnnotationInfo<HtmlConfig> ai,
HtmlSerializer.Builder b) {
- HtmlConfig a = ai.getAnnotation();
+ HtmlConfig a = ai.inner();
bool(a.addBeanTypes()).ifPresent(x ->
b.addBeanTypesHtml(x));
bool(a.addKeyValueTableHeaders()).ifPresent(x ->
b.addKeyValueTableHeaders(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlDocConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlDocConfigAnnotation.java
index c88805f..09e572c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlDocConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlDocConfigAnnotation.java
@@ -44,7 +44,7 @@ public class HtmlDocConfigAnnotation {
@SuppressWarnings("unchecked")
@Override
public void apply(AnnotationInfo<HtmlDocConfig> ai,
HtmlDocSerializer.Builder b) {
- HtmlDocConfig a = ai.getAnnotation();
+ HtmlDocConfig a = ai.inner();
strings(a.aside()).ifPresent(x -> b.aside(x));
strings(a.footer()).ifPresent(x -> b.footer(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLinkAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLinkAnnotation.java
index 378fa14..1d6b02c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLinkAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/annotation/HtmlLinkAnnotation.java
@@ -206,7 +206,7 @@ public class HtmlLinkAnnotation {
@Override
public void apply(AnnotationInfo<HtmlLink> ai, Context.Builder
b) {
- HtmlLink a = ai.getAnnotation();
+ HtmlLink a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/BodyAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/BodyAnnotation.java
index 7c2e6a7..c5beea7 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/BodyAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/BodyAnnotation.java
@@ -189,7 +189,7 @@ public class BodyAnnotation {
@Override
public void apply(AnnotationInfo<Body> ai, BeanContext.Builder
b) {
- Body a = ai.getAnnotation();
+ Body a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/FormDataAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/FormDataAnnotation.java
index f979f80..d5f5ed7 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/FormDataAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/FormDataAnnotation.java
@@ -286,7 +286,7 @@ public class FormDataAnnotation {
@Override
public void apply(AnnotationInfo<FormData> ai,
BeanContext.Builder b) {
- FormData a = ai.getAnnotation();
+ FormData a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/HeaderAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/HeaderAnnotation.java
index ca3b62c..b2dcfaa 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/HeaderAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/HeaderAnnotation.java
@@ -287,7 +287,7 @@ public class HeaderAnnotation {
@Override
public void apply(AnnotationInfo<Header> ai,
BeanContext.Builder b) {
- Header a = ai.getAnnotation();
+ Header a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/PathAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/PathAnnotation.java
index d501d15..916029a 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/PathAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/PathAnnotation.java
@@ -286,7 +286,7 @@ public class PathAnnotation {
@Override
public void apply(AnnotationInfo<Path> ai, BeanContext.Builder
b) {
- Path a = ai.getAnnotation();
+ Path a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/QueryAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/QueryAnnotation.java
index 7d6f181..2ebcf0f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/QueryAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/QueryAnnotation.java
@@ -286,7 +286,7 @@ public class QueryAnnotation {
@Override
public void apply(AnnotationInfo<Query> ai, BeanContext.Builder
b) {
- Query a = ai.getAnnotation();
+ Query a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/RequestAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/RequestAnnotation.java
index 0b5f9bb..124a477 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/RequestAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/RequestAnnotation.java
@@ -191,7 +191,7 @@ public class RequestAnnotation {
@Override
public void apply(AnnotationInfo<Request> ai,
BeanContext.Builder b) {
- Request a = ai.getAnnotation();
+ Request a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
index debd0cd..4c52c15 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
@@ -267,7 +267,7 @@ public class ResponseAnnotation {
@Override
public void apply(AnnotationInfo<Response> ai,
BeanContext.Builder b) {
- Response a = ai.getAnnotation();
+ Response a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/SchemaAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/SchemaAnnotation.java
index 03f88de..8f9e0c5 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/SchemaAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/SchemaAnnotation.java
@@ -1217,7 +1217,7 @@ public class SchemaAnnotation {
@Override
public void apply(AnnotationInfo<Schema> ai, Context.Builder b)
{
- Schema a = ai.getAnnotation();
+ Schema a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/StatusCodeAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/StatusCodeAnnotation.java
index 8e0ffae..f967210 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/StatusCodeAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/StatusCodeAnnotation.java
@@ -179,7 +179,7 @@ public class StatusCodeAnnotation {
@Override
public void apply(AnnotationInfo<StatusCode> ai,
BeanContext.Builder b) {
- StatusCode a = ai.getAnnotation();
+ StatusCode a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonAnnotation.java
index 350b7d6..258a9b0 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonAnnotation.java
@@ -201,7 +201,7 @@ public class JsonAnnotation {
@Override
public void apply(AnnotationInfo<Json> ai, Context.Builder b) {
- Json a = ai.getAnnotation();
+ Json a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigAnnotation.java
index 91b5d20..cb20659 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/annotation/JsonConfigAnnotation.java
@@ -43,7 +43,7 @@ public class JsonConfigAnnotation {
@Override
public void apply(AnnotationInfo<JsonConfig> ai,
JsonSerializer.Builder b) {
- JsonConfig a = ai.getAnnotation();
+ JsonConfig a = ai.inner();
bool(a.addBeanTypes()).ifPresent(x ->
b.addBeanTypesJson(x));
bool(a.escapeSolidus()).ifPresent(x ->
b.escapeSolidus(x));
@@ -67,7 +67,7 @@ public class JsonConfigAnnotation {
@Override
public void apply(AnnotationInfo<JsonConfig> ai,
JsonParser.Builder b) {
- JsonConfig a = ai.getAnnotation();
+ JsonConfig a = ai.inner();
bool(a.validateEnd()).ifPresent(x -> b.validateEnd(x));
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigAnnotation.java
index 3ee74fd..71edef8 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/annotation/JsonSchemaConfigAnnotation.java
@@ -43,7 +43,7 @@ public class JsonSchemaConfigAnnotation {
@Override
public void apply(AnnotationInfo<JsonSchemaConfig> ai,
JsonSchemaGenerator.Builder b) {
- JsonSchemaConfig a = ai.getAnnotation();
+ JsonSchemaConfig a = ai.inner();
string(a.addDescriptionsTo()).map(TypeCategory::parseArray).ifPresent(x ->
b.addDescriptionsTo(x));
string(a.addExamplesTo()).map(TypeCategory::parseArray).ifPresent(x ->
b.addExamplesTo(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackAnnotation.java
index 9835eef..9c01901 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackAnnotation.java
@@ -179,7 +179,7 @@ public class MsgPackAnnotation {
@Override
public void apply(AnnotationInfo<MsgPack> ai, Context.Builder
b) {
- MsgPack a = ai.getAnnotation();
+ MsgPack a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigAnnotation.java
index c42998e..c830172 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/annotation/MsgPackConfigAnnotation.java
@@ -43,7 +43,7 @@ public class MsgPackConfigAnnotation {
@Override
public void apply(AnnotationInfo<MsgPackConfig> ai,
MsgPackSerializer.Builder b) {
- MsgPackConfig a = ai.getAnnotation();
+ MsgPackConfig a = ai.inner();
bool(a.addBeanTypes()).ifPresent(x ->
b.addBeanTypesMsgPack(x));
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiAnnotation.java
index a43775f..992ce42 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiAnnotation.java
@@ -179,7 +179,7 @@ public class OpenApiAnnotation {
@Override
public void apply(AnnotationInfo<OpenApi> ai, Context.Builder
b) {
- OpenApi a = ai.getAnnotation();
+ OpenApi a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigAnnotation.java
index 909e05b..f526b85 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/oapi/annotation/OpenApiConfigAnnotation.java
@@ -44,7 +44,7 @@ public class OpenApiConfigAnnotation {
@Override
public void apply(AnnotationInfo<OpenApiConfig> ai,
OpenApiSerializer.Builder b) {
- OpenApiConfig a = ai.getAnnotation();
+ OpenApiConfig a = ai.inner();
string(a.format()).map(HttpPartFormat::valueOf).ifPresent(x -> b.format(x));
string(a.collectionFormat()).map(HttpPartCollectionFormat::valueOf).ifPresent(x
-> b.collectionFormat(x));
@@ -67,7 +67,7 @@ public class OpenApiConfigAnnotation {
@Override
public void apply(AnnotationInfo<OpenApiConfig> ai,
OpenApiParser.Builder b) {
- OpenApiConfig a = ai.getAnnotation();
+ OpenApiConfig a = ai.inner();
string(a.format()).map(HttpPartFormat::valueOf).ifPresent(x -> b.format(x));
string(a.collectionFormat()).map(HttpPartCollectionFormat::valueOf).ifPresent(x
-> b.collectionFormat(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/annotation/ParserConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/annotation/ParserConfigAnnotation.java
index 9c7e484..09da85b 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/annotation/ParserConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/annotation/ParserConfigAnnotation.java
@@ -43,7 +43,7 @@ public class ParserConfigAnnotation {
@Override
public void apply(AnnotationInfo<ParserConfig> ai,
Parser.Builder b) {
- ParserConfig a = ai.getAnnotation();
+ ParserConfig a = ai.inner();
bool(a.autoCloseStreams()).ifPresent(x ->
b.autoCloseStreams(x));
integer(a.debugOutputLines(),
"debugOutputLines").ifPresent(x -> b.debugOutputLines(x));
@@ -70,7 +70,7 @@ public class ParserConfigAnnotation {
@Override
public void apply(AnnotationInfo<ParserConfig> ai,
InputStreamParser.Builder b) {
- ParserConfig a = ai.getAnnotation();
+ ParserConfig a = ai.inner();
string(a.binaryFormat()).map(BinaryFormat::valueOf).ifPresent(x ->
b.binaryFormat(x));
}
@@ -92,7 +92,7 @@ public class ParserConfigAnnotation {
@Override
public void apply(AnnotationInfo<ParserConfig> ai,
ReaderParser.Builder b) {
- ParserConfig a = ai.getAnnotation();
+ ParserConfig a = ai.inner();
charset(a.fileCharset()).ifPresent(x ->
b.fileCharset(x));
charset(a.streamCharset()).ifPresent(x ->
b.streamCharset(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextAnnotation.java
index f7d3326..6308458 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/plaintext/annotation/PlainTextAnnotation.java
@@ -179,7 +179,7 @@ public class PlainTextAnnotation {
@Override
public void apply(AnnotationInfo<PlainText> ai, Context.Builder
b) {
- PlainText a = ai.getAnnotation();
+ PlainText a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java
index 9f62d05..692644d 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationInfo.java
@@ -135,7 +135,7 @@ public class AnnotationInfo<T extends Annotation> {
*
* @return The annotation found.
*/
- public T getAnnotation() {
+ public T inner() {
return a;
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationList.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationList.java
index e3a5558..29fcacd 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationList.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/AnnotationList.java
@@ -44,6 +44,13 @@ public class AnnotationList extends
ArrayList<AnnotationInfo<?>> {
this.filter = filter;
}
+ /**
+ * Constructor.
+ */
+ public AnnotationList() {
+ this.filter = null;
+ }
+
@Override /* List */
public boolean add(AnnotationInfo<?> ai) {
if (filter == null || filter.test(ai)) {
@@ -88,15 +95,33 @@ public class AnnotationList extends
ArrayList<AnnotationInfo<?>> {
}
/**
- * Filters this list using the specified test.
+ * Consumes all annotations in this list that match the specified type
and predicate.
*
- * @param predicate The test to use to filter this list.
- * @return A new list containing only the filtered elements.
+ * @param a The annotation type.
+ * @param predicate The predicate.
+ * @param consumer The consumer.
+ * @return This object.
*/
- public AnnotationList filter(Predicate<AnnotationInfo<?>> predicate) {
- AnnotationList al = new AnnotationList(predicate);
- forEach(x -> al.add(x));
- return al;
+ @SuppressWarnings("unchecked")
+ public <A extends Annotation> AnnotationList forEach(Class<A> a,
Predicate<AnnotationInfo<A>> predicate, Consumer<AnnotationInfo<A>> consumer) {
+ for (AnnotationInfo<?> ai : this)
+ if (ai.isType(a) &&
predicate.test((AnnotationInfo<A>)ai))
+ consumer.accept((AnnotationInfo<A>)ai);
+ return this;
+ }
+
+ /**
+ * Consumes all annotations in this list that match the specified
predicate.
+ *
+ * @param predicate The predicate.
+ * @param consumer The consumer.
+ * @return This object.
+ */
+ public <A extends Annotation> AnnotationList
forEach(Predicate<AnnotationInfo<?>> predicate, Consumer<AnnotationInfo<?>>
consumer) {
+ for (AnnotationInfo<?> ai : this)
+ if (predicate.test(ai))
+ consumer.accept(ai);
+ return this;
}
/**
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
index b8aee9b..600d665 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
@@ -1175,7 +1175,23 @@ public final class ClassInfo {
return null;
}
- private void getAnnotationInfos(Predicate<AnnotationInfo<?>> predicate,
Consumer<AnnotationInfo<?>> consumer) {
+ /**
+ * Consumes the annotations on this class/parents/package that match
the specified predicate.
+ *
+ * <p>
+ * Annotations are consumed in the following order:
+ * <ol>
+ * <li>On the package of this class.
+ * <li>On interfaces ordered parent-to-child.
+ * <li>On parent classes ordered parent-to-child.
+ * <li>On this class.
+ * </ol>
+ *
+ * @param predicate The predicate.
+ * @param consumer The consumer.
+ * @return This object.
+ */
+ public ClassInfo getAnnotationInfos(Predicate<AnnotationInfo<?>>
predicate, Consumer<AnnotationInfo<?>> consumer) {
Package p = c.getPackage();
if (p != null)
for (Annotation a : p.getDeclaredAnnotations())
@@ -1191,6 +1207,7 @@ public final class ClassInfo {
for (Annotation a :
parents[i].c.getDeclaredAnnotations())
for (Annotation a2 : splitRepeated(a))
AnnotationInfo.of(parents[i],
a2).accept(predicate, consumer);
+ return this;
}
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
index d3b8295..73ae4cb 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
@@ -392,7 +392,7 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* @return A new {@link AnnotationList} object on every call.
*/
public AnnotationList getAnnotationList() {
- return getAnnotationList(null);
+ return getAnnotationList(x -> true);
}
/**
@@ -425,7 +425,9 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* @return A new {@link AnnotationList} object on every call.
*/
public AnnotationList getAnnotationList(Predicate<AnnotationInfo<?>>
filter) {
- return appendAnnotationList(new AnnotationList(filter));
+ AnnotationList al = new AnnotationList();
+ getAnnotationInfos(filter, x -> al.add(x));
+ return al;
}
/**
@@ -437,7 +439,9 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* @return A new {@link AnnotationList} object on every call.
*/
public AnnotationList
getAnnotationListMethodOnly(Predicate<AnnotationInfo<?>> filter) {
- return appendAnnotationListMethodOnly(new
AnnotationList(filter));
+ AnnotationList al = new AnnotationList();
+ getAnnotationInfosMethodOnly(filter, x -> al.add(x));
+ return al;
}
/**
@@ -453,50 +457,56 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
return false;
}
- AnnotationList appendAnnotationList(AnnotationList al) {
+ /**
+ * Consumes the annotations that match the specified predicate on this
method.
+ *
+ * @param predicate The predicate.
+ * @param consumer The consumer.
+ * @return This object.
+ */
+ public MethodInfo getAnnotationInfos(Predicate<AnnotationInfo<?>>
predicate, Consumer<AnnotationInfo<?>> consumer) {
ClassInfo c = this.declaringClass;
- appendDeclaredAnnotations(al, c.getPackage());
+ getDeclaredAnnotationInfos(c.getPackage(), predicate, consumer);
ClassInfo[] interfaces = c._getInterfaces();
for (int i = interfaces.length-1; i >= 0; i--) {
- appendDeclaredAnnotations(al, interfaces[i]);
- appendDeclaredMethodAnnotations(al, interfaces[i]);
+ getDeclaredAnnotationInfos(interfaces[i], predicate,
consumer);
+ getDeclaredMethodAnnotationInfos(interfaces[i],
predicate, consumer);
}
ClassInfo[] parents = c._getParents();
for (int i = parents.length-1; i >= 0; i--) {
- appendDeclaredAnnotations(al, parents[i]);
- appendDeclaredMethodAnnotations(al, parents[i]);
+ getDeclaredAnnotationInfos(parents[i], predicate,
consumer);
+ getDeclaredMethodAnnotationInfos(parents[i], predicate,
consumer);
}
- return al;
+ return this;
}
- AnnotationList appendAnnotationListMethodOnly(AnnotationList al) {
+ private void getAnnotationInfosMethodOnly(Predicate<AnnotationInfo<?>>
predicate, Consumer<AnnotationInfo<?>> consumer) {
ClassInfo c = this.declaringClass;
ClassInfo[] interfaces = c._getInterfaces();
for (int i = interfaces.length-1; i >= 0; i--)
- appendDeclaredMethodAnnotations(al, interfaces[i]);
+ getDeclaredMethodAnnotationInfos(interfaces[i],
predicate, consumer);
ClassInfo[] parents = c._getParents();
for (int i = parents.length-1; i >= 0; i--)
- appendDeclaredMethodAnnotations(al, parents[i]);
- return al;
+ getDeclaredMethodAnnotationInfos(parents[i], predicate,
consumer);
}
- void appendDeclaredAnnotations(AnnotationList al, Package p) {
+ private void getDeclaredAnnotationInfos(Package p,
Predicate<AnnotationInfo<?>> predicate, Consumer<AnnotationInfo<?>> consumer) {
if (p != null)
for (Annotation a : p.getDeclaredAnnotations())
- al.add(AnnotationInfo.of(p, a));
+ AnnotationInfo.of(p, a).accept(predicate,
consumer);
}
- void appendDeclaredAnnotations(AnnotationList al, ClassInfo ci) {
+ private void getDeclaredAnnotationInfos(ClassInfo ci,
Predicate<AnnotationInfo<?>> predicate, Consumer<AnnotationInfo<?>> consumer) {
if (ci != null)
for (Annotation a : ci.c.getDeclaredAnnotations())
- al.add(AnnotationInfo.of(ci, a));
+ AnnotationInfo.of(ci, a).accept(predicate,
consumer);
}
- void appendDeclaredMethodAnnotations(AnnotationList al, ClassInfo ci) {
+ private void getDeclaredMethodAnnotationInfos(ClassInfo ci,
Predicate<AnnotationInfo<?>> predicate, Consumer<AnnotationInfo<?>> consumer) {
Method m = findMatchingOnClass(ci);
if (m != null)
for (Annotation a : m.getDeclaredAnnotations())
- al.add(AnnotationInfo.of(MethodInfo.of(m), a));
+ AnnotationInfo.of(MethodInfo.of(m),
a).accept(predicate, consumer);
}
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/annotation/SerializerConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/annotation/SerializerConfigAnnotation.java
index caee982..bcedea0 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/annotation/SerializerConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/annotation/SerializerConfigAnnotation.java
@@ -43,7 +43,7 @@ public class SerializerConfigAnnotation {
@Override
public void apply(AnnotationInfo<SerializerConfig> ai,
Serializer.Builder b) {
- SerializerConfig a = ai.getAnnotation();
+ SerializerConfig a = ai.inner();
bool(a.addBeanTypes()).ifPresent(x ->
b.addBeanTypes(x));
bool(a.addRootType()).ifPresent(x -> b.addRootType(x));
@@ -80,7 +80,7 @@ public class SerializerConfigAnnotation {
@Override
public void apply(AnnotationInfo<SerializerConfig> ai,
OutputStreamSerializer.Builder b) {
- SerializerConfig a = ai.getAnnotation();
+ SerializerConfig a = ai.inner();
string(a.binaryFormat()).map(BinaryFormat::valueOf).ifPresent(x ->
b.binaryFormat(x));
}
@@ -102,7 +102,7 @@ public class SerializerConfigAnnotation {
@Override
public void apply(AnnotationInfo<SerializerConfig> ai,
WriterSerializer.Builder b) {
- SerializerConfig a = ai.getAnnotation();
+ SerializerConfig a = ai.inner();
charset(a.fileCharset()).ifPresent(x ->
b.fileCharset(x));
integer(a.maxIndent(), "maxIndent").ifPresent(x ->
b.maxIndent(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlAnnotation.java
index 4bfeac9..be0feef 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlAnnotation.java
@@ -179,7 +179,7 @@ public class SoapXmlAnnotation {
@Override
public void apply(AnnotationInfo<SoapXml> ai, Context.Builder
b) {
- SoapXml a = ai.getAnnotation();
+ SoapXml a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigAnnotation.java
index d145588..c8cb7c9 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/soap/annotation/SoapXmlConfigAnnotation.java
@@ -43,7 +43,7 @@ public class SoapXmlConfigAnnotation {
@Override
public void apply(AnnotationInfo<SoapXmlConfig> ai,
SoapXmlSerializer.Builder b) {
- SoapXmlConfig a = ai.getAnnotation();
+ SoapXmlConfig a = ai.inner();
string(a.soapAction()).ifPresent(x -> b.soapAction(x));
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonAnnotation.java
index 4242c58..1e1220f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonAnnotation.java
@@ -179,7 +179,7 @@ public class UonAnnotation {
@Override
public void apply(AnnotationInfo<Uon> ai, Context.Builder b) {
- Uon a = ai.getAnnotation();
+ Uon a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigAnnotation.java
index bba0758..69682f5 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/annotation/UonConfigAnnotation.java
@@ -43,7 +43,7 @@ public class UonConfigAnnotation {
@Override
public void apply(AnnotationInfo<UonConfig> ai,
UonSerializer.Builder b) {
- UonConfig a = ai.getAnnotation();
+ UonConfig a = ai.inner();
bool(a.addBeanTypes()).ifPresent(x ->
b.addBeanTypesUon(x));
bool(a.encoding()).ifPresent(x -> b.encoding(x));
@@ -67,7 +67,7 @@ public class UonConfigAnnotation {
@Override
public void apply(AnnotationInfo<UonConfig> ai,
UonParser.Builder b) {
- UonConfig a = ai.getAnnotation();
+ UonConfig a = ai.inner();
bool(a.decoding()).ifPresent(x -> b.decoding(x));
bool(a.validateEnd()).ifPresent(x -> b.validateEnd(x));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingAnnotation.java
index 98faca6..6b2e52c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingAnnotation.java
@@ -203,7 +203,7 @@ public class UrlEncodingAnnotation {
@Override
public void apply(AnnotationInfo<UrlEncoding> ai,
Context.Builder b) {
- UrlEncoding a = ai.getAnnotation();
+ UrlEncoding a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigAnnotation.java
index 0de1575..35ac3d9 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/annotation/UrlEncodingConfigAnnotation.java
@@ -43,7 +43,7 @@ public class UrlEncodingConfigAnnotation {
@Override
public void apply(AnnotationInfo<UrlEncodingConfig> ai,
UrlEncodingSerializer.Builder b) {
- UrlEncodingConfig a = ai.getAnnotation();
+ UrlEncodingConfig a = ai.inner();
bool(a.expandedParams()).ifPresent(x ->
b.expandedParams(x));
}
@@ -65,7 +65,7 @@ public class UrlEncodingConfigAnnotation {
@Override
public void apply(AnnotationInfo<UrlEncodingConfig> ai,
UrlEncodingParser.Builder b) {
- UrlEncodingConfig a = ai.getAnnotation();
+ UrlEncodingConfig a = ai.inner();
bool(a.expandedParams()).ifPresent(x ->
b.expandedParams(x));
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlAnnotation.java
index 4892b4f..600ad7b 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlAnnotation.java
@@ -257,7 +257,7 @@ public class XmlAnnotation {
@Override
public void apply(AnnotationInfo<Xml> ai, Context.Builder b) {
- Xml a = ai.getAnnotation();
+ Xml a = ai.inner();
if (isEmpty(a.on()) && isEmpty(a.onClass()))
return;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigAnnotation.java
index 97d2fdc..c50018f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigAnnotation.java
@@ -43,7 +43,7 @@ public class XmlConfigAnnotation {
@Override
public void apply(AnnotationInfo<XmlConfig> ai,
XmlSerializer.Builder b) {
- XmlConfig a = ai.getAnnotation();
+ XmlConfig a = ai.inner();
bool(a.addBeanTypes()).ifPresent(x ->
b.addBeanTypesXml(x));
bool(a.addNamespaceUrisToRoot()).ifPresent(x ->
b.addNamespaceUrisToRoot(x));
@@ -70,7 +70,7 @@ public class XmlConfigAnnotation {
@Override
public void apply(AnnotationInfo<XmlConfig> ai,
XmlParser.Builder b) {
- XmlConfig a = ai.getAnnotation();
+ XmlConfig a = ai.inner();
type(a.eventAllocator()).ifPresent(x ->
b.eventAllocator(x));
bool(a.preserveRootElement()).ifPresent(x ->
b.preserveRootElement(x));
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
index 62a55dd..ef5a4a4 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
@@ -92,19 +92,22 @@ public class RemoteOperationMeta {
httpMethod = al.getValues(String.class,
"method").stream().filter(x -> isNotEmpty(x)).findFirst().orElse("").trim();
path = al.getValues(String.class,
"path").stream().filter(x -> isNotEmpty(x)).findFirst().orElse("").trim();
- String value1 =
al.filter(x->x.isType(RemoteOp.class)).getValues(String.class,
"value").stream().filter(x -> isNotEmpty(x)).findFirst().orElse("").trim();
- String value2 =
al.filter(x->!x.isType(RemoteOp.class)).getValues(String.class,
"value").stream().filter(x -> isNotEmpty(x)).findFirst().orElse("").trim();
+ Value<String> value = Value.empty();
+ al.forEach(RemoteOp.class, x ->
isNotEmpty(x.inner().value().trim()), x -> value.set(x.inner().value().trim()));
- if (isNotEmpty(value1)) {
- int i = value1.indexOf(' ');
+ if (value.isPresent()) {
+ String v = value.get();
+ int i = v.indexOf(' ');
if (i == -1) {
- httpMethod = value1;
+ httpMethod = v;
} else {
- httpMethod = value1.substring(0,
i).trim();
- path = value1.substring(i).trim();
+ httpMethod = v.substring(0, i).trim();
+ path = v.substring(i).trim();
}
- } else if (isNotEmpty(value2)) {
- path = value2;
+ } else {
+ al.forEach(x -> ! x.isType(RemoteOp.class) &&
isNotEmpty(x.getValue(String.class, "value").orElse("").trim()),x ->
value.set(x.getValue(String.class, "value").get().trim()));
+ if (value.isPresent())
+ path = value.get();
}
if (path.isEmpty()) {
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
index fd16ec2..0bf85fe 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
@@ -1072,7 +1072,7 @@ public class RestAnnotation {
@Override
public void apply(AnnotationInfo<Rest> ai, RestContext.Builder
b) {
- Rest a = ai.getAnnotation();
+ Rest a = ai.inner();
classes(a.serializers()).ifPresent(x ->
b.serializers().add(x));
classes(a.parsers()).ifPresent(x -> b.parsers().add(x));
@@ -1131,7 +1131,7 @@ public class RestAnnotation {
@Override
public void apply(AnnotationInfo<Rest> ai,
RestOpContext.Builder b) {
- Rest a = ai.getAnnotation();
+ Rest a = ai.inner();
stream(a.produces()).map(MediaType::of).forEach(x ->
b.produces(x));
stream(a.consumes()).map(MediaType::of).forEach(x ->
b.consumes(x));
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java
index 97a9aa9..65c5362 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java
@@ -473,7 +473,7 @@ public class RestDeleteAnnotation {
@Override
public void apply(AnnotationInfo<RestDelete> ai,
RestOpContext.Builder b) {
- RestDelete a = ai.getAnnotation();
+ RestDelete a = ai.inner();
b.httpMethod("delete");
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java
index 4c691f2..9ace3ad 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java
@@ -531,7 +531,7 @@ public class RestGetAnnotation {
@Override
public void apply(AnnotationInfo<RestGet> ai,
RestOpContext.Builder b) {
- RestGet a = ai.getAnnotation();
+ RestGet a = ai.inner();
b.httpMethod("get");
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
index f8e74a3..03484d6 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
@@ -636,7 +636,7 @@ public class RestOpAnnotation {
@Override
public void apply(AnnotationInfo<RestOp> ai,
RestOpContext.Builder b) {
- RestOp a = ai.getAnnotation();
+ RestOp a = ai.inner();
classes(a.serializers()).ifPresent(x ->
b.serializers().set(x));
classes(a.parsers()).ifPresent(x -> b.parsers().set(x));
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java
index 698e286..3b33ab7 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java
@@ -618,7 +618,7 @@ public class RestPostAnnotation {
@Override
public void apply(AnnotationInfo<RestPost> ai,
RestOpContext.Builder b) {
- RestPost a = ai.getAnnotation();
+ RestPost a = ai.inner();
b.httpMethod("post");
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java
index 5002b55..e055135 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java
@@ -618,7 +618,7 @@ public class RestPutAnnotation {
@Override
public void apply(AnnotationInfo<RestPut> ai,
RestOpContext.Builder b) {
- RestPut a = ai.getAnnotation();
+ RestPut a = ai.inner();
b.httpMethod("put");
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
b/juneau-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
index 1f2eccf..d30fe0f 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java
@@ -114,7 +114,7 @@ public class ClassInfoTest {
if (t instanceof AConfig)
return "@AConfig(" + ((AConfig)t).value() + ")";
if (t instanceof AnnotationInfo)
- return
apply(((AnnotationInfo<?>)t).getAnnotation());
+ return apply(((AnnotationInfo<?>)t).inner());
if (t instanceof AnnotationList) {
AnnotationList al = (AnnotationList)t;
return al.toString();
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
b/juneau-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
index d06d39a..27af6ab 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
@@ -84,7 +84,7 @@ public class MethodInfoTest {
if (t instanceof List)
return
((List<?>)t).stream().map(this).collect(Collectors.joining(","));
if (t instanceof AnnotationInfo)
- return
apply(((AnnotationInfo)t).getAnnotation());
+ return apply(((AnnotationInfo)t).inner());
if (t instanceof A)
return "@A(" + ((A)t).value() + ")";
if (t instanceof PA)