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 f01dd46908 Marshall module improvements
f01dd46908 is described below

commit f01dd469080edd791805a961f2245b8f6b151e85
Author: James Bognar <[email protected]>
AuthorDate: Mon Dec 8 13:07:10 2025 -0500

    Marshall module improvements
---
 .../src/main/java/org/apache/juneau/BeanContext.java | 20 --------------------
 .../src/main/java/org/apache/juneau/ClassMeta.java   | 12 +++++++-----
 2 files changed, 7 insertions(+), 25 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
index bbadfed184..0d9029695d 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
@@ -4059,26 +4059,6 @@ public class BeanContext extends Context {
                return l == null ? null : l.toArray(new ObjectSwap[l.size()]);
        }
 
-       /**
-        * Returns the {@link ObjectSwap} associated with the specified class, 
or <jk>null</jk> if there is no POJO swap
-        * associated with the class.
-        *
-        * @param <T> The class associated with the swap.
-        * @param c The class associated with the swap.
-        * @return The swap associated with the class, or null if there is no 
association.
-        */
-       final <T> ObjectSwap[] findObjectSwaps(Class<T> c) {
-               // Note:  On first
-               if (nn(c)) {
-                       List<ObjectSwap> l = list();
-                       for (var f : swapArray)
-                               if (f.getNormalClass().isParentOf(c))
-                                       l.add(f);
-                       return l.isEmpty() ? null : l.toArray(new 
ObjectSwap[l.size()]);
-               }
-               return null;
-       }
-
        /*
         * Resolves the 'genericized' class meta at the specified position in 
the ClassMeta array.
         */
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 924054424a..e7afddcc21 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
@@ -177,7 +177,6 @@ public class ClassMeta<T> extends ClassInfoTyped<T> {
         *      Don't call init() in constructor.
         *      Used for delayed initialization when the possibility of class 
reference loops exist.
         */
-       @SuppressWarnings("unchecked")
        ClassMeta(Class<T> innerClass, BeanContext beanContext) {
                super(innerClass);
                this.beanContext = beanContext;
@@ -1379,10 +1378,13 @@ public class ClassMeta<T> extends ClassInfoTyped<T> {
                        return l();
 
                var list = new ArrayList<ObjectSwap<T,?>>();
-               var programmaticSwaps = beanContext.findObjectSwaps(inner());
-               if (programmaticSwaps != null)
-                       for (var s : programmaticSwaps)
-                               list.add(s);
+               var swapArray = beanContext.getSwaps();
+               if (swapArray != null && swapArray.length > 0) {
+                       var innerClass = inner();
+                       for (var f : swapArray)
+                               if (f.getNormalClass().isParentOf(innerClass))
+                                       list.add((ObjectSwap<T,?>)f);
+               }
 
                var ap = beanContext.getAnnotationProvider();
                ap.find(Swap.class, 
this).stream().map(AnnotationInfo::inner).forEach(x -> list.add(createSwap(x)));

Reply via email to