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

commit 4028ce8964dbfa80af40ea9648bf6bcfcd6370c6
Author: James Bognar <[email protected]>
AuthorDate: Wed Dec 10 10:17:11 2025 -0500

    Marshall module improvements
---
 .../juneau/commons/utils/ThrowableUtils.java       |  46 ++++
 .../src/main/java/org/apache/juneau/BeanMap.java   |   8 +-
 .../src/main/java/org/apache/juneau/BeanMeta.java  | 243 +++++++++------------
 .../java/org/apache/juneau/BeanPropertyMeta.java   |  36 +--
 .../apache/juneau/BeanProxyInvocationHandler.java  |   2 +-
 5 files changed, 170 insertions(+), 165 deletions(-)

diff --git 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/ThrowableUtils.java
 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/ThrowableUtils.java
index fa75de05a8..f836e2cae7 100644
--- 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/ThrowableUtils.java
+++ 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/ThrowableUtils.java
@@ -57,6 +57,21 @@ public class ThrowableUtils {
                return new BeanRuntimeException(c, msg, args);
        }
 
+       /**
+        * Shortcut for creating a {@link BeanRuntimeException} with a message 
and associated class.
+        *
+        * <p>
+        * Same as {@link #bex(Class, String, Object...) bex(Class, String, 
Object...)} but accepts a {@link ClassInfo} instead of a {@link Class}.
+        *
+        * @param c The class info associated with the exception.
+        * @param msg The message.
+        * @param args Optional {@link String#format(String, Object...)} 
arguments.
+        * @return A new {@link BeanRuntimeException}.
+        */
+       public static BeanRuntimeException bex(ClassInfo c, String msg, 
Object...args) {
+               return new BeanRuntimeException(c.inner(), msg, args);
+       }
+
        /**
         * Creates a {@link RuntimeException}.
         *
@@ -91,6 +106,22 @@ public class ThrowableUtils {
                return new BeanRuntimeException(e, c, msg, args);
        }
 
+       /**
+        * Shortcut for creating a {@link BeanRuntimeException} with a cause, 
message, and associated class.
+        *
+        * <p>
+        * Same as {@link #bex(Throwable, Class, String, Object...)} but 
accepts a {@link ClassInfo} instead of a {@link Class}.
+        *
+        * @param e The cause of the exception.
+        * @param c The class info associated with the exception.
+        * @param msg The message.
+        * @param args Optional {@link String#format(String, Object...)} 
arguments.
+        * @return A new {@link BeanRuntimeException}.
+        */
+       public static BeanRuntimeException bex(Throwable e, ClassInfo c, String 
msg, Object...args) {
+               return new BeanRuntimeException(e, c.inner(), msg, args);
+       }
+
        /**
         * Creates a {@link RuntimeException} with a cause.
         *
@@ -228,8 +259,23 @@ public class ThrowableUtils {
         * Prints a stack trace with a maximum depth limit to standard error.
         *
         * <p>
+        * This method is useful for {@link StackOverflowError} situations 
where printing the full stack trace
+        * can cause additional errors due to stack exhaustion. The stack trace 
will be limited to the specified
+        * maximum number of elements.
+        *
+        * <p>
         * Same as {@link #printStackTrace(Throwable, PrintWriter, Integer)} 
but writes to {@link System#err}.
         *
+        * <h5 class='section'>Example:</h5>
+        * <p class='bjava'>
+        *      <jk>try</jk> {
+        *              <jc>// Some code that might cause 
StackOverflowError</jc>
+        *      } <jk>catch</jk> (StackOverflowError <jv>e</jv>) {
+        *              <jc>// Print only first 100 stack trace elements to 
stderr</jc>
+        *              ThrowableUtils.<jsm>printStackTrace</jsm>(<jv>e</jv>, 
100);
+        *      }
+        * </p>
+        *
         * @param t The throwable to print the stack trace for.
         * @param maxDepth The maximum number of stack trace elements to print. 
If <jk>null</jk> or negative, prints all elements.
         */
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java
index 2220693d3d..3e6b2cdd09 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMap.java
@@ -124,9 +124,9 @@ public class BeanMap<T> extends AbstractMap<String,Object> 
implements Delegate<T
        public void add(String property, Object value) {
                var p = getPropertyMeta(property);
                if (p == null) {
-                       if (meta.getCtx().isIgnoreUnknownBeanProperties())
+                       if 
(meta.getBeanContext().isIgnoreUnknownBeanProperties())
                                return;
-                       throw bex(meta.getC(), "Bean property ''{0}'' not 
found.", property);
+                       throw bex(meta.getClassMeta(), "Bean property ''{0}'' 
not found.", property);
                }
                p.add(this, property, value);
        }
@@ -634,12 +634,12 @@ public class BeanMap<T> extends 
AbstractMap<String,Object> implements Delegate<T
        public Object put(String property, Object value) {
                var p = getPropertyMeta(property);
                if (p == null) {
-                       if (meta.getCtx().isIgnoreUnknownBeanProperties() || 
property.equals(typePropertyName))
+                       if 
(meta.getBeanContext().isIgnoreUnknownBeanProperties() || 
property.equals(typePropertyName))
                                return meta.onWriteProperty(bean, property, 
null);
 
                        p = getPropertyMeta("*");
                        if (p == null)
-                               throw bex(meta.getC(), "Bean property ''{0}'' 
not found.", property);
+                               throw bex(meta.getClassMeta(), "Bean property 
''{0}'' not found.", property);
                }
                return p.set(this, property, value);
        }
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 95864260cf..347d150115 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
@@ -328,13 +328,13 @@ public class BeanMeta<T> {
         */
        private static String name(AnnotationInfo<?> ai) {
                if (ai.isType(Beanp.class)) {
-                       Beanp p = ai.cast(Beanp.class).inner();
+                       var p = ai.cast(Beanp.class).inner();
                        if (isNotEmpty(p.name()))
                                return p.name();
                        if (isNotEmpty(p.value()))
                                return p.value();
                } else {
-                       Name n = ai.cast(Name.class).inner();
+                       var n = ai.cast(Name.class).inner();
                        if (isNotEmpty(n.value()))
                                return n.value();
                }
@@ -345,11 +345,10 @@ public class BeanMeta<T> {
        private final BeanFilter beanFilter;                                    
   // Optional bean filter associated with the target class.
        private final OptionalSupplier<InvocationHandler> 
beanProxyInvocationHandler;  // The invocation handler for this bean (if it's 
an interface).
        private final Supplier<BeanRegistry> beanRegistry;                      
   // The bean registry for this bean.
-       private final Class<T> c;                                               
   // The target class that this meta object describes.
        private final Supplier<List<ClassInfo>> classHierarchy;                 
   // List of all classes traversed in the class hierarchy.
        private final ClassMeta<T> classMeta;                                   
   // The target class type that this meta object describes.
-       private final BeanContext ctx;                                          
   // The bean context that created this metadata object.
-       private final Supplier<String> dictionaryName2;                         
   // The @Bean(typeName) annotation defined on this bean class.
+       private final BeanContext beanContext;                                  
   // The bean context that created this metadata object.
+       private final Supplier<String> dictionaryName;                          
   // The @Bean(typeName) annotation defined on this bean class.
        private final BeanPropertyMeta dynaProperty;                            
   // "extras" property.
        private final boolean fluentSetters;                                    
   // Whether fluent setters are enabled.
        private final Map<Method,String> getterProps;                           
   // The getter properties on the target class.
@@ -367,52 +366,49 @@ public class BeanMeta<T> {
         * Constructor.
         *
         * @param cm The target class.
-        * @param ctx The bean context that created this object.
+        * @param beanContext The bean context that created this object.
         * @param bf Optional bean filter associated with the target class.  
Can be <jk>null</jk>.
         * @param pNames Explicit list of property names and order of 
properties.  If <jk>null</jk>, determine automatically.
         * @param implClassConstructor The constructor to use if one cannot be 
found.  Can be <jk>null</jk>.
         */
        @SuppressWarnings("rawtypes")
        protected BeanMeta(ClassMeta<T> cm, BeanFilter bf, String[] pNames, 
ConstructorInfo implClassConstructor) {
-               this.classMeta = cm;
-               this.ctx = cm.getBeanContext();
-               this.c = cm.inner();
-               this.beanFilter = bf;
+               classMeta = cm;
+               beanContext = cm.getBeanContext();
+               beanFilter = bf;
                this.implClassConstructor = implClassConstructor;
-               this.fluentSetters = ctx.isFindFluentSetters() || (nn(bf) && 
bf.isFluentSetters());
-               this.stopClass = opt(bf).map(x -> 
(Class)x.getStopClass()).orElse(Object.class);
-
-               this.beanRegistry = memoize(()->findBeanRegistry());
-               this.classHierarchy = memoize(()->findClassHierarchy());
-               this.beanConstructor = findBeanConstructor();
+               fluentSetters = beanContext.isFindFluentSetters() || (nn(bf) && 
bf.isFluentSetters());
+               stopClass = opt(bf).map(x -> 
(Class)x.getStopClass()).orElse(Object.class);
+               beanRegistry = memoize(()->findBeanRegistry());
+               classHierarchy = memoize(()->findClassHierarchy());
+               beanConstructor = findBeanConstructor();
 
                // Local variables for initialization
-               var ap = ctx.getAnnotationProvider();
+               var ap = beanContext.getAnnotationProvider();
                var c = cm.inner();
                var ci = cm;
-               var notABeanReason = (String)null;
-               var properties = Value.<Map<String,BeanPropertyMeta>>empty();
-               var hiddenProperties = 
CollectionUtils.<String,BeanPropertyMeta>map();
-               var getterProps = CollectionUtils.<Method,String>map();
-               var setterProps = CollectionUtils.<Method,String>map();
-               var dynaProperty = Value.<BeanPropertyMeta>empty();
-               var sortProperties = false;
-
+               var _notABeanReason = (String)null;
+               var _properties = Value.<Map<String,BeanPropertyMeta>>empty();
+               var _hiddenProperties = 
CollectionUtils.<String,BeanPropertyMeta>map();
+               var _getterProps = CollectionUtils.<Method,String>map();
+               var _setterProps = CollectionUtils.<Method,String>map();
+               var _dynaProperty = Value.<BeanPropertyMeta>empty();
+               var _sortProperties = false;
                var ba = ap.find(Bean.class, cm);
-               var propertyNamer = opt(bf).map(x -> 
x.getPropertyNamer()).orElse(ctx.getPropertyNamer());
+               var propertyNamer = opt(bf).map(x -> 
x.getPropertyNamer()).orElse(beanContext.getPropertyNamer());
 
-               this.typePropertyName = ba.stream().map(x -> 
x.inner().typePropertyName()).filter(Utils::isNotEmpty).findFirst().orElseGet(()
 -> ctx.getBeanTypePropertyName());
+               this.typePropertyName = ba.stream().map(x -> 
x.inner().typePropertyName()).filter(Utils::isNotEmpty).findFirst().orElseGet(()
 -> beanContext.getBeanTypePropertyName());
 
                // Check if constructor is required but not found
-               if (! beanConstructor.constructor().isPresent() && bf == null 
&& ctx.isBeansRequireDefaultConstructor())
-                       notABeanReason = "Class does not have the required 
no-arg constructor";
+               if (! beanConstructor.constructor().isPresent() && bf == null 
&& beanContext.isBeansRequireDefaultConstructor())
+                       _notABeanReason = "Class does not have the required 
no-arg constructor";
 
                var bfo = opt(bf);
                var fixedBeanProps = bfo.map(x -> 
x.getProperties()).orElse(sete());
 
                try {
-                       var mVis = ctx.getBeanMethodVisibility();
-                       var fVis = ctx.getBeanFieldVisibility();
+                       var mVis = beanContext.getBeanMethodVisibility();
+                       var fVis = beanContext.getBeanFieldVisibility();
 
                        Map<String,BeanPropertyMeta.Builder> normalProps = 
map();  // NOAI
 
@@ -420,8 +416,8 @@ public class BeanMeta<T> {
                        // ensure that ordering first.
                        fixedBeanProps.forEach(x -> normalProps.put(x, 
BeanPropertyMeta.builder(this, x)));
 
-                       if (ctx.isUseJavaBeanIntrospector()) {
-                               var c2 = (bf != null && 
nn(bf.getInterfaceClass()) ? bf.getInterfaceClass() : c);
+                       if (beanContext.isUseJavaBeanIntrospector()) {
+                               var c2 = bfo.map(x -> 
(Class)x.getInterfaceClass()).filter(Objects::nonNull).orElse(c);
                                var bi = (BeanInfo)null;
                                if (! c2.isInterface())
                                        bi = Introspector.getBeanInfo(c2, 
stopClass);
@@ -453,38 +449,31 @@ public class BeanMeta<T> {
                                bms.forEach(x -> {
                                        var pn = x.propertyName;
                                        var m = x.method;
-                               var mi = info(m);
-                               var bpm = normalProps.computeIfAbsent(pn, k -> 
new BeanPropertyMeta.Builder(this, k));
+                                       var mi = info(m);
+                                       var bpm = 
normalProps.computeIfAbsent(pn, k -> new BeanPropertyMeta.Builder(this, k));
+
                                        if (x.methodType == GETTER) {
                                                // Two getters.  Pick the best.
                                                if (nn(bpm.getter)) {
-
-                                                       if (! 
ap.has(Beanp.class, mi) && ap.has(Beanp.class, info(bpm.getter)))
+                                                       if (! 
ap.has(Beanp.class, mi) && ap.has(Beanp.class, info(bpm.getter))) {
                                                                m = bpm.getter; 
 // @Beanp annotated method takes precedence.
-
-                                                       else if 
(m.getName().startsWith("is") && bpm.getter.getName().startsWith("get"))
+                                                       } else if 
(m.getName().startsWith("is") && bpm.getter.getName().startsWith("get")) {
                                                                m = bpm.getter; 
 // getX() overrides isX().
+                                                       }
                                                }
                                                bpm.setGetter(m);
                                        }
                                });
 
                                // Now iterate through all the setters.
-                               bms.forEach(x -> {
-                                       if (x.methodType == SETTER) {
-                                               var bpm = 
normalProps.get(x.propertyName);
-                                               if (x.matchesPropertyType(bpm))
-                                                       bpm.setSetter(x.method);
-                                       }
+                               bms.stream().filter(x -> eq(x.methodType, 
SETTER)).forEach(x -> {
+                                       var bpm = 
normalProps.get(x.propertyName);
+                                       if (x.matchesPropertyType(bpm))
+                                               bpm.setSetter(x.method);
                                });
 
                                // Now iterate through all the extraKeys.
-                               bms.forEach(x -> {
-                                       if (x.methodType == EXTRAKEYS) {
-                                               var bpm = 
normalProps.get(x.propertyName);
-                                               bpm.setExtraKeys(x.method);
-                                       }
-                               });
+                               bms.stream().filter(x -> eq(x.methodType, 
EXTRAKEYS)).forEach(x -> 
normalProps.get(x.propertyName).setExtraKeys(x.method));
                        }
 
                        var typeVarImpls = ClassUtils.findTypeVarImpls(c);
@@ -492,19 +481,19 @@ public class BeanMeta<T> {
                        // Eliminate invalid properties, and set the contents 
of getterProps and setterProps.
                        var readOnlyProps = bfo.map(x -> 
x.getReadOnlyProperties()).orElse(sete());
                        var writeOnlyProps = bfo.map(x -> 
x.getWriteOnlyProperties()).orElse(sete());
-                       for (Iterator<BeanPropertyMeta.Builder> i = 
normalProps.values().iterator(); i.hasNext();) {
+                       for (var i = normalProps.values().iterator(); 
i.hasNext();) {
                                var p = i.next();
                                try {
                                        if (p.field == null)
                                                
p.setInnerField(findInnerBeanField(p.name));
 
-                                       if (p.validate(ctx, beanRegistry.get(), 
typeVarImpls, readOnlyProps, writeOnlyProps)) {
+                                       if (p.validate(beanContext, 
beanRegistry.get(), typeVarImpls, readOnlyProps, writeOnlyProps)) {
 
                                                if (nn(p.getter))
-                                                       
getterProps.put(p.getter, p.name);
+                                                       
_getterProps.put(p.getter, p.name);
 
                                                if (nn(p.setter))
-                                                       
setterProps.put(p.setter, p.name);
+                                                       
_setterProps.put(p.setter, p.name);
 
                                        } else {
                                                i.remove();
@@ -515,10 +504,7 @@ public class BeanMeta<T> {
                        }
 
                        // Check for missing properties.
-                       fixedBeanProps.forEach(x -> {
-                               if (! normalProps.containsKey(x))
-                                       throw bex(c, "The property ''{0}'' was 
defined on the @Bean(properties=X) annotation of class ''{1}'' but was not 
found on the class definition.", x, ci.getNameSimple());
-                       });
+                       fixedBeanProps.stream().filter(x -> ! 
normalProps.containsKey(x)).findFirst().ifPresent(x -> { throw bex(c, "The 
property ''{0}'' was defined on the @Bean(properties=X) annotation of class 
''{1}'' but was not found on the class definition.", x, ci.getNameSimple()); });
 
                        // Mark constructor arg properties.
                        for (var fp : beanConstructor.args()) {
@@ -529,73 +515,68 @@ public class BeanMeta<T> {
                        }
 
                        // Make sure at least one property was found.
-                       if (bf == null && ctx.isBeansRequireSomeProperties() && 
normalProps.isEmpty())
-                               notABeanReason = "No properties detected on 
bean class";
+                       if (bf == null && 
beanContext.isBeansRequireSomeProperties() && normalProps.isEmpty())
+                               _notABeanReason = "No properties detected on 
bean class";
 
-                       sortProperties = ctx.isSortProperties() || 
opt(bf).map(x -> x.isSortProperties()).orElse(false) && 
fixedBeanProps.isEmpty();
+                       _sortProperties = beanContext.isSortProperties() || 
bfo.map(x -> x.isSortProperties()).orElse(false) && fixedBeanProps.isEmpty();
 
-                       properties.set(sortProperties ? sortedMap() : map());
+                       _properties.set(_sortProperties ? sortedMap() : map());
 
                        normalProps.forEach((k, v) -> {
                                var pMeta = v.build();
                                if (pMeta.isDyna())
-                                       dynaProperty.set(pMeta);
-                               properties.get().put(k, pMeta);
+                                       _dynaProperty.set(pMeta);
+                               _properties.get().put(k, pMeta);
                        });
 
                        // If a beanFilter is defined, look for inclusion and 
exclusion lists.
                        if (bf != null) {
 
                                // Eliminated excluded properties if 
BeanFilter.excludeKeys is specified.
-                               Set<String> bfbpi = bf.getProperties();
-                               Set<String> bfbpx = bf.getExcludeProperties();
+                               var bfbpi = bf.getProperties();
+                               var bfbpx = bf.getExcludeProperties();
+                               var p = _properties.get();
 
                                if (! bfbpi.isEmpty()) {
                                        // Only include specified properties if 
BeanFilter.includeKeys is specified.
                                        // Note that the order must match 
includeKeys.
-                                       Map<String,BeanPropertyMeta> 
properties2 = map();  // NOAI
-                                       bfbpi.forEach(x -> {
-                                               if 
(properties.get().containsKey(x))
-                                                       properties2.put(x, 
properties.get().remove(x));
-                                       });
-                                       
hiddenProperties.putAll(properties.get());
-                                       properties.set(properties2);
-                               }
-                               if (! bfbpx.isEmpty()) {
-                                       bfbpx.forEach(x -> 
hiddenProperties.put(x, properties.get().remove(x)));
+                                       Map<String,BeanPropertyMeta> p2 = 
map();  // NOAI
+                                       bfbpi.stream().filter(x -> 
p.containsKey(x)).forEach(x -> p2.put(x, p.remove(x)));
+                                       _hiddenProperties.putAll(p);
+                                       _properties.set(p2);
                                }
+
+                               bfbpx.forEach(x -> _hiddenProperties.put(x, 
_properties.get().remove(x)));
                        }
 
                        if (nn(pNames)) {
-                               Map<String,BeanPropertyMeta> properties2 = 
map();
+                               var p = _properties.get();
+                               Map<String,BeanPropertyMeta> p2 = map();
                                for (var k : pNames) {
-                                       if (properties.get().containsKey(k))
-                                               properties2.put(k, 
properties.get().get(k));
+                                       if (p.containsKey(k))
+                                               p2.put(k, p.get(k));
                                        else
-                                               hiddenProperties.put(k, 
properties.get().get(k));
+                                               _hiddenProperties.put(k, 
p.get(k));
                                }
-                               properties.set(properties2);
+                               _properties.set(p2);
                        }
 
                } catch (BeanRuntimeException e) {
                        throw e;
                } catch (Exception e) {
-                       notABeanReason = "Exception:  " + getStackTrace(e);
+                       _notABeanReason = "Exception:  " + getStackTrace(e);
                }
 
-               // Assign to final fields
-               this.notABeanReason = notABeanReason;
-               this.properties = u(properties.get());
-               this.hiddenProperties = u(hiddenProperties);
-               this.getterProps = u(getterProps);
-               this.setterProps = u(setterProps);
-               this.dynaProperty = dynaProperty.get();
-               this.sortProperties = sortProperties;
-
-               this.typeProperty = BeanPropertyMeta.builder(this, 
typePropertyName).canRead().canWrite().rawMetaType(ctx.string()).beanRegistry(beanRegistry.get()).build();
-
-               dictionaryName2 = memoize(()->findDictionaryName());
-               beanProxyInvocationHandler = 
memoize(()->ctx.isUseInterfaceProxies() && c.isInterface() ? new 
BeanProxyInvocationHandler<>(this) : null);
+               notABeanReason = _notABeanReason;
+               properties = u(_properties.get());
+               hiddenProperties = u(_hiddenProperties);
+               getterProps = u(_getterProps);
+               setterProps = u(_setterProps);
+               dynaProperty = _dynaProperty.get();
+               sortProperties = _sortProperties;
+               typeProperty = BeanPropertyMeta.builder(this, 
typePropertyName).canRead().canWrite().rawMetaType(beanContext.string()).beanRegistry(beanRegistry.get()).build();
+               dictionaryName = memoize(()->findDictionaryName());
+               beanProxyInvocationHandler = 
memoize(()->beanContext.isUseInterfaceProxies() && c.isInterface() ? new 
BeanProxyInvocationHandler<>(this) : null);
        }
 
        @Override /* Overridden from Object */
@@ -653,7 +634,7 @@ public class BeanMeta<T> {
         *
         * @return The dictionary name for this bean, or <jk>null</jk> if it 
has no dictionary name defined.
         */
-       public final String getDictionaryName() { return dictionaryName2.get(); 
}
+       public final String getDictionaryName() { return dictionaryName.get(); }
 
        /**
         * Returns a map of all properties on this bean.
@@ -670,9 +651,7 @@ public class BeanMeta<T> {
         * @see #getPropertyMeta(String)
         * @see #getHiddenProperties()
         */
-       public Map<String,BeanPropertyMeta> getProperties() {
-               return properties;
-       }
+       public Map<String,BeanPropertyMeta> getProperties() { return 
properties; }
 
        /**
         * Returns metadata about the specified property.
@@ -720,19 +699,12 @@ public class BeanMeta<T> {
         */
        public final String getTypePropertyName() { return typePropertyName; }
 
-       /**
-        * Returns the target class that this meta object describes.
-        *
-        * @return The target class.
-        */
-       protected final Class<T> getC() { return c; }
-
        /**
         * Returns the bean context that created this metadata object.
         *
         * @return The bean context.
         */
-       protected final BeanContext getCtx() { return ctx; }
+       protected final BeanContext getBeanContext() { return beanContext; }
 
        /**
         * Returns the "extras" property for dynamic bean properties.
@@ -741,13 +713,6 @@ public class BeanMeta<T> {
         */
        protected final BeanPropertyMeta getDynaProperty() { return 
dynaProperty; }
 
-       /**
-        * Returns whether fluent setters are enabled for this bean.
-        *
-        * @return <jk>true</jk> if fluent setters are enabled.
-        */
-       protected final boolean isFluentSetters() { return fluentSetters; }
-
        /**
         * Returns the map of getter methods to property names.
         *
@@ -755,13 +720,6 @@ public class BeanMeta<T> {
         */
        protected final Map<Method,String> getGetterProps() { return 
getterProps; }
 
-       /**
-        * Returns the reason why this class is not a bean, if applicable.
-        *
-        * @return The not-a-bean reason, or <jk>null</jk> if this is a bean.
-        */
-       protected final String getNotABeanReason() { return notABeanReason; }
-
        /**
         * Returns the map of setter methods to property names.
         *
@@ -813,7 +771,7 @@ public class BeanMeta<T> {
 
        @Override /* Overridden from Object */
        public String toString() {
-               var sb = new StringBuilder(c.getName());
+               var sb = new StringBuilder(classMeta.getName());
                sb.append(" {\n");
                properties.values().forEach(x -> 
sb.append('\t').append(x.toString()).append(",\n"));
                sb.append('}');
@@ -821,25 +779,25 @@ public class BeanMeta<T> {
        }
 
        private BeanConstructor findBeanConstructor() {
-               var ap = ctx.getAnnotationProvider();
-               var vis = ctx.getBeanConstructorVisibility();
+               var ap = beanContext.getAnnotationProvider();
+               var vis = beanContext.getBeanConstructorVisibility();
                var ci = classMeta;
 
                var l = ci.getPublicConstructors().stream().filter(x -> 
ap.has(Beanc.class, x)).toList();
                if (l.isEmpty())
                        l = ci.getDeclaredConstructors().stream().filter(x -> 
ap.has(Beanc.class, x)).toList();
                if (l.size() > 1)
-                       throw bex(c, "Multiple instances of '@Beanc' found.");
+                       throw bex(ci, "Multiple instances of '@Beanc' found.");
                if (l.size() == 1) {
                        var con = l.get(0).accessible();
                        var args = ap.find(Beanc.class, con).stream().map(x -> 
x.inner().properties()).filter(StringUtils::isNotBlank).map(x -> 
split(x)).findFirst().orElse(liste());
                        if (! con.hasNumParameters(args.size())) {
                                if (isNotEmpty(args))
-                                       throw bex(c, "Number of properties 
defined in '@Beanc' annotation does not match number of parameters in 
constructor.");
+                                       throw bex(ci, "Number of properties 
defined in '@Beanc' annotation does not match number of parameters in 
constructor.");
                                args = con.getParameters().stream().map(x -> 
x.getName()).toList();
                                for (int i = 0; i < args.size(); i++) {
                                        if (isBlank(args.get(i)))
-                                               throw bex(c, "Could not find 
name for parameter #{0} of constructor ''{1}''", i, con.getFullName());
+                                               throw bex(ci, "Could not find 
name for parameter #{0} of constructor ''{1}''", i, con.getFullName());
                                }
                        }
                        return new BeanConstructor(opt(con), args);
@@ -867,7 +825,8 @@ public class BeanMeta<T> {
         */
        private final List<BeanMethod> findBeanMethods(Visibility v, 
PropertyNamer pn, boolean fluentSetters) {
                var l = new LinkedList<BeanMethod>();
-               var ap = ctx.getAnnotationProvider();
+               var ap = beanContext.getAnnotationProvider();
+               var ci = classMeta;
 
                classHierarchy.get().stream().forEach(c2 -> {
                        for (var m : c2.getDeclaredMethods()) {
@@ -931,10 +890,10 @@ public class BeanMeta<T> {
                                                        methodType = GETTER;
                                                        n = bpName;
                                                }
-                                       } else if (n.startsWith("set") && 
(rt.isParentOf(c) || rt.is(Void.TYPE))) {
+                                       } else if (n.startsWith("set") && 
(rt.isParentOf(ci) || rt.is(Void.TYPE))) {
                                                methodType = SETTER;
                                                n = n.substring(3);
-                                       } else if (n.startsWith("with") && 
(rt.isParentOf(c))) {
+                                       } else if (n.startsWith("with") && 
(rt.isParentOf(ci))) {
                                                methodType = SETTER;
                                                n = n.substring(4);
                                        } else if (nn(bpName)) {
@@ -946,12 +905,12 @@ public class BeanMeta<T> {
                                                } else {
                                                        n = bpName;
                                                }
-                                       } else if (fluentSetters && 
rt.isParentOf(c)) {
+                                       } else if (fluentSetters && 
rt.isParentOf(ci)) {
                                                methodType = SETTER;
                                        }
                                } else if (params.size() == 2) {
                                        if ("*".equals(bpName) && 
params.get(0).getParameterType().is(String.class)) {
-                                               if (n.startsWith("set") && 
(rt.isParentOf(c) || rt.is(Void.TYPE))) {
+                                               if (n.startsWith("set") && 
(rt.isParentOf(ci) || rt.is(Void.TYPE))) {
                                                        methodType = SETTER;
                                                } else {
                                                        methodType = GETTER;
@@ -962,7 +921,7 @@ public class BeanMeta<T> {
                                n = pn.getPropertyName(n);
 
                                if ("*".equals(bpName) && methodType == UNKNOWN)
-                                       throw bex(c, "Found @Beanp(\"*\") but 
could not determine method type on method ''{0}''.", m.getSimpleName());
+                                       throw bex(ci, "Found @Beanp(\"*\") but 
could not determine method type on method ''{0}''.", m.getSimpleName());
 
                                if (methodType != UNKNOWN) {
                                        if (nn(bpName) && ! bpName.isEmpty())
@@ -980,17 +939,17 @@ public class BeanMeta<T> {
                List<Class<?>> beanDictionaryClasses = nn(beanFilter) ? 
copyOf(beanFilter.getBeanDictionary()) : list();
 
                // Bean dictionary from @Bean(typeName) annotation.
-               var ba = ctx.getAnnotationProvider().find(Bean.class, 
classMeta);
+               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()));
 
-               return new BeanRegistry(ctx, null, 
beanDictionaryClasses.toArray(new Class<?>[beanDictionaryClasses.size()]));
+               return new BeanRegistry(beanContext, null, 
beanDictionaryClasses.toArray(new Class<?>[beanDictionaryClasses.size()]));
        }
 
        private List<ClassInfo> findClassHierarchy() {
                var result = new LinkedList<ClassInfo>();
                // If @Bean.interfaceClass is specified on the parent class, 
then we want
                // to use the properties defined on that class, not the 
subclass.
-               var c2 = (nn(beanFilter) && nn(beanFilter.getInterfaceClass()) 
? beanFilter.getInterfaceClass() : c);
+               var c2 = (nn(beanFilter) && nn(beanFilter.getInterfaceClass()) 
? beanFilter.getInterfaceClass() : classMeta.inner());
                findClassHierarchy(info(c2), stopClass, result::add);
                return u(result);
        }
@@ -1018,7 +977,7 @@ public class BeanMeta<T> {
                        .getParentsAndInterfaces()
                        .stream()
                        .skip(1)
-                       .map(x -> ctx.getClassMeta(x))
+                       .map(x -> beanContext.getClassMeta(x))
                        .map(x -> x.getBeanRegistry())
                        .filter(Objects::nonNull)
                        .map(x -> x.getTypeName(this.classMeta))
@@ -1096,8 +1055,8 @@ public class BeanMeta<T> {
         * @return A collection of all bean fields found in the class hierarchy.
         */
        final Collection<FieldInfo> findBeanFields(Visibility v) {
-               var noIgnoreTransients = ! ctx.isIgnoreTransientFields();
-               var ap = ctx.getAnnotationProvider();
+               var noIgnoreTransients = ! 
beanContext.isIgnoreTransientFields();
+               var ap = beanContext.getAnnotationProvider();
                // @formatter:off
                return classHierarchy.get().stream()
                        .flatMap(c2 -> c2.getDeclaredFields().stream())
@@ -1111,8 +1070,8 @@ public class BeanMeta<T> {
        }
 
        final FieldInfo findInnerBeanField(String name) {
-               var noIgnoreTransients = ! ctx.isIgnoreTransientFields();
-               var ap = ctx.getAnnotationProvider();
+               var noIgnoreTransients = ! 
beanContext.isIgnoreTransientFields();
+               var ap = beanContext.getAnnotationProvider();
 
                // @formatter:off
                return classHierarchy.get().stream()
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
index b8b0b5d0cb..aade93f219 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -77,7 +77,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
 
                Builder(BeanMeta<?> beanMeta, String name) {
                        this.beanMeta = beanMeta;
-                       this.bc = beanMeta.getCtx();
+                       this.bc = beanMeta.getBeanContext();
                        this.name = name;
                }
 
@@ -466,7 +466,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                var isArray = rawTypeMeta.isArray();
 
                if (! (isCollection || isArray))
-                       throw bex(beanMeta.getC(), "Attempt to add element to 
property ''{0}'' which is not a collection or array", name);
+                       throw bex(beanMeta.getClassMeta(), "Attempt to add 
element to property ''{0}'' which is not a collection or array", name);
 
                var bean = m.getBean(true);
 
@@ -552,7 +552,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                var isBean = rawTypeMeta.isBean();
 
                if (! (isBean || isMap))
-                       throw bex(beanMeta.getC(), "Attempt to add key/value to 
property ''{0}'' which is not a map or bean", name);
+                       throw bex(beanMeta.getClassMeta(), "Attempt to add 
key/value to property ''{0}'' which is not a map or bean", name);
 
                var bean = m.getBean(true);
 
@@ -793,7 +793,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                return (Map)getter.invoke(bean);
                        if (nn(field))
                                return (Map)field.get(bean);
-                       throw bex(beanMeta.getC(), "Getter or public field not 
defined on property ''{0}''", name);
+                       throw bex(beanMeta.getClassMeta(), "Getter or public 
field not defined on property ''{0}''", name);
                }
                return Collections.EMPTY_MAP;
        }
@@ -858,7 +858,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                        return 
rawTypeMeta.getPrimitiveDefault();
                                return null;
                        }
-                       throw bex(e, beanMeta.getC(), "Exception occurred while 
getting property ''{0}''", name);
+                       throw bex(e, beanMeta.getClassMeta(), "Exception 
occurred while getting property ''{0}''", name);
                }
        }
 
@@ -1017,7 +1017,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                        return 
rawTypeMeta.getPrimitiveDefault();
                                return null;
                        }
-                       throw bex(e, beanMeta.getC(), "Exception occurred while 
getting property ''{0}''", name);
+                       throw bex(e, beanMeta.getClassMeta(), "Exception 
occurred while getting property ''{0}''", name);
                }
        }
 
@@ -1031,14 +1031,14 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                        } else if (nn(field))
                                m = (Map)field.get(bean);
                        else
-                               throw bex(beanMeta.getC(), "Getter or public 
field not defined on property ''{0}''", name);
+                               throw bex(beanMeta.getClassMeta(), "Getter or 
public field not defined on property ''{0}''", name);
                        return (m == null ? null : m.get(pName));
                }
                if (nn(getter))
                        return getter.invoke(bean);
                if (nn(field))
                        return field.get(bean);
-               throw bex(beanMeta.getC(), "Getter or public field not defined 
on property ''{0}''", name);
+               throw bex(beanMeta.getClassMeta(), "Getter or public field not 
defined on property ''{0}''", name);
        }
 
        private Object invokeSetter(Object bean, String pName, Object val) 
throws IllegalArgumentException, IllegalAccessException, 
InvocationTargetException {
@@ -1051,7 +1051,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                        else if (nn(getter))
                                m = (Map<String,Object>)getter.invoke(bean);
                        else
-                               throw bex(beanMeta.getC(), "Cannot set property 
''{0}'' of type ''{1}'' to object of type ''{2}'' because no setter is defined 
on this property, and the existing property value is null",
+                               throw bex(beanMeta.getClassMeta(), "Cannot set 
property ''{0}'' of type ''{1}'' to object of type ''{2}'' because no setter is 
defined on this property, and the existing property value is null",
                                        name, cn(this.getClassMeta()), 
findClassName(val));
                        return (m == null ? null : m.put(pName, val));
                }
@@ -1061,7 +1061,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                        field.set(bean, val);
                        return null;
                }
-               throw bex(beanMeta.getC(), "Cannot set property ''{0}'' of type 
''{1}'' to object of type ''{2}'' because no setter is defined on this 
property, and the existing property value is null", name,
+               throw bex(beanMeta.getClassMeta(), "Cannot set property ''{0}'' 
of type ''{1}'' to object of type ''{2}'' because no setter is defined on this 
property, and the existing property value is null", name,
                        cn(this.getClassMeta()), findClassName(val));
        }
 
@@ -1092,7 +1092,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                        if ((! isDyna) && field == null && setter == null && ! 
(isMap || isCollection)) {
                                if ((value == null && 
bc.isIgnoreUnknownNullBeanProperties()) || bc.isIgnoreMissingSetters())
                                        return null;
-                               throw bex(beanMeta.getC(), "Setter or public 
field not defined on property ''{0}''", name);
+                               throw bex(beanMeta.getClassMeta(), "Setter or 
public field not defined on property ''{0}''", name);
                        }
 
                        var bean = m.getBean(true);  // Don't use getBean() 
because it triggers array creation!
@@ -1116,7 +1116,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                                if (value instanceof 
CharSequence value2)
                                                        value = 
JsonMap.ofJson(value2).session(session);
                                                else
-                                                       throw 
bex(beanMeta.getC(), "Cannot set property ''{0}'' of type ''{1}'' to object of 
type ''{2}''", name, propertyClass.getName(), findClassName(value));
+                                                       throw 
bex(beanMeta.getClassMeta(), "Cannot set property ''{0}'' of type ''{1}'' to 
object of type ''{2}''", name, propertyClass.getName(), findClassName(value));
                                        }
 
                                        var valueMap = (Map)value;
@@ -1128,7 +1128,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                        if (! 
rawTypeMeta.canCreateNewInstance()) {
                                                if (propMap == null) {
                                                        if (setter == null && 
field == null)
-                                                               throw 
bex(beanMeta.getC(),
+                                                               throw 
bex(beanMeta.getClassMeta(),
                                                                        "Cannot 
set property ''{0}'' of type ''{1}'' to object of type ''{2}'' because no 
setter or public field is defined, and the current value is null", name,
                                                                        
propertyClass.getName(), findClassName(value));
 
@@ -1146,7 +1146,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                                                
invokeSetter(bean, pName, valueMap);
                                                                return r;
                                                        }
-                                                       throw 
bex(beanMeta.getC(),
+                                                       throw 
bex(beanMeta.getClassMeta(),
                                                                "Cannot set 
property ''{0}'' of type ''{2}'' to object of type ''{2}'' because the assigned 
map cannot be converted to the specified type because the property type is 
abstract, and the property value is currently null",
                                                                name, 
propertyClass.getName(), findClassName(value));
                                                }
@@ -1174,7 +1174,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                                if (value instanceof 
CharSequence value2)
                                                        value = new 
JsonList(value2).setBeanSession(session);
                                                else
-                                                       throw 
bex(beanMeta.getC(), "Cannot set property ''{0}'' of type ''{1}'' to object of 
type ''{2}''", name, propertyClass.getName(), findClassName(value));
+                                                       throw 
bex(beanMeta.getClassMeta(), "Cannot set property ''{0}'' of type ''{1}'' to 
object of type ''{2}''", name, propertyClass.getName(), findClassName(value));
                                        }
 
                                        var valueList = (Collection)value;
@@ -1186,7 +1186,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                        if (! 
rawTypeMeta.canCreateNewInstance()) {
                                                if (propList == null) {
                                                        if (setter == null && 
field == null)
-                                                               throw 
bex(beanMeta.getC(),
+                                                               throw 
bex(beanMeta.getClassMeta(),
                                                                        "Cannot 
set property ''{0}'' of type ''{1}'' to object of type ''{2}'' because no 
setter or public field is defined, and the current value is null", name,
                                                                        
propertyClass.getName(), findClassName(value));
 
@@ -1204,7 +1204,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                                                
invokeSetter(bean, pName, valueList);
                                                                return r;
                                                        }
-                                                       throw 
bex(beanMeta.getC(),
+                                                       throw 
bex(beanMeta.getClassMeta(),
                                                                "Cannot set 
property ''{0}'' of type ''{1}'' to object of type ''{2}'' because the assigned 
map cannot be converted to the specified type because the property type is 
abstract, and the property value is currently null",
                                                                name, 
propertyClass.getName(), findClassName(value));
                                                }
@@ -1245,7 +1245,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                                return 
rawTypeMeta.getPrimitiveDefault();
                                        return null;
                                }
-                               throw bex(e, beanMeta.getC(), "Error occurred 
trying to set property ''{0}''", name);
+                               throw bex(e, beanMeta.getClassMeta(), "Error 
occurred trying to set property ''{0}''", name);
                        }
                } catch (ParseException e) {
                        throw bex(e);
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanProxyInvocationHandler.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanProxyInvocationHandler.java
index cb4b931196..9165bb3c32 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanProxyInvocationHandler.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanProxyInvocationHandler.java
@@ -68,7 +68,7 @@ public class BeanProxyInvocationHandler<T> implements 
InvocationHandler {
                                        return 
this.beanProps.equals(ih2.beanProps);
                                }
                        }
-                       BeanMap<Object> bean = 
this.meta.getCtx().toBeanMap(arg);
+                       BeanMap<Object> bean = 
this.meta.getBeanContext().toBeanMap(arg);
                        return this.beanProps.equals(bean);
                }
 


Reply via email to