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 9d952995a6 Utility class modernization
9d952995a6 is described below

commit 9d952995a6989edd8674c38b0268bbbc798936c4
Author: James Bognar <[email protected]>
AuthorDate: Thu Nov 6 20:54:21 2025 -0500

    Utility class modernization
---
 ...ationProvider2.java => AnnotationProvider.java} | 30 +++++++++++-----------
 .../apache/juneau/common/reflect/ClassInfo.java    | 18 ++++++-------
 .../juneau/common/reflect/ConstructorInfo.java     |  4 +--
 .../apache/juneau/common/reflect/FieldInfo.java    |  4 +--
 .../apache/juneau/common/reflect/MethodInfo.java   |  8 +++---
 .../juneau/common/reflect/ParameterInfo.java       |  2 +-
 .../src/main/java/org/apache/juneau/Context.java   |  6 ++---
 .../apache/juneau/html/HtmlBeanPropertyMeta.java   |  2 +-
 .../org/apache/juneau/xml/XmlBeanPropertyMeta.java |  2 +-
 9 files changed, 38 insertions(+), 38 deletions(-)

diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationProvider2.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationProvider.java
similarity index 97%
rename from 
juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationProvider2.java
rename to 
juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationProvider.java
index c4844f4556..9fa4054943 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationProvider2.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationProvider.java
@@ -119,7 +119,7 @@ import org.apache.juneau.common.collections.*;
  *             .build();
  *
  *     <jc>// Add to provider</jc>
- *     AnnotationProvider2 <jv>provider</jv> = AnnotationProvider2
+ *     AnnotationProvider <jv>provider</jv> = AnnotationProvider
  *             .<jsm>create</jsm>()
  *             .addRuntimeAnnotations(<jv>runtimeAnnotation</jv>)
  *             .build();
@@ -152,10 +152,10 @@ import org.apache.juneau.common.collections.*;
  * <h5 class='section'>Usage:</h5>
  * <p class='bjava'>
  *     <jc>// Create with default settings</jc>
- *     AnnotationProvider2 <jv>provider</jv> = 
AnnotationProvider2.<jsm>create</jsm>().build();
+ *     AnnotationProvider <jv>provider</jv> = 
AnnotationProvider.<jsm>create</jsm>().build();
  *
  *     <jc>// Create with runtime annotations</jc>
- *     AnnotationProvider2 <jv>provider</jv> = AnnotationProvider2
+ *     AnnotationProvider <jv>provider</jv> = AnnotationProvider
  *             .<jsm>create</jsm>()
  *             .annotations(<jk>new</jk> MyAnnotationImpl())
  *             .build();
@@ -175,7 +175,7 @@ import org.apache.juneau.common.collections.*;
  *     <li class='jc'>{@link MethodInfo}
  * </ul>
  */
