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

commit 31a29ecea9065367b49f166831c1a5ff163c14a5
Author: James Bognar <[email protected]>
AuthorDate: Wed Dec 10 11:20:08 2025 -0500

    Marshall module improvements
---
 .../main/java/org/apache/juneau/BeanFilter.java    | 34 +++++++++++++++++-----
 .../src/main/java/org/apache/juneau/BeanMeta.java  |  6 ++--
 .../main/java/org/apache/juneau/BeanRegistry.java  |  1 +
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java
index c5abe9ed18..7f208822cb 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java
@@ -16,6 +16,7 @@
  */
 package org.apache.juneau;
 
+import static org.apache.juneau.commons.reflect.ReflectionUtils.*;
 import static org.apache.juneau.commons.utils.ClassUtils.*;
 import static org.apache.juneau.commons.utils.CollectionUtils.*;
 import static org.apache.juneau.commons.utils.StringUtils.*;
@@ -53,7 +54,7 @@ public class BeanFilter {
                private Class<?> implClass, interfaceClass, stopClass;
                private boolean sortProperties, fluentSetters;
                private BeanCreator<PropertyNamer> propertyNamer = 
BeanCreator.of(PropertyNamer.class);
-               private List<Class<?>> dictionary;
+               private List<ClassInfo> dictionary;
                private BeanCreator<BeanInterceptor> interceptor = 
BeanCreator.of(BeanInterceptor.class);
 
                /**
@@ -152,10 +153,29 @@ public class BeanFilter {
                 */
                public Builder dictionary(Class<?>...values) {
                        if (dictionary == null)
-                               dictionary = list(values);
-                       else
-                               for (var cc : values)
-                                       dictionary.add(cc);
+                               dictionary = list();
+                       for (var cc : values)
+                               dictionary.add(info(cc));
+                       return this;
+               }
+
+               /**
+                * Bean dictionary.
+                *
+                * <p>
+                * Adds to the list of classes that make up the bean dictionary 
for this bean.
+                *
+                * <p>
+                * Same as the other dictionary method but accepts {@link 
ClassInfo} objects directly instead of {@link Class} objects.
+                *
+                * @param values The class info objects to add to this property.
+                * @return This object.
+                */
+               public Builder dictionary(ClassInfo...values) {
+                       if (dictionary == null)
+                               dictionary = list();
+                       for (var ci : values)
+                               dictionary.add(ci);
                        return this;
                }
 
@@ -701,7 +721,7 @@ public class BeanFilter {
        }
 
        private final ClassInfoTyped<?> beanClass;
-       private final List<Class<?>> beanDictionary;
+       private final List<ClassInfo> beanDictionary;
        private final String example;
        private final Set<String> excludeProperties;
        private final boolean fluentSetters;
@@ -749,7 +769,7 @@ public class BeanFilter {
         *
         * @return An unmodifiable list of the bean dictionary defined on this 
bean, or an empty list if no bean dictionary is defined.
         */
-       public List<Class<?>> getBeanDictionary() { return beanDictionary; }
+       public List<ClassInfo> getBeanDictionary() { return beanDictionary; }
 
        /**
         * Returns the example associated with this class.
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
index f297af346c..fdbde1f55a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
@@ -1189,13 +1189,13 @@ public class BeanMeta<T> {
         */
        private BeanRegistry findBeanRegistry() {
                // Bean dictionary on bean filter.
-               List<Class<?>> beanDictionaryClasses = nn(beanFilter) ? 
copyOf(beanFilter.getBeanDictionary()) : list();
+               var beanDictionaryClasses = opt(beanFilter).map(x -> 
(List<ClassInfo>)copyOf(x.getBeanDictionary())).orElse(list());
 
                // Bean dictionary from @Bean(typeName) annotation.
                var ba = beanContext.getAnnotationProvider().find(Bean.class, 
classMeta);
-               ba.stream().map(x -> 
x.inner().typeName()).filter(Utils::isNotEmpty).findFirst().ifPresent(x -> 
beanDictionaryClasses.add(classMeta.inner()));
+               ba.stream().map(x -> 
x.inner().typeName()).filter(Utils::isNotEmpty).findFirst().ifPresent(x -> 
beanDictionaryClasses.add(classMeta));
 
-               return new BeanRegistry(beanContext, null, 
beanDictionaryClasses.toArray(new Class<?>[beanDictionaryClasses.size()]));
+               return new BeanRegistry(beanContext, null, 
beanDictionaryClasses.stream().map(ClassInfo::inner).toArray(Class<?>[]::new));
        }
 
        /*
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanRegistry.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanRegistry.java
index 046ea7216b..44f927ca8b 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanRegistry.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanRegistry.java
@@ -56,6 +56,7 @@ public class BeanRegistry {
        private final AnnotationProvider ap;
        private final boolean isEmpty;
 
+       // TODO - Convert classes to use ClassInfo.
        BeanRegistry(BeanContext bc, BeanRegistry parent, Class<?>...classes) {
                this.bc = bc;
                this.ap = bc.getAnnotationProvider();

Reply via email to