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 ca306b18bd Marshall module improvements
ca306b18bd is described below
commit ca306b18bd44b6ab8a21ebe9569a8a7812a9a20b
Author: James Bognar <[email protected]>
AuthorDate: Tue Dec 9 08:11:51 2025 -0500
Marshall module improvements
---
.../src/main/java/org/apache/juneau/BeanFilter.java | 8 ++++----
.../src/main/java/org/apache/juneau/BeanMeta.java | 10 +++++-----
2 files changed, 9 insertions(+), 9 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 728443502e..ec27f4d232 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
@@ -705,7 +705,7 @@ public class BeanFilter {
private final Class<?> implClass, interfaceClass, stopClass;
private final boolean sortProperties, fluentSetters;
private final String typeName, example;
- private final Class<?>[] beanDictionary;
+ private final List<Class<?>> beanDictionary;
@SuppressWarnings("rawtypes")
private final BeanInterceptor interceptor;
@@ -726,7 +726,7 @@ public class BeanFilter {
this.sortProperties = builder.sortProperties;
this.fluentSetters = builder.fluentSetters;
this.propertyNamer = builder.propertyNamer.orElse(null);
- this.beanDictionary = builder.dictionary == null ? null :
builder.dictionary.toArray(new Class<?>[builder.dictionary.size()]);
+ this.beanDictionary = builder.dictionary == null ? list() :
u(copyOf(builder.dictionary));
this.interceptor =
builder.interceptor.orElse(BeanInterceptor.DEFAULT);
}
@@ -740,9 +740,9 @@ public class BeanFilter {
/**
* Returns the bean dictionary defined on this bean.
*
- * @return The bean dictionary defined on this bean, or <jk>null</jk>
if no bean dictionary is defined.
+ * @return An unmodifiable list of the bean dictionary defined on this
bean, or an empty list if no bean dictionary is defined.
*/
- public Class<?>[] getBeanDictionary() { return beanDictionary; }
+ public List<Class<?>> 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 54bf566910..80c8a280b2 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
@@ -641,13 +641,13 @@ public class BeanMeta<T> {
var mVis = ctx.getBeanMethodVisibility();
var fVis = ctx.getBeanFieldVisibility();
- List<Class<?>> bdClasses = list();
- if (nn(bf) && nn(bf.getBeanDictionary()))
- addAll(bdClasses, bf.getBeanDictionary());
+ // Bean dictionary on bean filter.
+ List<Class<?>> beanDictionaryClasses = nn(bf) ?
copyOf(bf.getBeanDictionary()) : list();
- ba.stream().map(x ->
x.inner().typeName()).filter(Utils::isNotEmpty).findFirst().ifPresent(x ->
bdClasses.add(cm.inner()));
+ // Bean dictionary from @Bean(typeName) annotation.
+ ba.stream().map(x ->
x.inner().typeName()).filter(Utils::isNotEmpty).findFirst().ifPresent(x ->
beanDictionaryClasses.add(cm.inner()));
- beanRegistry = new BeanRegistry(ctx, null,
bdClasses.toArray(new Class<?>[bdClasses.size()]));
+ beanRegistry = new BeanRegistry(ctx, null,
beanDictionaryClasses.toArray(new Class<?>[beanDictionaryClasses.size()]));
// If @Bean.interfaceClass is specified on the parent
class, then we want
// to use the properties defined on that class, not the
subclass.