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 11cd464dbb New BeanCreator API
11cd464dbb is described below

commit 11cd464dbb0cf9336b2b0cd6a1aea9ebee842a7d
Author: James Bognar <[email protected]>
AuthorDate: Wed Jan 21 10:12:24 2026 -0500

    New BeanCreator API
---
 .../juneau/commons/reflect/ExecutableInfo.java     | 40 +++++++++++++++++++++-
 .../commons/reflect/ConstructorInfo_Test.java      |  6 ++--
 .../commons/reflect/ExecutableInfo_Test.java       |  8 ++---
 .../juneau/commons/reflect/MethodInfo_Test.java    |  4 ++-
 .../juneau/commons/reflect/ParameterInfo_Test.java |  2 ++
 5 files changed, 51 insertions(+), 9 deletions(-)

diff --git 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ExecutableInfo.java
 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ExecutableInfo.java
index 7f159df6b4..636defd46b 100644
--- 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ExecutableInfo.java
+++ 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ExecutableInfo.java
@@ -92,6 +92,7 @@ public abstract class ExecutableInfo extends AccessibleInfo {
        private final Supplier<List<AnnotationInfo<Annotation>>> 
declaredAnnotations;  // All annotations declared directly on this executable.
        private final Supplier<String> shortName;  // Short name 
(method/constructor name with parameters).
        private final Supplier<String> fullName;  // Fully qualified name 
(declaring-class.method-name with parameters).
+       private final Supplier<String> toString;  // String representation with 
modifiers, return type, name, and throws declarations.
 
        /**
         * Constructor.
@@ -115,6 +116,7 @@ public abstract class ExecutableInfo extends AccessibleInfo 
{
                this.declaredAnnotations = mem(() -> 
stream(inner.getDeclaredAnnotations()).flatMap(a -> 
AnnotationUtils.streamRepeated(a)).map(a -> ai((Annotatable)this, a)).toList());
                this.shortName = mem(() -> f("{0}({1})", getNameSimple(), 
getParameters().stream().map(p -> 
p.getParameterType().getNameSimple()).collect(joining(","))));
                this.fullName = mem(this::findFullName);
+               this.toString = mem(this::findToString);
        }
 
        /**
@@ -787,9 +789,45 @@ public abstract class ExecutableInfo extends 
AccessibleInfo {
 
        @Override
        public String toString() {
-               return getNameShort();
+               return toString.get();
        }
 
+       private String findToString() {
+               var sb = new StringBuilder(256);
+
+               // Modifiers
+               var mods = Modifier.toString(getModifiers());
+               if (nn(mods) && ! mods.isEmpty()) {
+                       sb.append(mods).append(" ");
+               }
+
+               // Add synthetic and bridge flags (not actual modifiers but 
useful to show)
+               if (isSynthetic())
+                       sb.append("synthetic ");
+               if (this instanceof MethodInfo mi && mi.isBridge())
+                       sb.append("bridge ");
+
+               // Return type (skip for constructors)
+               if (this instanceof MethodInfo mi)
+                       mi.getReturnType().appendNameFormatted(sb, FULL, true, 
'$', BRACKETS).append(" ");
+
+               // Full name
+               sb.append(getNameFull());
+
+               // Throws declarations
+               var exTypes = getExceptionTypes();
+               if (! exTypes.isEmpty()) {
+                       sb.append(" throws ");
+                       sb.append(exTypes.stream()
+                               .map(e -> e.getNameFormatted(FULL, true, '$', 
BRACKETS))
+                               .collect(joining(", ")));
+               }
+
+               return sb.toString();
+       }
+
+
+
        private void checkIndex(int index) {
                int pc = getParameterCount();
                if (pc == 0)
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ConstructorInfo_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ConstructorInfo_Test.java
index 69f93adbf0..3987563d6e 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ConstructorInfo_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ConstructorInfo_Test.java
@@ -719,9 +719,9 @@ class ConstructorInfo_Test extends TestBase {
        
//====================================================================================================
        @Test
        void a053_toString() {
-               check("A()", a.toString());
-               check("B()", b_c1.toString());
-               check("B(String)", b_c2.toString());
+               check("public 
org.apache.juneau.commons.reflect.ConstructorInfo_Test$A()", a.toString());
+               check("public 
org.apache.juneau.commons.reflect.ConstructorInfo_Test$B()", b_c1.toString());
+               check("public 
org.apache.juneau.commons.reflect.ConstructorInfo_Test$B(java.lang.String)", 
b_c2.toString());
        }
 
        
//====================================================================================================
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ExecutableInfo_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ExecutableInfo_Test.java
index 2a48480509..45f59dce06 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ExecutableInfo_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ExecutableInfo_Test.java
@@ -869,10 +869,10 @@ class ExecutableInfo_Test extends TestBase {
        
//====================================================================================================
        @Test
        void a045_toString() {
-               check("B()", b_c1.toString());
-               check("B(String)", b_c2.toString());
-               check("m()", b_m1.toString());
-               check("m(String)", b_m2.toString());
+               check("public 
org.apache.juneau.commons.reflect.ExecutableInfo_Test$B()", b_c1.toString());
+               check("public 
org.apache.juneau.commons.reflect.ExecutableInfo_Test$B(java.lang.String)", 
b_c2.toString());
+               check("public void 
org.apache.juneau.commons.reflect.ExecutableInfo_Test$B.m()", b_m1.toString());
+               check("public int 
org.apache.juneau.commons.reflect.ExecutableInfo_Test$B.m(java.lang.String)", 
b_m2.toString());
        }
 }
 
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/MethodInfo_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/MethodInfo_Test.java
index 4fd449cfa7..0b78d9047d 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/MethodInfo_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/MethodInfo_Test.java
@@ -72,6 +72,8 @@ class MethodInfo_Test extends TestBase {
                                return t2.getDeclaringClass().getSimpleName() + 
'.' + MethodInfo.of((Method)t).getNameShort();
                        if (t instanceof List<?> t2)
                                return 
(t2.stream().map(this).collect(Collectors.joining(",")));
+                       if (t instanceof java.util.Set<?> t2)
+                               return "[" + 
t2.stream().map(this).collect(Collectors.joining(", ")) + "]";
                        if (t instanceof AnnotationInfo t2)
                                return apply(t2.inner());
                        if (t instanceof A t2)
@@ -271,7 +273,7 @@ class MethodInfo_Test extends TestBase {
        @Test
        void a002_compareTo() {
                var s = new TreeSet<>(l(g_a1a, g_a1b, g_a1c, g_a1d, g_a2, 
g_a3));
-               check("[a1(), a1(int), a1(String), a1(int,int), a2(), a3()]", 
s);
+               check("[G.a1(), G.a1(int), G.a1(String), G.a1(int,int), G.a2(), 
G.a3()]", s);
        }
 
        
//====================================================================================================
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ParameterInfo_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ParameterInfo_Test.java
index 5ab6a63a28..6f42a82965 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ParameterInfo_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/commons/reflect/ParameterInfo_Test.java
@@ -114,6 +114,8 @@ class ParameterInfo_Test extends TestBase {
                                return StreamSupport.stream(toList(t, 
Object.class).spliterator(), false).map(this).collect(Collectors.joining(","));
                        if (t instanceof MethodInfo)
                                return 
((MethodInfo)t).getDeclaringClass().getNameSimple() + '.' + 
((MethodInfo)t).getNameShort();
+                       if (t instanceof ConstructorInfo)
+                               return ((ConstructorInfo)t).getNameShort();
                        if (t instanceof CA)
                                return "@CA(" + ((CA)t).value() + ")";
                        if (t instanceof DA)

Reply via email to