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 95a50e4065 org.apache.juneau.common.reflect API improvements
95a50e4065 is described below

commit 95a50e4065e30ef2553b4104acaeb50f40ac1a42
Author: James Bognar <[email protected]>
AuthorDate: Mon Nov 24 08:22:34 2025 -0500

    org.apache.juneau.common.reflect API improvements
---
 .../juneau/common/annotation/AnnotationObject.java | 46 +++++++++-------------
 .../common/annotation/AppliedAnnotationObject.java | 32 +++++++++------
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
index 41aa1b85dc..8af987eed6 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
@@ -64,35 +64,25 @@ public class AnnotationObject implements Annotation {
                        this.annotationType = annotationType;
                }
 
-               /**
-                * Sets the {@link AnnotationObject#description()} property on 
the target annotation.
-                *
-                * @param value The new value for this property.
-                * @return This object.
-                * @since 9.2.0
-                */
-               public B description(final String...value) {
-                       description = value;
-                       return asThis();
-               }
-
-               /**
-                * Returns this instance typed as {@code B}.
-                *
-                * @return this instance typed as {@code B}.
-                * @since 9.2.0
-                */
-               @SuppressWarnings("unchecked")
-               protected B asThis() {
-                       return (B)this;
-               }
+       /**
+        * Sets the {@link AnnotationObject#description()} property on the 
target annotation.
+        *
+        * @param value The new value for this property.
+        * @return This object.
+        * @since 9.2.0
+        */
+       @SuppressWarnings("unchecked")
+       public B description(final String...value) {
+               description = value;
+               return (B)this;
+       }
 
-               /**
-                * Returns the annotation type being built.
-                *
-                * @return The annotation type being built.
-                */
-               public Class<? extends Annotation> getAnnotationType() { return 
annotationType; }
+       /**
+        * Returns the annotation type being built.
+        *
+        * @return The annotation type being built.
+        */
+       public Class<? extends Annotation> getAnnotationType() { return 
annotationType; }
 
                /**
                 * Returns the description of this annotation builder.
diff --git 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AppliedAnnotationObject.java
 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AppliedAnnotationObject.java
index eff652395d..43c19cdd83 100644
--- 
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AppliedAnnotationObject.java
+++ 
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AppliedAnnotationObject.java
@@ -56,10 +56,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param values The targets this annotation applies to.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(String...values) {
                        for (var v : values)
                                on = addAll(on, v);
-                       return asThis();
+                       return (B)this;
                }
        }
 
@@ -87,10 +88,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Class<?>...value) {
                        for (var v : value)
                                on = addAll(on, v.getName());
-                       return asThis();
+                       return (B)this;
                }
 
                /**
@@ -103,7 +105,7 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                public B onClass(Class<?>...value) {
                        for (var v : value)
                                onClass = addAll(onClass, v);
-                       return asThis();
+                       return (B)this;
                }
        }
 
@@ -129,10 +131,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Method...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
        }
 
@@ -158,10 +161,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Constructor<?>...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
        }
 
@@ -187,10 +191,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Field...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
 
                /**
@@ -199,10 +204,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Method...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
        }
 
@@ -228,10 +234,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Method...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
        }
 
@@ -257,10 +264,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Field...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
 
                /**
@@ -269,10 +277,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Method...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
        }
 
@@ -325,10 +334,11 @@ public class AppliedAnnotationObject extends 
AnnotationObject {
                 * @param value The values to append.
                 * @return This object.
                 */
+               @SuppressWarnings("unchecked")
                public B on(Constructor<?>...value) {
                        for (var v : value)
                                on(info(v).getFullName());
-                       return asThis();
+                       return (B)this;
                }
        }
 

Reply via email to