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 67e730d558 org.apache.juneau.common.reflect API improvements
67e730d558 is described below
commit 67e730d558418b4bc7888eb825bdc89b15301d8b
Author: James Bognar <[email protected]>
AuthorDate: Mon Nov 24 12:20:38 2025 -0500
org.apache.juneau.common.reflect API improvements
---
.../common/annotation/AppliedAnnotationObject.java | 123 +++++++++++++++++++++
1 file changed, 123 insertions(+)
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 ef44879c6b..24e144a3a3 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
@@ -22,6 +22,8 @@ import static
org.apache.juneau.common.utils.CollectionUtils.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
+import org.apache.juneau.common.reflect.*;
+
/**
* An implementation of an annotation that has an <code>on</code> value
targeting classes/methods/fields/constructors.
*
@@ -89,6 +91,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
return this;
}
+ /**
+ * Appends the classes that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderT on(ClassInfo...value) {
+ for (var v : value)
+ on = addAll(on, v.inner().getName());
+ return this;
+ }
+
/**
* Appends the classes that this annotation applies to.
*
@@ -101,6 +115,19 @@ public class AppliedAnnotationObject extends
AnnotationObject {
onClass = addAll(onClass, v);
return this;
}
+
+ /**
+ * Appends the classes that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ @SuppressWarnings("unchecked")
+ public BuilderT onClass(ClassInfo...value) {
+ for (var v : value)
+ onClass = addAll(onClass, v.inner());
+ return this;
+ }
}
/**
@@ -128,6 +155,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
on(info(v).getFullName());
return this;
}
+
+ /**
+ * Appends the methods that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderM on(MethodInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
}
/**
@@ -155,6 +194,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
on(info(v).getFullName());
return this;
}
+
+ /**
+ * Appends the constructors that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderC on(ConstructorInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
}
/**
@@ -183,6 +234,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
return this;
}
+ /**
+ * Appends the fields that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderMF on(FieldInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
+
/**
* Appends the methods that this annotation applies to.
*
@@ -194,6 +257,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
on(info(v).getFullName());
return this;
}
+
+ /**
+ * Appends the methods that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderMF on(MethodInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
}
/**
@@ -222,6 +297,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
return this;
}
+ /**
+ * Appends the methods that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderTM on(MethodInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
+
@Override /* Overridden from AppliedAnnotationObject.Builder */
public BuilderTM on(String...value) {
super.on(value);
@@ -261,6 +348,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
return this;
}
+ /**
+ * Appends the fields that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderTMF on(FieldInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
+
/**
* Appends the methods that this annotation applies to.
*
@@ -272,6 +371,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
on(info(v).getFullName());
return this;
}
+
+ /**
+ * Appends the methods that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderTMF on(MethodInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
}
/**
@@ -299,6 +410,18 @@ public class AppliedAnnotationObject extends
AnnotationObject {
on(info(v).getFullName());
return this;
}
+
+ /**
+ * Appends the constructors that this annotation applies to.
+ *
+ * @param value The values to append.
+ * @return This object.
+ */
+ public BuilderTMFC on(ConstructorInfo...value) {
+ for (var v : value)
+ on(v.getFullName());
+ return this;
+ }
}
//-----------------------------------------------------------------------------------------------------------------