-public class AnnotationProvider2 {
+public class AnnotationProvider {
 
        /**
         * Disable annotation caching.
@@ -185,18 +185,18 @@ public class AnnotationProvider2 {
        /**
         * Default instance.
         */
-       public static final AnnotationProvider2 INSTANCE = new 
AnnotationProvider2(create());
+       public static final AnnotationProvider INSTANCE = new 
AnnotationProvider(create());
 
        
//-----------------------------------------------------------------------------------------------------------------
        // Builder
        
//-----------------------------------------------------------------------------------------------------------------
 
        /**
-        * Builder for creating configured {@link AnnotationProvider2} 
instances.
+        * Builder for creating configured {@link AnnotationProvider} instances.
         *
         * <h5 class='section'>Example:</h5>
         * <p class='bjava'>
-        *      AnnotationProvider2 <jv>provider</jv> = AnnotationProvider2
+        *      AnnotationProvider <jv>provider</jv> = AnnotationProvider
         *              .<jsm>create</jsm>()
         *              .disableCaching()
         *              .build();
@@ -204,7 +204,7 @@ public class AnnotationProvider2 {
         *
         * <h5 class='section'>See Also:</h5>
         * <ul>
-        *      <li class='jm'>{@link AnnotationProvider2#create()}
+        *      <li class='jm'>{@link AnnotationProvider#create()}
         * </ul>
         */
        public static class Builder {
@@ -216,12 +216,12 @@ public class AnnotationProvider2 {
                }
 
                /**
-                * Builds a new {@link AnnotationProvider2} instance with the 
configured settings.
+                * Builds a new {@link AnnotationProvider} instance with the 
configured settings.
                 *
-                * @return A new immutable {@link AnnotationProvider2} instance.
+                * @return A new immutable {@link AnnotationProvider} instance.
                 */
-               public AnnotationProvider2 build() {
-                       return new AnnotationProvider2(this);
+               public AnnotationProvider build() {
+                       return new AnnotationProvider(this);
                }
 
                /**
@@ -309,7 +309,7 @@ public class AnnotationProvider2 {
         *              .build();
         *
  *     <jc>// Add all runtime annotations to the provider</jc>
- *     AnnotationProvider2 <jv>provider</jv> = AnnotationProvider2
+ *     AnnotationProvider <jv>provider</jv> = AnnotationProvider
  *             .<jsm>create</jsm>()
  *             .addRuntimeAnnotations(<jv>beanAnnotation</jv>, 
<jv>multiAnnotation</jv>, <jv>stringAnnotation</jv>, <jv>swapAnnotation</jv>)
  *             .build();
@@ -376,7 +376,7 @@ public class AnnotationProvider2 {
                 *              .value(MySwap.<jk>class</jk>)
                 *              .build();
                 *
-                *      AnnotationProvider2 <jv>provider</jv> = 
AnnotationProvider2
+                *      AnnotationProvider <jv>provider</jv> = 
AnnotationProvider
                 *              .<jsm>create</jsm>()
                 *              .addRuntimeAnnotations(<jv>beanAnnotation</jv>, 
<jv>swapAnnotation</jv>)  <jc>// Varargs</jc>
                 *              .build();
@@ -415,7 +415,7 @@ public class AnnotationProvider2 {
         *
         * @param builder The builder containing configuration settings.
         */
-       protected AnnotationProvider2(Builder builder) {
+       protected AnnotationProvider(Builder builder) {
                this.classAnnotations = 
Cache.<Class<?>,List<AnnotationInfo<Annotation>>>create()
                        .supplier(this::findClassAnnotations)
                        .disableCaching(builder.disableCaching)
diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
index 1ff779fc7b..761f9e5f08 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
@@ -268,7 +268,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         * Finds all annotations on this class and parent classes/interfaces in 
child-to-parent order.
         *
         * <p>
-        * This is similar to {@link 
org.apache.juneau.common.reflect.AnnotationProvider2#find(Class)} but without 
runtime annotations.
+        * This is similar to {@link 
org.apache.juneau.common.reflect.AnnotationProvider#find(Class)} but without 
runtime annotations.
         *
         * <p>
         * Order of traversal:
@@ -418,7 +418,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         * @param action An action to perform on the entry.
         * @return This object.
         */
-       public <A extends Annotation> ClassInfo 
forEachAnnotation(AnnotationProvider2 annotationProvider, Class<A> type, 
Predicate<A> filter, Consumer<A> action) {
+       public <A extends Annotation> ClassInfo 
forEachAnnotation(AnnotationProvider annotationProvider, Class<A> type, 
Predicate<A> filter, Consumer<A> action) {
                if (annotationProvider == null)
                        throw unsupportedOp();
                A t2 = getPackageAnnotation(type);
@@ -478,7 +478,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         * @param type The annotation to look for.
         * @return The annotation if found, or <jk>null</jk> if not.
         */
-       public <A extends Annotation> A getAnnotation(AnnotationProvider2 
annotationProvider, Class<A> type) {
+       public <A extends Annotation> A getAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
                return findAnnotation(annotationProvider, type);
        }
 
@@ -493,7 +493,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         * @param type The annotation type to look for.
         * @return The matching annotations.
         */
-       public <A extends Annotation> List<A> 
getAnnotations(AnnotationProvider2 annotationProvider, Class<A> type) {
+       public <A extends Annotation> List<A> getAnnotations(AnnotationProvider 
annotationProvider, Class<A> type) {
                List<A> l = list();
                forEachAnnotation(annotationProvider, type, x -> true, x -> 
l.add(x));
                return l;
@@ -817,7 +817,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         *
         * <p>
         * This does NOT include runtime annotations. For runtime annotation 
support, use
-        * {@link org.apache.juneau.common.reflect.AnnotationProvider2}.
+        * {@link org.apache.juneau.common.reflect.AnnotationProvider}.
         *
         * @return An unmodifiable list of all annotation infos.
         */
@@ -837,7 +837,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         *
         * <p>
         * This does NOT include runtime annotations. For runtime annotation 
support, use
-        * {@link org.apache.juneau.common.reflect.AnnotationProvider2}.
+        * {@link org.apache.juneau.common.reflect.AnnotationProvider}.
         *
         * @param <A> The annotation type.
         * @param type The annotation type to filter by.
@@ -1661,7 +1661,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         * @param type The annotation to look for.
         * @return The <jk>true</jk> if annotation if found.
         */
-       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider2 
annotationProvider, Class<A> type) {
+       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
                if (annotationProvider == null)
                        throw unsupportedOp();
                // Inline Context.firstAnnotation() call
@@ -2173,7 +2173,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
         * @param filter A predicate to apply to the entries to determine if 
annotation should be returned.  Can be <jk>null</jk>.
         * @return This object.
         */
-       public <A extends Annotation> A lastAnnotation(AnnotationProvider2 
annotationProvider, Class<A> type, Predicate<A> filter) {
+       public <A extends Annotation> A lastAnnotation(AnnotationProvider 
annotationProvider, Class<A> type, Predicate<A> filter) {
                if (annotationProvider == null)
                        throw unsupportedOp();
                A x = null;
@@ -2335,7 +2335,7 @@ public class ClassInfo extends ElementInfo implements 
Annotatable {
                return c == null ? null : of(c.componentType());
        }
 
-       private <A extends Annotation> A findAnnotation(AnnotationProvider2 ap, 
Class<A> a) {
+       private <A extends Annotation> A findAnnotation(AnnotationProvider ap, 
Class<A> a) {
                if (a == null)
                        return null;
                if (ap == null)
diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
index 233ebb79fa..864f7c32e1 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
@@ -134,7 +134,7 @@ public class ConstructorInfo extends ExecutableInfo 
implements Comparable<Constr
         * @param type The annotation to look for.
         * @return <jk>true</jk> if the specified annotation is present on this 
constructor.
         */
-       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider2 
annotationProvider, Class<A> type) {
+       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
                return nn(annotationProvider.find(type, c).map(x -> 
x.inner()).filter(x -> true).findFirst().orElse(null));
        }
 
@@ -146,7 +146,7 @@ public class ConstructorInfo extends ExecutableInfo 
implements Comparable<Constr
         * @param type The annotation to look for.
         * @return <jk>true</jk> if the specified annotation is not present on 
this constructor.
         */
-       public <A extends Annotation> boolean 
hasNoAnnotation(AnnotationProvider2 annotationProvider, Class<A> type) {
+       public <A extends Annotation> boolean 
hasNoAnnotation(AnnotationProvider annotationProvider, Class<A> type) {
                return ! hasAnnotation(annotationProvider, type);
        }
 
diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
index 4978c094bc..abc78a4c23 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
@@ -222,7 +222,7 @@ public class FieldInfo extends AccessibleInfo implements 
Comparable<FieldInfo>,
         * @param type The annotation to look for.
         * @return <jk>true</jk> if the specified annotation is present.
         */
-       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider2 
annotationProvider, Class<A> type) {
+       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
                return nn(annotationProvider.find(type, f).map(x -> 
x.inner()).filter(x -> true).findFirst().orElse(null));
        }
 
@@ -255,7 +255,7 @@ public class FieldInfo extends AccessibleInfo implements 
Comparable<FieldInfo>,
         * @param type The annotation to look for.
         * @return <jk>true</jk> if the specified annotation is not present.
         */
-       public <A extends Annotation> boolean 
hasNoAnnotation(AnnotationProvider2 annotationProvider, Class<A> type) {
+       public <A extends Annotation> boolean 
hasNoAnnotation(AnnotationProvider annotationProvider, Class<A> type) {
                return ! hasAnnotation(annotationProvider, type);
        }
 
diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
index 5f2c6f4098..345b075327 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
@@ -427,7 +427,7 @@ public class MethodInfo extends ExecutableInfo implements 
Comparable<MethodInfo>
         * @param action An action to perform on the entry.
         * @return This object.
         */
-       public <A extends Annotation> void 
forEachAnnotation(AnnotationProvider2 annotationProvider, Class<A> type, 
Predicate<A> filter, Consumer<A> action) {
+       public <A extends Annotation> void forEachAnnotation(AnnotationProvider 
annotationProvider, Class<A> type, Predicate<A> filter, Consumer<A> action) {
                declaringClass.forEachAnnotation(annotationProvider, type, 
filter, action);
                rstream(matchingCache.get())
                        .flatMap(m -> m.getDeclaredAnnotationInfos().stream())
@@ -474,7 +474,7 @@ public class MethodInfo extends ExecutableInfo implements 
Comparable<MethodInfo>
         * @param type The annotation to look for.
         * @return The first annotation found, or <jk>null</jk> if it doesn't 
exist.
         */
-       public <A extends Annotation> A getAnnotation(AnnotationProvider2 
annotationProvider, Class<A> type) {
+       public <A extends Annotation> A getAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
                // Inline Context.firstAnnotation() call
                return matchingCache.get().stream()
                        .map(m2 -> annotationProvider.find(type, 
m2.inner()).map(x -> x.inner()).filter(x -> true).findFirst().orElse(null))
@@ -588,7 +588,7 @@ public class MethodInfo extends ExecutableInfo implements 
Comparable<MethodInfo>
         * @param type The annotation to look for.
         * @return <jk>true</jk> if the specified annotation is present on this 
method.
         */
-       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider2 
annotationProvider, Class<A> type) {
+       public <A extends Annotation> boolean hasAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
                // Inline Context.firstAnnotation() call
                for (var m2 : matchingCache.get())
                        if (nn(annotationProvider.find(type, m2.inner()).map(x 
-> x.inner()).filter(x -> true).findFirst().orElse(null)))
@@ -652,7 +652,7 @@ public class MethodInfo extends ExecutableInfo implements 
Comparable<MethodInfo>
         * @param type The annotation to look for.
         * @return <jk>true</jk> if the specified annotation is not present on 
this method.
         */
-       public <A extends Annotation> boolean 
hasNoAnnotation(AnnotationProvider2 annotationProvider, Class<A> type) {
+       public <A extends Annotation> boolean 
hasNoAnnotation(AnnotationProvider annotationProvider, Class<A> type) {
                return ! hasAnnotation(annotationProvider, type);
        }
 
diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
index f5ee55ba56..88f96734fd 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
@@ -806,7 +806,7 @@ public class ParameterInfo extends ElementInfo implements 
Annotatable {
                return list;
        }
 
-       private <A extends Annotation> ParameterInfo 
forEachAnnotation(AnnotationProvider2 ap, Class<A> a, Predicate<A> filter, 
Consumer<A> action) {
+       private <A extends Annotation> ParameterInfo 
forEachAnnotation(AnnotationProvider ap, Class<A> a, Predicate<A> filter, 
Consumer<A> action) {
                if (executable.isConstructor) {
                        var ci = 
executable.getParameter(index).getParameterType().unwrap(Value.class, 
Optional.class);
                        var annotationInfos = getAnnotationInfos();
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 0061fde656..416a5bbe85 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
@@ -758,7 +758,7 @@ public abstract class Context {
        final List<Annotation> annotations;
        final boolean debug;
 
-       private final AnnotationProvider2 annotationProvider;
+       private final AnnotationProvider annotationProvider;
 
        /**
         * Constructor for this class.
@@ -769,7 +769,7 @@ public abstract class Context {
                init(builder);
                debug = builder.debug;
                annotations = 
opt(builder.annotations).orElseGet(Collections::emptyList);
-               annotationProvider = 
AnnotationProvider2.create().addRuntimeAnnotations(annotations).build();
+               annotationProvider = 
AnnotationProvider.create().addRuntimeAnnotations(annotations).build();
        }
 
        /**
@@ -783,7 +783,7 @@ public abstract class Context {
                annotationProvider = copyFrom.annotationProvider;
        }
 
-       public AnnotationProvider2 getAnnotationProvider() {
+       public AnnotationProvider getAnnotationProvider() {
                return annotationProvider;
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlBeanPropertyMeta.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlBeanPropertyMeta.java
index 19037772de..389f4a993d 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlBeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlBeanPropertyMeta.java
@@ -76,7 +76,7 @@ public class HtmlBeanPropertyMeta extends 
ExtendedBeanPropertyMeta {
         * @param bpm The metadata of the bean property of this additional 
metadata.
         * @param mp HTML metadata provider (for finding information about 
other artifacts).
         */
-       public HtmlBeanPropertyMeta(BeanPropertyMeta bpm, AnnotationProvider2 
annotationProvider, HtmlMetaProvider mp) {
+       public HtmlBeanPropertyMeta(BeanPropertyMeta bpm, AnnotationProvider 
annotationProvider, HtmlMetaProvider mp) {
                super(bpm);
 
                Builder b = new Builder();
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
index 87758337b2..19ff4b52eb 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
@@ -98,7 +98,7 @@ public class XmlBeanPropertyMeta extends 
ExtendedBeanPropertyMeta {
         */
        public XmlFormat getXmlFormat() { return xmlFormat; }
 
-       private void findXmlInfo(Xml xml, AnnotationProvider2 mp) {
+       private void findXmlInfo(Xml xml, AnnotationProvider mp) {
                if (xml == null)
                        return;
                var bpm = getBeanPropertyMeta();

Reply via email to