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 f870ab14a3 Marshall module improvements
f870ab14a3 is described below
commit f870ab14a3bcc9facaf70bcdf1b1785c44c38aa5
Author: James Bognar <[email protected]>
AuthorDate: Tue Dec 9 16:34:55 2025 -0500
Marshall module improvements
---
.../src/main/java/org/apache/juneau/BeanFilter.java | 11 ++++++-----
.../src/main/java/org/apache/juneau/BeanMeta.java | 11 +++--------
.../apache/juneau/annotation/BeanConfigAnnotation_Test.java | 2 +-
3 files changed, 10 insertions(+), 14 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 ec27f4d232..56d6c7d7a2 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
@@ -25,6 +25,7 @@ import java.beans.*;
import java.util.*;
import org.apache.juneau.annotation.*;
+import org.apache.juneau.commons.reflect.*;
import org.apache.juneau.cp.*;
import org.apache.juneau.swap.*;
@@ -45,7 +46,7 @@ public class BeanFilter {
*/
public static class Builder {
- Class<?> beanClass;
+ ClassInfoTyped<?> beanClass;
String typeName, example;
Set<String> properties = set(), excludeProperties = set(),
readOnlyProperties = set(), writeOnlyProperties = set();
Class<?> implClass, interfaceClass, stopClass;
@@ -60,7 +61,7 @@ public class BeanFilter {
*
* @param beanClass The bean class that this filter applies to.
*/
- protected Builder(Class<?> beanClass) {
+ protected Builder(ClassInfoTyped<?> beanClass) {
this.beanClass = beanClass;
}
@@ -695,11 +696,11 @@ public class BeanFilter {
* @param beanClass The bean class being filtered.
* @return A new builder.
*/
- public static <T> Builder create(Class<T> beanClass) {
+ public static <T> Builder create(ClassInfoTyped<T> beanClass) {
return new Builder(beanClass);
}
- private final Class<?> beanClass;
+ private final ClassInfoTyped<?> beanClass;
private final Set<String> properties, excludeProperties,
readOnlyProperties, writeOnlyProperties;
private final PropertyNamer propertyNamer;
private final Class<?> implClass, interfaceClass, stopClass;
@@ -735,7 +736,7 @@ public class BeanFilter {
*
* @return The bean class that this filter applies to.
*/
- public Class<?> getBeanClass() { return beanClass; }
+ public ClassInfoTyped<?> getBeanClass() { return beanClass; }
/**
* Returns the bean dictionary defined on this bean.
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 68b7657565..8b46440fac 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
@@ -20,10 +20,10 @@ import static org.apache.juneau.BeanMeta.MethodType.*;
import static org.apache.juneau.commons.reflect.AnnotationTraversal.*;
import static org.apache.juneau.commons.reflect.ReflectionUtils.*;
import static org.apache.juneau.commons.utils.CollectionUtils.*;
-import static org.apache.juneau.commons.utils.PredicateUtils.*;
import static org.apache.juneau.commons.utils.StringUtils.*;
import static org.apache.juneau.commons.utils.ThrowableUtils.*;
import static org.apache.juneau.commons.utils.Utils.*;
+import static org.apache.juneau.BeanMeta.MethodType.*;
import java.beans.*;
import java.io.*;
@@ -92,7 +92,7 @@ public class BeanMeta<T> {
var l = ap.find(Bean.class, cm);
if (l.isEmpty())
return null;
- return
BeanFilter.create(cm.inner()).applyAnnotations(reverse(l.stream().map(AnnotationInfo::inner).toList())).build();
+ return
BeanFilter.create(cm).applyAnnotations(reverse(l.stream().map(AnnotationInfo::inner).toList())).build();
}
/**
@@ -199,10 +199,7 @@ public class BeanMeta<T> {
this.propertyName = propertyName;
this.methodType = type;
this.method = method;
- if (type == MethodType.SETTER)
- this.type = info(method.getParameterTypes()[0]);
- else
- this.type = info(method.getReturnType());
+ this.type = info(type == SETTER ?
method.getParameterTypes()[0] : method.getReturnType());
}
@Override /* Overridden from Object */
@@ -254,8 +251,6 @@ public class BeanMeta<T> {
UNKNOWN, GETTER, SETTER, EXTRAKEYS;
}
- private static final BeanPropertyMeta[] EMPTY_PROPERTIES = {};
-
static final String bpName(List<Beanp> p, List<Name> n) {
if (p.isEmpty() && n.isEmpty())
return null;
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
index 4308d8bccc..0e26305ab6 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java
@@ -66,7 +66,7 @@ class BeanConfigAnnotation_Test extends TestBase {
return apply(e.getKey()) + "=" +
apply(e.getValue());
}
if (t instanceof BeanFilter)
- return
((BeanFilter)t).getBeanClass().getSimpleName();
+ return
((BeanFilter)t).getBeanClass().getNameSimple();
if (t instanceof Class)
return ((Class<?>)t).getSimpleName();
if (t instanceof ClassInfo)