You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/08/02 13:45:29 UTC
[juneau] branch master updated: Merge ReflectionUtils into
ClassUtils.
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 85739e5 Merge ReflectionUtils into ClassUtils.
85739e5 is described below
commit 85739e5d2930390154ccf1af0872ab49e5147162
Author: JamesBognar <ja...@apache.org>
AuthorDate: Thu Aug 2 09:45:18 2018 -0400
Merge ReflectionUtils into ClassUtils.
---
.../org/apache/juneau/utils/ClassUtilsTest.java | 57 ++++
.../apache/juneau/utils/ReflectionUtilsTest.java | 75 -----
.../java/org/apache/juneau/jena/RdfClassMeta.java | 6 +-
.../src/main/java/org/apache/juneau/BeanMeta.java | 1 -
.../java/org/apache/juneau/BeanPropertyMeta.java | 3 +-
.../src/main/java/org/apache/juneau/ClassMeta.java | 1 -
.../java/org/apache/juneau/html/HtmlClassMeta.java | 2 +-
.../juneau/httppart/HttpPartSchemaBuilder.java | 2 +-
.../juneau/httppart/bean/RequestBeanMeta.java | 2 +-
.../juneau/httppart/bean/ResponseBeanMeta.java | 1 -
.../org/apache/juneau/internal/ClassUtils.java | 285 +++++++++++++++++++
.../apache/juneau/internal/ReflectionUtils.java | 312 ---------------------
.../java/org/apache/juneau/json/JsonClassMeta.java | 2 +-
.../juneau/jsonschema/JsonSchemaClassMeta.java | 2 +-
.../apache/juneau/remoteable/RemoteMethodArg.java | 1 -
.../juneau/remoteable/RemoteMethodReturn.java | 1 -
.../apache/juneau/remoteable/RemoteableMeta.java | 1 -
.../transform/InterfaceBeanFilterBuilder.java | 2 +-
.../juneau/urlencoding/UrlEncodingClassMeta.java | 2 +-
.../java/org/apache/juneau/xml/XmlClassMeta.java | 4 +-
.../org/apache/juneau/rest/client/RestClient.java | 2 +-
.../apache/juneau/rest/BasicRestInfoProvider.java | 2 +-
.../java/org/apache/juneau/rest/RestContext.java | 1 -
.../org/apache/juneau/rest/RestContextBuilder.java | 1 -
.../org/apache/juneau/rest/RestJavaMethod.java | 2 +-
.../org/apache/juneau/rest/RestParamDefaults.java | 2 +-
26 files changed, 359 insertions(+), 413 deletions(-)
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java
index ce8f17d..39bd0cf 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java
@@ -17,11 +17,13 @@ import static java.lang.annotation.RetentionPolicy.*;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.testutils.TestUtils.*;
import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
+import org.apache.juneau.*;
import org.apache.juneau.internal.*;
import org.junit.*;
@@ -383,6 +385,7 @@ public class ClassUtilsTest {
//====================================================================================================
// getSimpleName()
//====================================================================================================
+
@Test
public void getSimpleName() throws Exception {
assertEquals("ClassUtilsTest.G1", ClassUtils.getSimpleName(G1.class));
@@ -391,4 +394,58 @@ public class ClassUtilsTest {
public class G1 {}
public static class G2 {}
+
+ //====================================================================================================
+ // getAnnotations()
+ //====================================================================================================
+
+ @Target({PARAMETER,TYPE})
+ @Retention(RUNTIME)
+ public static @interface HI1 {
+ public String value();
+ }
+
+ public static interface HA {
+ public void doX(@HI1("0") HA01 x);
+ }
+
+ @HI1("1") public static class HA01 extends HA02 {}
+ @HI1("2") public static class HA02 implements HA03, HA04 {}
+ @HI1("3") public static interface HA03 {}
+ @HI1("4") public static interface HA04 {}
+
+ @Test
+ public void getAnnotationsOnParameter() throws Exception {
+ ObjectList l = new ObjectList();
+ for (HI1 ia : getAnnotations(HI1.class, HA.class.getMethod("doX", HA01.class), 0)) {
+ l.add(ia.value());
+ }
+ assertEquals("['0','1','2','3','4']", l.toString());
+ }
+
+ @Target({PARAMETER,TYPE})
+ @Retention(RUNTIME)
+ @Inherited
+ public static @interface HI2 {
+ public String value();
+ }
+
+ public static interface HB {
+ public void doX(@HI2("0") HB01 x);
+ }
+
+ @HI2("1") public static class HB01 extends HB02 {}
+ @HI2("2") public static class HB02 implements HB03, HB04 {}
+ @HI2("3") public static interface HB03 {}
+ @HI2("4") public static interface HB04 {}
+
+ @Test
+ public void getAnnotationsOnParameterInherited() throws Exception {
+ ObjectList l = new ObjectList();
+ for (HI2 ib : getAnnotations(HI2.class, HB.class.getMethod("doX", HB01.class), 0)) {
+ l.add(ib.value());
+ }
+ assertEquals("['0','1','2','3','4']", l.toString());
+ }
+
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/ReflectionUtilsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/ReflectionUtilsTest.java
deleted file mode 100644
index 0373f03..0000000
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/ReflectionUtilsTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.utils;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-import static org.junit.Assert.*;
-
-import java.lang.annotation.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.internal.*;
-import org.junit.*;
-
-public class ReflectionUtilsTest {
-
- @Target({PARAMETER,TYPE})
- @Retention(RUNTIME)
- public static @interface IA {
- public String value();
- }
-
- public static interface A {
- public void doX(@IA("0") A01 x);
- }
-
- @IA("1") public static class A01 extends A02 {}
- @IA("2") public static class A02 implements A03, A04 {}
- @IA("3") public static interface A03 {}
- @IA("4") public static interface A04 {}
-
- @Test
- public void getAnnotationsOnParameter() throws Exception {
- ObjectList l = new ObjectList();
- for (IA ia : ReflectionUtils.getAnnotations(IA.class, A.class.getMethod("doX", A01.class), 0)) {
- l.add(ia.value());
- }
- assertEquals("['0','1','2','3','4']", l.toString());
- }
-
- @Target({PARAMETER,TYPE})
- @Retention(RUNTIME)
- @Inherited
- public static @interface IB {
- public String value();
- }
-
- public static interface B {
- public void doX(@IB("0") B01 x);
- }
-
- @IB("1") public static class B01 extends B02 {}
- @IB("2") public static class B02 implements B03, B04 {}
- @IB("3") public static interface B03 {}
- @IB("4") public static interface B04 {}
-
- @Test
- public void getAnnotationsOnParameterInherited() throws Exception {
- ObjectList l = new ObjectList();
- for (IB ib : ReflectionUtils.getAnnotations(IB.class, B.class.getMethod("doX", B01.class), 0)) {
- l.add(ib.value());
- }
- assertEquals("['0','1','2','3','4']", l.toString());
- }
-}
diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfClassMeta.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfClassMeta.java
index acdca7e..155ff3e 100644
--- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfClassMeta.java
+++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfClassMeta.java
@@ -37,14 +37,14 @@ public class RdfClassMeta extends ClassMetaExtended {
public RdfClassMeta(ClassMeta<?> cm) {
super(cm);
Class<?> c = getInnerClass();
- this.rdf = ReflectionUtils.getAnnotation(Rdf.class, c);
+ this.rdf = ClassUtils.getAnnotation(Rdf.class, c);
if (rdf != null) {
collectionFormat = rdf.collectionFormat();
} else {
collectionFormat = RdfCollectionFormat.DEFAULT;
}
- List<Rdf> rdfs = ReflectionUtils.getAnnotations(Rdf.class, c);
- List<RdfSchema> schemas = ReflectionUtils.getAnnotations(RdfSchema.class, c);
+ List<Rdf> rdfs = ClassUtils.getAnnotations(Rdf.class, c);
+ List<RdfSchema> schemas = ClassUtils.getAnnotations(RdfSchema.class, c);
this.namespace = RdfUtils.findNamespace(rdfs, schemas);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
index 055a0dd..58bb331 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
@@ -15,7 +15,6 @@ package org.apache.juneau;
import static org.apache.juneau.internal.ClassFlags.*;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.CollectionUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.BeanMeta.MethodType.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
index 12ad597..b0f31be 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -15,7 +15,6 @@ package org.apache.juneau;
import static org.apache.juneau.internal.ArrayUtils.*;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.CollectionUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import java.lang.annotation.*;
@@ -1080,7 +1079,7 @@ public final class BeanPropertyMeta {
if (t == null && extraKeys != null)
t = getMethodAnnotation(a, extraKeys);
if (t == null)
- t = ReflectionUtils.getAnnotation(a, typeMeta.getInnerClass());
+ t = ClassUtils.getAnnotation(a, typeMeta.getInnerClass());
return t;
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index 79ab9a5..3aa73d6 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -15,7 +15,6 @@ package org.apache.juneau;
import static org.apache.juneau.ClassMeta.ClassCategory.*;
import static org.apache.juneau.internal.ClassFlags.*;
import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import java.io.*;
import java.lang.reflect.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlClassMeta.java
index 9b6151a..1b20ec5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlClassMeta.java
@@ -34,7 +34,7 @@ public class HtmlClassMeta extends ClassMetaExtended {
*/
public HtmlClassMeta(ClassMeta<?> cm) {
super(cm);
- this.html = ReflectionUtils.getAnnotation(Html.class, getInnerClass());
+ this.html = ClassUtils.getAnnotation(Html.class, getInnerClass());
if (html != null) {
format = html.format();
noTables = html.noTables();
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java
index f23ec4e..44a3587 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java
@@ -82,7 +82,7 @@ public class HttpPartSchemaBuilder {
HttpPartSchemaBuilder apply(Class<? extends Annotation> c, java.lang.reflect.Type t) {
if (t instanceof Class<?>) {
Class<?> tc = (Class<?>)t;
- for (Annotation a : ReflectionUtils.getAnnotationsParentFirst(c, tc))
+ for (Annotation a : ClassUtils.getAnnotationsParentFirst(c, tc))
apply(a);
} else if (Value.isType(t)) {
apply(c, Value.getParameterType(t));
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java
index 7f23a07..bc6ba5c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.httppart.bean;
-import static org.apache.juneau.internal.ReflectionUtils.*;
+import static org.apache.juneau.internal.ClassUtils.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
index bb5d5df..17ccdea 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
@@ -14,7 +14,6 @@ package org.apache.juneau.httppart.bean;
import static org.apache.juneau.internal.ClassFlags.*;
import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import java.lang.reflect.*;
import java.util.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java
index ce02b5b..5b3f72f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassUtils.java
@@ -13,7 +13,9 @@
package org.apache.juneau.internal;
import static org.apache.juneau.internal.ClassFlags.*;
+import static org.apache.juneau.internal.CollectionUtils.*;
+import java.io.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -2153,4 +2155,287 @@ public final class ClassUtils {
return getSimpleName(c.getDeclaringClass()) + '.' + c.getSimpleName();
return c.getSimpleName();
}
+
+ /**
+ * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
+ *
+ * @param a The annotation to check for.
+ * @param m The method containing the parameter to check.
+ * @param index The parameter index.
+ * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
+ */
+ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m, int index) {
+ return getAnnotation(a, m, index) != null;
+ }
+
+ /**
+ * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value.
+ *
+ * @param a The annotation to check for.
+ * @param m The method to check.
+ * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value.
+ */
+ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m) {
+ return getAnnotation(a, m) != null;
+ }
+
+ /**
+ * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Class)} returns a value.
+ *
+ * @param a The annotation to check for.
+ * @param c The class to check.
+ * @return <jk>true</jk> if the {@link #getAnnotation(Class, Class)} returns a value.
+ */
+ public static boolean hasAnnotation(Class<? extends Annotation> a, Class<?> c) {
+ return getAnnotation(a, c) != null;
+ }
+
+ /**
+ * Returns the specified annotation if it exists on the specified parameter or parameter type class.
+ *
+ * @param a The annotation to check for.
+ * @param m The method containing the parameter to check.
+ * @param index The parameter index.
+ * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends Annotation> T getAnnotation(Class<T> a, Method m, int index) {
+ for (Annotation a2 : m.getParameterAnnotations()[index])
+ if (a.isInstance(a2))
+ return (T)a2;
+ Type t = m.getGenericParameterTypes()[index];
+ if (Value.isType(t))
+ return getAnnotation(a, Value.getParameterType(t));
+ if (t instanceof Class)
+ return getAnnotation(a, (Class<?>)t);
+ return null;
+ }
+
+ /**
+ * Returns all annotations defined on the specified parameter and parameter type.
+ *
+ * <p>
+ * Annotations are ordered parameter first, then class, then superclasses.
+ *
+ * @param a The annotation to look for.
+ * @param m The method containing the parameter.
+ * @param index The parameter index.
+ * @return All instances of the annotation with the
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends Annotation> List<T> getAnnotations(Class<T> a, Method m, int index) {
+ List<T> l = new ArrayList<>();
+ for (Annotation a2 : m.getParameterAnnotations()[index])
+ if (a.isInstance(a2))
+ l.add((T)a2);
+ Type t = m.getGenericParameterTypes()[index];
+ if (t instanceof Class)
+ appendAnnotations(a, (Class<?>)t, l);
+ else if (Value.isType(t))
+ appendAnnotations(a, Value.getParameterType(t), l);
+ return l;
+ }
+
+ /**
+ * Returns all annotations defined on the specified parameter and parameter type.
+ *
+ * <p>
+ * Annotations are ordered parameter superclasses first, then class, then parameter.
+ *
+ * @param a The annotation to look for.
+ * @param m The method containing the parameter.
+ * @param index The parameter index.
+ * @return All instances of the annotation with the
+ */
+ public static <T extends Annotation> List<T> getAnnotationsParentFirst(Class<T> a, Method m, int index) {
+ List<T> l = getAnnotations(a, m, index);
+ Collections.reverse(l);
+ return l;
+ }
+
+ /**
+ * Returns the specified annotation if it exists on the specified method or return type class.
+ *
+ * @param a The annotation to check for.
+ * @param m The method to check.
+ * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends Annotation> T getAnnotation(Class<T> a, Method m) {
+ for (Annotation a2 : m.getAnnotations())
+ if (a.isInstance(a2))
+ return (T)a2;
+ Type t = m.getGenericReturnType();
+ if (t instanceof Class)
+ return getAnnotation(a, (Class<?>)t);
+ return null;
+ }
+
+ /**
+ * Similar to {@link Class#getAnnotation(Class)} except also searches annotations on interfaces.
+ *
+ * @param <T> The annotation class type.
+ * @param a The annotation class.
+ * @param c The annotated class.
+ * @return The annotation, or <jk>null</jk> if not found.
+ */
+ public static <T extends Annotation> T getAnnotation(Class<T> a, Class<?> c) {
+ if (c == null)
+ return null;
+
+ T t = getDeclaredAnnotation(a, c);
+ if (t != null)
+ return t;
+
+
+
+ t = getAnnotation(a, c.getSuperclass());
+ if (t != null)
+ return t;
+
+ for (Class<?> c2 : c.getInterfaces()) {
+ t = getAnnotation(a, c2);
+ if (t != null)
+ return t;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the specified annotation only if it's been declared on the specified class.
+ *
+ * <p>
+ * More efficient than calling {@link Class#getAnnotation(Class)} since it doesn't recursively look for the class
+ * up the parent chain.
+ *
+ * @param <T> The annotation class type.
+ * @param a The annotation class.
+ * @param c The annotated class.
+ * @return The annotation, or <jk>null</jk> if not found.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends Annotation> T getDeclaredAnnotation(Class<T> a, Class<?> c) {
+ for (Annotation a2 : c.getDeclaredAnnotations())
+ if (a2.annotationType() == a)
+ return (T)a2;
+ return null;
+ }
+
+ /**
+ * Returns all instances of the specified annotation on the specified class.
+ *
+ * <p>
+ * Searches all superclasses and superinterfaces.
+ * Results are ordered child-to-parent.
+ *
+ * @param <T> The annotation class type.
+ * @param a The annotation class type.
+ * @param c The class being searched.
+ * @return The found matches, or an empty array if annotation was not found.
+ */
+ public static <T extends Annotation> List<T> getAnnotations(Class<T> a, Class<?> c) {
+ List<T> l = new LinkedList<>();
+ appendAnnotations(a, c, l);
+ return l;
+ }
+
+ /**
+ * Same as {@link #getAnnotations(Class, Class)} but returns the list in parent-to-child order.
+ *
+ * @param a The annotation class type.
+ * @param c The class being searched.
+ * @return The found matches, or an empty array if annotation was not found.
+ */
+ public static <T extends Annotation> List<T> getAnnotationsParentFirst(Class<T> a, Class<?> c) {
+ List<T> l = getAnnotations(a, c);
+ Collections.reverse(l);
+ return l;
+ }
+
+ /**
+ * Same as {@link #getAnnotations(Class, Class)} except returns the annotations as a map with the keys being the
+ * class on which the annotation was found.
+ *
+ * <p>
+ * Results are ordered child-to-parent.
+ *
+ * @param <T> The annotation class type.
+ * @param a The annotation class type.
+ * @param c The class being searched.
+ * @return The found matches, or an empty map if annotation was not found.
+ */
+ public static <T extends Annotation> LinkedHashMap<Class<?>,T> getAnnotationsMap(Class<T> a, Class<?> c) {
+ LinkedHashMap<Class<?>,T> m = new LinkedHashMap<>();
+ findAnnotationsMap(a, c, m);
+ return m;
+ }
+
+ /**
+ * Same as {@link #getAnnotationsMap(Class, Class)} except returns results in parent-to-child order.
+ *
+ * @param <T> The annotation class type.
+ * @param a The annotation class type.
+ * @param c The class being searched.
+ * @return The found matches, or an empty map if annotation was not found.
+ */
+ public static <T extends Annotation> LinkedHashMap<Class<?>,T> getAnnotationsMapParentFirst(Class<T> a, Class<?> c) {
+ return CollectionUtils.reverse(getAnnotationsMap(a, c));
+ }
+
+ private static <T extends Annotation> void findAnnotationsMap(Class<T> a, Class<?> c, Map<Class<?>,T> m) {
+ if (c == null)
+ return;
+
+ T t = getDeclaredAnnotation(a, c);
+ if (t != null)
+ m.put(c, t);
+
+ findAnnotationsMap(a, c.getSuperclass(), m);
+
+ for (Class<?> c2 : c.getInterfaces())
+ findAnnotationsMap(a, c2, m);
+ }
+
+ /**
+ * Finds and appends the specified annotation on the specified class and superclasses/interfaces to the specified
+ * list.
+ *
+ * @param a The annotation.
+ * @param c The class.
+ * @param l The list of annotations.
+ */
+ public static <T extends Annotation> void appendAnnotations(Class<T> a, Class<?> c, List<T> l) {
+ if (c == null)
+ return;
+
+ addIfNotNull(l, getDeclaredAnnotation(a, c));
+
+ if (c.getPackage() != null)
+ addIfNotNull(l, c.getPackage().getAnnotation(a));
+
+ appendAnnotations(a, c.getSuperclass(), l);
+
+ for (Class<?> c2 : c.getInterfaces())
+ appendAnnotations(a, c2, l);
+ }
+
+ /**
+ * Similar to {@link Class#getResourceAsStream(String)} except looks up the parent hierarchy for the existence of
+ * the specified resource.
+ *
+ * @param c The class to return the resource on.
+ * @param name The resource name.
+ * @return An input stream on the specified resource, or <jk>null</jk> if the resource could not be found.
+ */
+ public static InputStream getResource(Class<?> c, String name) {
+ if (name == null)
+ return null;
+ while (c != null) {
+ InputStream is = c.getResourceAsStream(name);
+ if (is != null)
+ return is;
+ c = c.getSuperclass();
+ }
+ return null;
+ }
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ReflectionUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ReflectionUtils.java
deleted file mode 100644
index 336ddf2..0000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ReflectionUtils.java
+++ /dev/null
@@ -1,312 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.internal;
-
-import static org.apache.juneau.internal.CollectionUtils.*;
-
-import java.io.*;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import org.apache.juneau.*;
-
-/**
- * Reflection utilities.
- */
-public final class ReflectionUtils {
-
- /**
- * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
- *
- * @param a The annotation to check for.
- * @param m The method containing the parameter to check.
- * @param index The parameter index.
- * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
- */
- public static boolean hasAnnotation(Class<? extends Annotation> a, Method m, int index) {
- return getAnnotation(a, m, index) != null;
- }
-
- /**
- * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value.
- *
- * @param a The annotation to check for.
- * @param m The method to check.
- * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value.
- */
- public static boolean hasAnnotation(Class<? extends Annotation> a, Method m) {
- return getAnnotation(a, m) != null;
- }
-
- /**
- * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Class)} returns a value.
- *
- * @param a The annotation to check for.
- * @param c The class to check.
- * @return <jk>true</jk> if the {@link #getAnnotation(Class, Class)} returns a value.
- */
- public static boolean hasAnnotation(Class<? extends Annotation> a, Class<?> c) {
- return getAnnotation(a, c) != null;
- }
-
- /**
- * Returns the specified annotation if it exists on the specified parameter or parameter type class.
- *
- * @param a The annotation to check for.
- * @param m The method containing the parameter to check.
- * @param index The parameter index.
- * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
- */
- @SuppressWarnings("unchecked")
- public static <T extends Annotation> T getAnnotation(Class<T> a, Method m, int index) {
- for (Annotation a2 : m.getParameterAnnotations()[index])
- if (a.isInstance(a2))
- return (T)a2;
- Type t = m.getGenericParameterTypes()[index];
- if (Value.isType(t))
- return getAnnotation(a, Value.getParameterType(t));
- if (t instanceof Class)
- return getAnnotation(a, (Class<?>)t);
- return null;
- }
-
- /**
- * Returns all annotations defined on the specified parameter and parameter type.
- *
- * <p>
- * Annotations are ordered parameter first, then class, then superclasses.
- *
- * @param a The annotation to look for.
- * @param m The method containing the parameter.
- * @param index The parameter index.
- * @return All instances of the annotation with the
- */
- @SuppressWarnings("unchecked")
- public static <T extends Annotation> List<T> getAnnotations(Class<T> a, Method m, int index) {
- List<T> l = new ArrayList<>();
- for (Annotation a2 : m.getParameterAnnotations()[index])
- if (a.isInstance(a2))
- l.add((T)a2);
- Type t = m.getGenericParameterTypes()[index];
- if (t instanceof Class)
- appendAnnotations(a, (Class<?>)t, l);
- else if (Value.isType(t))
- appendAnnotations(a, Value.getParameterType(t), l);
- return l;
- }
-
- /**
- * Returns all annotations defined on the specified parameter and parameter type.
- *
- * <p>
- * Annotations are ordered parameter superclasses first, then class, then parameter.
- *
- * @param a The annotation to look for.
- * @param m The method containing the parameter.
- * @param index The parameter index.
- * @return All instances of the annotation with the
- */
- public static <T extends Annotation> List<T> getAnnotationsParentFirst(Class<T> a, Method m, int index) {
- List<T> l = getAnnotations(a, m, index);
- Collections.reverse(l);
- return l;
- }
-
- /**
- * Returns the specified annotation if it exists on the specified method or return type class.
- *
- * @param a The annotation to check for.
- * @param m The method to check.
- * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value.
- */
- @SuppressWarnings("unchecked")
- public static <T extends Annotation> T getAnnotation(Class<T> a, Method m) {
- for (Annotation a2 : m.getAnnotations())
- if (a.isInstance(a2))
- return (T)a2;
- Type t = m.getGenericReturnType();
- if (t instanceof Class)
- return getAnnotation(a, (Class<?>)t);
- return null;
- }
-
- /**
- * Similar to {@link Class#getAnnotation(Class)} except also searches annotations on interfaces.
- *
- * @param <T> The annotation class type.
- * @param a The annotation class.
- * @param c The annotated class.
- * @return The annotation, or <jk>null</jk> if not found.
- */
- public static <T extends Annotation> T getAnnotation(Class<T> a, Class<?> c) {
- if (c == null)
- return null;
-
- T t = getDeclaredAnnotation(a, c);
- if (t != null)
- return t;
-
-
-
- t = getAnnotation(a, c.getSuperclass());
- if (t != null)
- return t;
-
- for (Class<?> c2 : c.getInterfaces()) {
- t = getAnnotation(a, c2);
- if (t != null)
- return t;
- }
- return null;
- }
-
- /**
- * Returns the specified annotation only if it's been declared on the specified class.
- *
- * <p>
- * More efficient than calling {@link Class#getAnnotation(Class)} since it doesn't recursively look for the class
- * up the parent chain.
- *
- * @param <T> The annotation class type.
- * @param a The annotation class.
- * @param c The annotated class.
- * @return The annotation, or <jk>null</jk> if not found.
- */
- @SuppressWarnings("unchecked")
- public static <T extends Annotation> T getDeclaredAnnotation(Class<T> a, Class<?> c) {
- for (Annotation a2 : c.getDeclaredAnnotations())
- if (a2.annotationType() == a)
- return (T)a2;
- return null;
- }
-
- /**
- * Returns all instances of the specified annotation on the specified class.
- *
- * <p>
- * Searches all superclasses and superinterfaces.
- * Results are ordered child-to-parent.
- *
- * @param <T> The annotation class type.
- * @param a The annotation class type.
- * @param c The class being searched.
- * @return The found matches, or an empty array if annotation was not found.
- */
- public static <T extends Annotation> List<T> getAnnotations(Class<T> a, Class<?> c) {
- List<T> l = new LinkedList<>();
- appendAnnotations(a, c, l);
- return l;
- }
-
- /**
- * Same as {@link #getAnnotations(Class, Class)} but returns the list in parent-to-child order.
- *
- * @param a The annotation class type.
- * @param c The class being searched.
- * @return The found matches, or an empty array if annotation was not found.
- */
- public static <T extends Annotation> List<T> getAnnotationsParentFirst(Class<T> a, Class<?> c) {
- List<T> l = getAnnotations(a, c);
- Collections.reverse(l);
- return l;
- }
-
- /**
- * Same as {@link #getAnnotations(Class, Class)} except returns the annotations as a map with the keys being the
- * class on which the annotation was found.
- *
- * <p>
- * Results are ordered child-to-parent.
- *
- * @param <T> The annotation class type.
- * @param a The annotation class type.
- * @param c The class being searched.
- * @return The found matches, or an empty map if annotation was not found.
- */
- public static <T extends Annotation> LinkedHashMap<Class<?>,T> getAnnotationsMap(Class<T> a, Class<?> c) {
- LinkedHashMap<Class<?>,T> m = new LinkedHashMap<>();
- findAnnotationsMap(a, c, m);
- return m;
- }
-
- /**
- * Same as {@link #getAnnotationsMap(Class, Class)} except returns results in parent-to-child order.
- *
- * @param <T> The annotation class type.
- * @param a The annotation class type.
- * @param c The class being searched.
- * @return The found matches, or an empty map if annotation was not found.
- */
- public static <T extends Annotation> LinkedHashMap<Class<?>,T> getAnnotationsMapParentFirst(Class<T> a, Class<?> c) {
- return CollectionUtils.reverse(getAnnotationsMap(a, c));
- }
-
- private static <T extends Annotation> void findAnnotationsMap(Class<T> a, Class<?> c, Map<Class<?>,T> m) {
- if (c == null)
- return;
-
- T t = getDeclaredAnnotation(a, c);
- if (t != null)
- m.put(c, t);
-
- findAnnotationsMap(a, c.getSuperclass(), m);
-
- for (Class<?> c2 : c.getInterfaces())
- findAnnotationsMap(a, c2, m);
- }
-
- /**
- * Finds and appends the specified annotation on the specified class and superclasses/interfaces to the specified
- * list.
- *
- * @param a The annotation.
- * @param c The class.
- * @param l The list of annotations.
- */
- public static <T extends Annotation> void appendAnnotations(Class<T> a, Class<?> c, List<T> l) {
- if (c == null)
- return;
-
- addIfNotNull(l, getDeclaredAnnotation(a, c));
-
- if (c.getPackage() != null)
- addIfNotNull(l, c.getPackage().getAnnotation(a));
-
- appendAnnotations(a, c.getSuperclass(), l);
-
- for (Class<?> c2 : c.getInterfaces())
- appendAnnotations(a, c2, l);
- }
-
- /**
- * Similar to {@link Class#getResourceAsStream(String)} except looks up the parent hierarchy for the existence of
- * the specified resource.
- *
- * @param c The class to return the resource on.
- * @param name The resource name.
- * @return An input stream on the specified resource, or <jk>null</jk> if the resource could not be found.
- */
- public static InputStream getResource(Class<?> c, String name) {
- if (name == null)
- return null;
- while (c != null) {
- InputStream is = c.getResourceAsStream(name);
- if (is != null)
- return is;
- c = c.getSuperclass();
- }
- return null;
- }
-}
-
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonClassMeta.java
index e8b31d1..4865064 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonClassMeta.java
@@ -34,7 +34,7 @@ public class JsonClassMeta extends ClassMetaExtended {
*/
public JsonClassMeta(ClassMeta<?> cm) {
super(cm);
- this.json = ReflectionUtils.getAnnotation(Json.class, getInnerClass());
+ this.json = ClassUtils.getAnnotation(Json.class, getInnerClass());
if (json != null) {
wrapperAttr = nullIfEmpty(json.wrapperAttr());
} else {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaClassMeta.java
index bdbd938..05f89a8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/jsonschema/JsonSchemaClassMeta.java
@@ -37,7 +37,7 @@ public class JsonSchemaClassMeta extends ClassMetaExtended {
*/
public JsonSchemaClassMeta(ClassMeta<?> cm) {
super(cm);
- this.jsonSchema = ReflectionUtils.getAnnotation(JsonSchema.class, getInnerClass());
+ this.jsonSchema = ClassUtils.getAnnotation(JsonSchema.class, getInnerClass());
if (jsonSchema != null) {
type = nullIfEmpty(jsonSchema.type());
format = nullIfEmpty(jsonSchema.format());
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java
index eb7501c..bdb3222 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodArg.java
@@ -13,7 +13,6 @@
package org.apache.juneau.remoteable;
import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import static org.apache.juneau.httppart.HttpPartType.*;
import java.lang.reflect.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodReturn.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodReturn.java
index 8604190..eb68c1f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodReturn.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteMethodReturn.java
@@ -13,7 +13,6 @@
package org.apache.juneau.remoteable;
import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import static org.apache.juneau.remoteable.ReturnValue.*;
import java.lang.reflect.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java
index 92e106e..89969fa 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/remoteable/RemoteableMeta.java
@@ -14,7 +14,6 @@ package org.apache.juneau.remoteable;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.CollectionUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import java.lang.reflect.*;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
index b379fc5..0c5ca38 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
@@ -54,7 +54,7 @@ public class InterfaceBeanFilterBuilder<T> extends BeanFilterBuilder<T> {
private void init(Class<?> interfaceClass) {
interfaceClass(interfaceClass);
- Map<Class<?>,Bean> annotations = ReflectionUtils.getAnnotationsMap(Bean.class, interfaceClass);
+ Map<Class<?>,Bean> annotations = ClassUtils.getAnnotationsMap(Bean.class, interfaceClass);
ListIterator<Bean> li = new ArrayList<>(annotations.values()).listIterator(annotations.size());
while (li.hasPrevious()) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingClassMeta.java
index b585e67..a60501a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingClassMeta.java
@@ -31,7 +31,7 @@ public class UrlEncodingClassMeta extends ClassMetaExtended {
*/
public UrlEncodingClassMeta(ClassMeta<?> cm) {
super(cm);
- this.urlEncoding = ReflectionUtils.getAnnotation(UrlEncoding.class, getInnerClass());
+ this.urlEncoding = ClassUtils.getAnnotation(UrlEncoding.class, getInnerClass());
if (urlEncoding != null) {
expandedParams = urlEncoding.expandedParams();
} else {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlClassMeta.java
index fa34186..63e197e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlClassMeta.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.xml;
-import static org.apache.juneau.internal.ReflectionUtils.*;
+import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import java.util.*;
@@ -41,7 +41,7 @@ public class XmlClassMeta extends ClassMetaExtended {
super(cm);
Class<?> c = getInnerClass();
this.namespace = findNamespace(c);
- this.xml = ReflectionUtils.getAnnotation(Xml.class, c);
+ this.xml = ClassUtils.getAnnotation(Xml.class, c);
if (xml != null) {
this.format = xml.format();
this.childName = nullIfEmpty(xml.childName());
diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
index b841f65..35a494c 100644
--- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
+++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.rest.client;
-import static org.apache.juneau.internal.ReflectionUtils.*;
+import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.httppart.HttpPartType.*;
import static org.apache.juneau.remoteable.ReturnValue.*;
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
index 075112e..4b2fb82 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.rest;
-import static org.apache.juneau.internal.ReflectionUtils.*;
+import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.rest.RestParamType.*;
import static org.apache.juneau.rest.util.AnnotationUtils.*;
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index d2587ec..23b01ad 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -16,7 +16,6 @@ import static javax.servlet.http.HttpServletResponse.*;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.IOUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import java.io.*;
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
index 13416bb..8d17ed4 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
@@ -15,7 +15,6 @@ package org.apache.juneau.rest;
import static org.apache.juneau.BeanContext.*;
import static org.apache.juneau.internal.ArrayUtils.*;
import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.internal.ReflectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
import static org.apache.juneau.parser.Parser.*;
import static org.apache.juneau.rest.RestContext.*;
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestJavaMethod.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestJavaMethod.java
index 4367c02..fc968ec 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestJavaMethod.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestJavaMethod.java
@@ -410,7 +410,7 @@ public class RestJavaMethod implements Comparable<RestJavaMethod> {
methodParams = context.findParams(method, pathPattern, false);
- if (ReflectionUtils.hasAnnotation(ResponseBody.class, method)) {
+ if (hasAnnotation(ResponseBody.class, method)) {
HttpPartSchema s = HttpPartSchema.create(ResponseBody.class, method);
returnBodyMeta = new ResponsePartMeta(HttpPartType.BODY, s, createPartSerializer(s.getSerializer(), serializers.getPropertyStore(), partSerializer));
}
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
index 85bdd6a..0cb7a14 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.rest;
-import static org.apache.juneau.internal.ReflectionUtils.*;
+import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.ObjectUtils.*;
import static org.apache.juneau.rest.RestParamType.*;