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 3c223f6895 Utility class modernization
3c223f6895 is described below
commit 3c223f6895e36394f0ae766005deb9a5b6cfb8b5
Author: James Bognar <[email protected]>
AuthorDate: Fri Nov 7 09:41:08 2025 -0500
Utility class modernization
---
.../juneau/common/reflect/AnnotationInfo.java | 2 +-
.../juneau/common/reflect/ExecutableInfo.java | 25 +-------
.../apache/juneau/common/reflect/FieldInfo.java | 71 +++-------------------
.../apache/juneau/common/reflect/MethodInfo.java | 12 ----
.../org/apache/juneau/common/utils/ClassUtils.java | 2 +-
.../src/main/java/org/apache/juneau/BeanMeta.java | 16 ++---
.../apache/juneau/BeanProxyInvocationHandler.java | 4 +-
.../src/main/java/org/apache/juneau/ClassMeta.java | 10 +--
.../apache/juneau/cp/BeanCreateMethodFinder.java | 2 +-
.../java/org/apache/juneau/cp/BeanCreator.java | 8 +--
.../main/java/org/apache/juneau/cp/BeanStore.java | 2 +-
.../juneau/httppart/bean/RequestBeanMeta.java | 4 +-
.../juneau/httppart/bean/ResponseBeanMeta.java | 6 +-
.../java/org/apache/juneau/parser/ParserSet.java | 2 +-
.../java/org/apache/juneau/reflect/Mutaters.java | 2 +-
.../apache/juneau/serializer/SerializerSet.java | 2 +-
.../org/apache/juneau/svl/VarResolverSession.java | 6 +-
.../java/org/apache/juneau/swap/AutoListSwap.java | 4 +-
.../java/org/apache/juneau/swap/AutoMapSwap.java | 4 +-
.../org/apache/juneau/swap/AutoNumberSwap.java | 4 +-
.../org/apache/juneau/swap/AutoObjectSwap.java | 4 +-
.../java/org/apache/juneau/swap/BuilderSwap.java | 2 +-
.../apache/juneau/rest/client/ResponseContent.java | 2 +-
.../org/apache/juneau/rest/client/RestRequest.java | 2 +-
.../java/org/apache/juneau/rest/RestContext.java | 14 ++---
.../juneau/common/reflect/ClassInfo_Test.java | 2 +-
.../juneau/common/reflect/ConstructorInfoTest.java | 2 +-
.../juneau/common/reflect/ExecutableInfo_Test.java | 36 +++++------
.../juneau/common/reflect/FieldInfo_Test.java | 8 +--
29 files changed, 86 insertions(+), 174 deletions(-)
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationInfo.java
index 960b139673..c84e043360 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/AnnotationInfo.java
@@ -415,7 +415,7 @@ public class AnnotationInfo<T extends Annotation> {
private static int findRank(Object a) {
return ClassInfo.of(a).getMethods().stream()
- .filter(m -> m.hasName("rank") && m.hasNoParameters()
&& m.hasReturnType(int.class))
+ .filter(m -> m.hasName("rank") && m.getParameterCount()
== 0 && m.hasReturnType(int.class))
.findFirst()
.map(m -> safe(() -> (int)m.invoke(a)))
.orElse(0);
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
index 95302c07e8..62426a5384 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
@@ -206,17 +206,6 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
return getDeclaredAnnotationInfos(type).findFirst().isPresent();
}
- /**
- * Returns <jk>true</jk> if this executable does not have the specified
annotation.
- *
- * @param <A> The annotation type.
- * @param type The annotation type.
- * @return <jk>true</jk> if this executable does not have the specified
annotation.
- */
- public <A extends Annotation> boolean hasNoAnnotation(Class<A> type) {
- return !hasAnnotation(type);
- }
-
/**
* Returns the full name of this executable.
*
@@ -389,18 +378,6 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
return stream(names).anyMatch(n -> eq(n, getSimpleName()));
}
- /**
- * Returns <jk>true</jk> if this executable has no parameters.
- *
- * <p>
- * Same as calling {@link Executable#getParameterCount()} and comparing
with zero.
- *
- * @return <jk>true</jk> if this executable has no parameters.
- */
- public final boolean hasNoParameters() {
- return getParameterCount() == 0;
- }
-
/**
* Returns <jk>true</jk> if this executable has this number of
arguments.
*
@@ -477,7 +454,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
case DEPRECATED -> isDeprecated();
case NOT_DEPRECATED -> isNotDeprecated();
case HAS_PARAMS -> hasParameters();
- case HAS_NO_PARAMS -> hasNoParameters();
+ case HAS_NO_PARAMS -> getParameterCount() == 0;
case SYNTHETIC -> isSynthetic();
case NOT_SYNTHETIC -> !isSynthetic();
case VARARGS -> isVarArgs();
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
index abc78a4c23..9689382246 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/FieldInfo.java
@@ -65,9 +65,9 @@ public class FieldInfo extends AccessibleInfo implements
Comparable<FieldInfo>,
return ClassInfo.of(f.getDeclaringClass()).getFieldInfo(f);
}
- Field f; // Effectively final
+ final Field f;
private final ClassInfo declaringClass;
- private final Supplier<ClassInfo> typeCache = memoize(() ->
ClassInfo.of(f.getType()));
+ private final Supplier<ClassInfo> type;
private final Supplier<List<AnnotationInfo<Annotation>>> annotations =
memoize(this::_findAnnotations);
private final Supplier<String> fullName = memoize(this::findFullName);
@@ -81,6 +81,11 @@ public class FieldInfo extends AccessibleInfo implements
Comparable<FieldInfo>,
super(f, f.getModifiers());
this.declaringClass = declaringClass;
this.f = f;
+ this.type = memoize(() -> findType(f));
+ }
+
+ private static ClassInfo findType(Field f) {
+ return ClassInfo.of(f.getType());
}
private List<AnnotationInfo<Annotation>> _findAnnotations() {
@@ -121,17 +126,6 @@ public class FieldInfo extends AccessibleInfo implements
Comparable<FieldInfo>,
.map(x -> (AnnotationInfo<A>)x);
}
- /**
- * Returns the first annotation of the specified type declared on this
field.
- *
- * @param <A> The annotation type.
- * @param type The annotation type.
- * @return An optional containing the first matching annotation, or
empty if not found.
- */
- public <A extends Annotation> Optional<AnnotationInfo<A>>
getAnnotationInfo(Class<A> type) {
- return getAnnotationInfos(type).findFirst();
- }
-
/**
* Attempts to call <code>x.setAccessible(<jk>true</jk>)</code> and
quietly ignores security exceptions.
*
@@ -193,37 +187,13 @@ public class FieldInfo extends AccessibleInfo implements
Comparable<FieldInfo>,
*/
public String getName() { return f.getName(); }
- /**
- * Same as {@link #get(Object)} but wraps the results in an {@link
Optional}.
- *
- * @param o The object containing the field.
- * @param <T> The object type to retrieve.
- * @return The field value.
- * @throws BeanRuntimeException Field was not accessible or field does
not belong to object.
- */
- public <T> Optional<T> getOptional(Object o) throws
BeanRuntimeException {
- return Optional.ofNullable(get(o));
- }
-
/**
* Returns the type of this field.
*
* @return The type of this field.
*/
- public ClassInfo getType() {
- return typeCache.get();
- }
-
- /**
- * Returns <jk>true</jk> if the specified annotation is present.
- *
- * @param <A> The annotation type to look for.
- * @param annotationProvider The annotation provider.
- * @param type The annotation to look for.
- * @return <jk>true</jk> if the specified annotation is present.
- */
- public <A extends Annotation> boolean hasAnnotation(AnnotationProvider
annotationProvider, Class<A> type) {
- return nn(annotationProvider.find(type, f).map(x ->
x.inner()).filter(x -> true).findFirst().orElse(null));
+ public ClassInfo getFieldType() {
+ return type.get();
}
/**
@@ -247,29 +217,6 @@ public class FieldInfo extends AccessibleInfo implements
Comparable<FieldInfo>,
return f.getName().equals(name);
}
- /**
- * Returns <jk>true</jk> if the specified annotation is not present.
- *
- * @param <A> The annotation type to look for.
- * @param annotationProvider The annotation provider.
- * @param type The annotation to look for.
- * @return <jk>true</jk> if the specified annotation is not present.
- */
- public <A extends Annotation> boolean
hasNoAnnotation(AnnotationProvider annotationProvider, Class<A> type) {
- return ! hasAnnotation(annotationProvider, type);
- }
-
- /**
- * Returns <jk>true</jk> if the specified annotation is not present on
this field.
- *
- * @param <A> The annotation type to look for.
- * @param type The annotation to look for.
- * @return <jk>true</jk> if the specified annotation is not present on
this field.
- */
- public <A extends Annotation> boolean hasNoAnnotation(Class<A> type) {
- return ! hasAnnotation(type);
- }
-
/**
* Returns the wrapped field.
*
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
index 345b075327..202574193d 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
@@ -656,18 +656,6 @@ public class MethodInfo extends ExecutableInfo implements
Comparable<MethodInfo>
return ! hasAnnotation(annotationProvider, type);
}
- /**
- * Returns <jk>true</jk> if the specified annotation is not present on
this method or any matching methods in parent classes/interfaces.
- *
- * @param <A> The annotation type to look for.
- * @param type The annotation to look for.
- * @return <jk>true</jk> if the specified annotation is not present on
this method.
- */
- @Override
- public <A extends Annotation> boolean hasNoAnnotation(Class<A> type) {
- return !hasAnnotation(type);
- }
-
/**
* Returns <jk>true</jk> if this method has this return type.
*
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/ClassUtils.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/ClassUtils.java
index 4c8a6058c3..310a15e5ef 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/ClassUtils.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/ClassUtils.java
@@ -429,7 +429,7 @@ public class ClassUtils {
if (s.contains("$$EnhancerBySpringCGLIB$$")) {
// Try to invoke getTargetClass() if available (Spring
specific)
Value<Class<?>> v = Value.empty();
- ClassInfo.of(c).getPublicMethods().stream().filter(m ->
m.hasName("getTargetClass") && m.hasNoParameters() &&
m.hasReturnType(Class.class)).forEach(m -> safe(() -> v.set(m.invoke(o))));
+ ClassInfo.of(c).getPublicMethods().stream().filter(m ->
m.hasName("getTargetClass") && m.getParameterCount() == 0 &&
m.hasReturnType(Class.class)).forEach(m -> safe(() -> v.set(m.invoke(o))));
return v.isPresent() ? v.get() : c.getSuperclass();
}
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 e9cb5c93d8..5b6d5da3ba 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
@@ -568,10 +568,10 @@ public class BeanMeta<T> {
// @formatter:off
c2.getDeclaredFields().stream()
.filter(x -> x.isNotStatic()
- && (x.isNotTransient() || noIgnoreTransients)
- && (x.hasNoAnnotation(Transient.class) ||
noIgnoreTransients)
- && x.hasNoAnnotation(ctx.getAnnotationProvider(),
BeanIgnore.class)
- && (v.isVisible(x.inner()) ||
x.hasAnnotation(ctx.getAnnotationProvider(), Beanp.class)))
+ && (x.isNotTransient() || noIgnoreTransients)
+ && (! x.hasAnnotation(Transient.class) ||
noIgnoreTransients)
+ &&
ctx.getAnnotationProvider().find(BeanIgnore.class,
x.inner()).findAny().isEmpty()
+ && (v.isVisible(x.inner()) ||
ctx.getAnnotationProvider().find(Beanp.class, x.inner()).findAny().isPresent()))
.forEach(x -> l.add(x.inner())
);
// @formatter:on
@@ -704,10 +704,10 @@ public class BeanMeta<T> {
// @formatter:off
FieldInfo f = c2.getDeclaredField(
x -> x.isNotStatic()
- && (x.isNotTransient() || noIgnoreTransients)
- && (x.hasNoAnnotation(Transient.class) ||
noIgnoreTransients)
- && x.hasNoAnnotation(ctx.getAnnotationProvider(),
BeanIgnore.class)
- && x.hasName(name)
+ && (x.isNotTransient() || noIgnoreTransients)
+ && (! x.hasAnnotation(Transient.class) ||
noIgnoreTransients)
+ &&
ctx.getAnnotationProvider().find(BeanIgnore.class,
x.inner()).findAny().isEmpty()
+ && x.hasName(name)
);
// @formatter:on
if (nn(f))
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 202c0fc9b3..7b356dbeca 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
@@ -75,10 +75,10 @@ public class BeanProxyInvocationHandler<T> implements
InvocationHandler {
return this.beanProps.equals(bean);
}
- if (mi.hasName("hashCode") && mi.hasNoParameters())
+ if (mi.hasName("hashCode") && mi.getParameterCount() == 0)
return Integer.valueOf(this.beanProps.hashCode());
- if (mi.hasName("toString") && mi.hasNoParameters())
+ if (mi.hasName("toString") && mi.getParameterCount() == 0)
return Json5Serializer.DEFAULT.toString(this.beanProps);
String prop = this.meta.getterProps.get(method);
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 0cda1d3e3f..a6321aabe4 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
@@ -206,20 +206,20 @@ public class ClassMeta<T> implements Type {
.orElse(null);
// @formatter:on
- ci.getAllFields().stream().filter(x ->
x.hasAnnotation(bc.getAnnotationProvider(), ParentProperty.class)).forEach(x ->
{
+ ci.getAllFields().stream().filter(x ->
bc.getAnnotationProvider().find(ParentProperty.class,
x.inner()).findAny().isPresent()).forEach(x -> {
if (x.isStatic())
throw new ClassMetaRuntimeException(c,
"@ParentProperty used on invalid field ''{0}''. Must be static.", x);
parentPropertyMethod = new
Setter.FieldSetter(x.accessible().inner());
});
- ci.getAllFields().stream().filter(x ->
x.hasAnnotation(bc.getAnnotationProvider(), NameProperty.class)).forEach(x -> {
+ ci.getAllFields().stream().filter(x ->
bc.getAnnotationProvider().find(NameProperty.class,
x.inner()).findAny().isPresent()).forEach(x -> {
if (x.isStatic())
throw new ClassMetaRuntimeException(c,
"@NameProperty used on invalid field ''{0}''. Must be static.", x);
namePropertyMethod = new
Setter.FieldSetter(x.accessible().inner());
});
- ci.getDeclaredFields().stream().filter(x ->
x.hasAnnotation(bc.getAnnotationProvider(), Example.class)).forEach(x -> {
- if (! (x.isStatic() &&
ci.isParentOf(x.getType().inner())))
+ ci.getDeclaredFields().stream().filter(x ->
bc.getAnnotationProvider().find(Example.class,
x.inner()).findAny().isPresent()).forEach(x -> {
+ if (! (x.isStatic() &&
ci.isParentOf(x.getFieldType().inner())))
throw new ClassMetaRuntimeException(c,
"@Example used on invalid field ''{0}''. Must be static and an instance of the
type.", x);
exampleField = x.accessible().inner();
});
@@ -296,7 +296,7 @@ public class ClassMeta<T> implements Type {
if (innerClass != Object.class) {
ClassInfo x = implClass == null ? ci :
ClassInfo.of(implClass);
- noArgConstructor =
x.getPublicConstructor(ConstructorInfo::hasNoParameters);
+ noArgConstructor = x.getPublicConstructor(cons
-> cons.getParameterCount() == 0);
}
try {
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
index 4c390354a9..3f26b25d09 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
@@ -148,7 +148,7 @@ public class BeanCreateMethodFinder<T> {
method = ClassInfo.of(resourceClass).getPublicMethod(
x -> x.isNotDeprecated()
&& x.hasReturnType(beanType)
- && x.hasNoAnnotation(BeanIgnore.class)
+ && ! x.hasAnnotation(BeanIgnore.class)
&& filter.test(x)
&& beanStore.hasAllParams(x)
&& (x.isStatic() || nn(resource))
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
index 1fa4c03f03..e5be46b5d2 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
@@ -255,7 +255,7 @@ public class BeanCreator<T> {
&& x.hasNumParameters(1)
&& x.getParameter(0).canAccept(builder)
&& x.hasReturnType(type)
- && x.hasNoAnnotation(BeanIgnore.class)
+ && ! x.hasAnnotation(BeanIgnore.class)
&& x.hasName("getInstance")
);
// @formatter:on
@@ -269,9 +269,9 @@ public class BeanCreator<T> {
MethodInfo m = type.getPublicMethod(
x -> x.isStatic()
&& x.isNotDeprecated()
- && x.hasNoParameters()
+ && x.getParameterCount() == 0
&& x.hasReturnType(type)
- && x.hasNoAnnotation(BeanIgnore.class)
+ && ! x.hasAnnotation(BeanIgnore.class)
&& x.hasName("getInstance")
);
// @formatter:on
@@ -423,7 +423,7 @@ public class BeanCreator<T> {
return m.isStatic()
&& m.isNotDeprecated()
&& m.hasReturnType(type)
- && m.hasNoAnnotation(BeanIgnore.class)
+ && ! m.hasAnnotation(BeanIgnore.class)
&& (m.hasName("create") || m.hasName("builder"));
// @formatter:on
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java
index 984c6f524a..475a12b022 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java
@@ -118,7 +118,7 @@ public class BeanStore {
// @formatter:off
MethodInfo m = c.getDeclaredMethod(
x -> x.isPublic()
- && x.hasNoParameters()
+ && x.getParameterCount() == 0
&& x.isStatic()
&& x.hasName("getInstance")
);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java
index 97ec86f252..c2f98ccaaf 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/RequestBeanMeta.java
@@ -108,7 +108,7 @@ public class RequestBeanMeta {
*/
public static RequestBeanMeta create(Class<?> c, AnnotationWorkList
annotations) {
var ci = ClassInfo.of(c);
- if (ci.hasNoAnnotation(Request.class))
+ if (! ci.hasAnnotation(Request.class))
return null;
return new
RequestBeanMeta.Builder(annotations).apply(c).build();
}
@@ -121,7 +121,7 @@ public class RequestBeanMeta {
* @return Metadata about the parameter, or <jk>null</jk> if parameter
or parameter type not annotated with {@link Request}.
*/
public static RequestBeanMeta create(ParameterInfo mpi,
AnnotationWorkList annotations) {
- if (mpi.hasNoAnnotation(Request.class))
+ if (! mpi.hasAnnotation(Request.class))
return null;
return new
RequestBeanMeta.Builder(annotations).apply(mpi).build();
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
index 0dc372e62a..7b5eee1c1a 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
@@ -93,7 +93,7 @@ public class ResponseBeanMeta {
assertReturnType(x, Header.class,
int.class, Integer.class);
statusMethod =
ResponseBeanPropertyMeta.create(RESPONSE_STATUS, x);
} else if (x.hasAnnotation(Content.class)) {
- if (x.hasNoParameters())
+ if (x.getParameterCount() == 0)
assertReturnNotVoid(x,
Header.class);
else
assertArgType(x, Header.class,
OutputStream.class, Writer.class);
@@ -138,7 +138,7 @@ public class ResponseBeanMeta {
* @return Metadata about the class, or <jk>null</jk> if class not
annotated with {@link Response}.
*/
public static ResponseBeanMeta create(ParameterInfo mpi,
AnnotationWorkList annotations) {
- if (mpi.hasNoAnnotation(Response.class))
+ if (! mpi.hasAnnotation(Response.class))
return null;
var b = new Builder(annotations);
b.apply(mpi.getParameterType().unwrap(Value.class,
Optional.class).innerType());
@@ -156,7 +156,7 @@ public class ResponseBeanMeta {
*/
public static ResponseBeanMeta create(Type t, AnnotationWorkList
annotations) {
var ci = ClassInfo.of(t).unwrap(Value.class, Optional.class);
- if (ci.hasNoAnnotation(Response.class))
+ if (! ci.hasAnnotation(Response.class))
return null;
var b = new Builder(annotations);
b.apply(ci.innerType());
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
index 568ff58244..5001ae535d 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
@@ -388,7 +388,7 @@ public class ParserSet {
if (o instanceof Class) {
// Check for no-arg constructor.
- ConstructorInfo ci =
ClassInfo.of((Class<?>)o).getPublicConstructor(ConstructorInfo::hasNoParameters);
+ ConstructorInfo ci =
ClassInfo.of((Class<?>)o).getPublicConstructor(c -> c.getParameterCount() == 0);
if (nn(ci))
return ci.newInstance();
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
index 06acc6d0e0..f00046fd6f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
@@ -309,7 +309,7 @@ public class Mutaters {
// @formatter:off
return ic.getPublicMethod(
x -> x.isNotStatic()
- && x.hasNoParameters()
+ && x.getParameterCount() == 0
&& x.getSimpleName().startsWith("to")
&& x.getSimpleName().substring(2).equalsIgnoreCase(tn)
);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
index 7f3217ed7a..8cba57202d 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
@@ -384,7 +384,7 @@ public class SerializerSet {
if (o instanceof Class) {
// Check for no-arg constructor.
- ConstructorInfo ci =
ClassInfo.of((Class<?>)o).getPublicConstructor(ConstructorInfo::hasNoParameters);
+ ConstructorInfo ci =
ClassInfo.of((Class<?>)o).getPublicConstructor(c -> c.getParameterCount() == 0);
if (nn(ci))
return ci.newInstance();
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
index f0065c2395..511e2d0cf4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
@@ -267,7 +267,7 @@ public class VarResolverSession {
if (! containsVars(c))
return o;
Set c2 = null;
- var ci =
ClassInfo.of(o).getDeclaredConstructor(x -> x.isPublic() &&
x.hasNoParameters());
+ var ci =
ClassInfo.of(o).getDeclaredConstructor(x -> x.isPublic() &&
x.getParameterCount() == 0);
if (ci != null) {
c2 = (Set)ci.inner().newInstance();
} else {
@@ -287,7 +287,7 @@ public class VarResolverSession {
if (! containsVars(c))
return o;
List c2 = null;
- var ci =
ClassInfo.of(o).getDeclaredConstructor(x -> x.isPublic() &&
x.hasNoParameters());
+ var ci =
ClassInfo.of(o).getDeclaredConstructor(x -> x.isPublic() &&
x.getParameterCount() == 0);
if (ci != null) {
c2 = (List)ci.inner().newInstance();
} else {
@@ -307,7 +307,7 @@ public class VarResolverSession {
if (! containsVars(m))
return o;
Map m2 = null;
- var ci =
ClassInfo.of(o).getDeclaredConstructor(x -> x.isPublic() &&
x.hasNoParameters());
+ var ci =
ClassInfo.of(o).getDeclaredConstructor(x -> x.isPublic() &&
x.getParameterCount() == 0);
if (ci != null) {
m2 = (Map)ci.inner().newInstance();
} else {
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
index 45732efb93..43602ff5d4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
@@ -133,7 +133,7 @@ public class AutoListSwap<T> extends ObjectSwap<T,List<?>> {
&& mi.hasAnyName(SWAP_METHOD_NAMES)
&& mi.hasReturnTypeParent(List.class)
&& mi.hasParameterTypesLenient(BeanSession.class)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && ! mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
@@ -156,7 +156,7 @@ public class AutoListSwap<T> extends ObjectSwap<T,List<?>> {
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
&& mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && ! mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
index c4898a0908..054bac6407 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
@@ -133,7 +133,7 @@ public class AutoMapSwap<T> extends ObjectSwap<T,Map<?,?>> {
&& mi.hasAnyName(SWAP_METHOD_NAMES)
&& mi.hasReturnTypeParent(Map.class)
&& mi.hasParameterTypesLenient(BeanSession.class)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && ! mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
@@ -156,7 +156,7 @@ public class AutoMapSwap<T> extends ObjectSwap<T,Map<?,?>> {
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
&& mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && !mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
index 684533fa0f..26befab376 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
@@ -158,7 +158,7 @@ public class AutoNumberSwap<T> extends ObjectSwap<T,Number>
{
&& (rt.isChildOf(Number.class) || (rt.isPrimitive() &&
rt.isAny(int.class, short.class, long.class, float.class, double.class,
byte.class)))
&& mi.hasAnyName(SWAP_METHOD_NAMES)
&& mi.hasParameterTypesLenient(BeanSession.class)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && ! mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
@@ -181,7 +181,7 @@ public class AutoNumberSwap<T> extends ObjectSwap<T,Number>
{
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
&& mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && ! mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
index 58afc73217..60ae9938a7 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
@@ -134,7 +134,7 @@ public class AutoObjectSwap<T> extends ObjectSwap<T,Object>
{
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(SWAP_METHOD_NAMES)
&& mi.hasParameterTypesLenient(BeanSession.class)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && ! mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
@@ -157,7 +157,7 @@ public class AutoObjectSwap<T> extends ObjectSwap<T,Object>
{
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
&& mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
- && mi.hasNoAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
+ && ! mi.hasAnnotation(bc.getAnnotationProvider(),
BeanIgnore.class);
// @formatter:on
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/BuilderSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/BuilderSwap.java
index 895b04150d..25fc1ea0a8 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/BuilderSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/BuilderSwap.java
@@ -144,7 +144,7 @@ public class BuilderSwap<T,B> {
// @formatter:off
return c.getDeclaredMethod(
x -> x.isNotStatic()
- && x.hasNoParameters()
+ && x.getParameterCount() == 0
&& (!x.hasReturnType(void.class))
&& x.hasName("build")
);
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
index c9471f0cbf..e465751880 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
@@ -270,7 +270,7 @@ public class ResponseContent implements HttpEntity {
// Some HTTP responses have no body, so
try to create these beans if they've got no-arg constructors.
if (t == null && !
type.is(String.class)) {
- ConstructorInfo c =
type.getInfo().getPublicConstructor(ConstructorInfo::hasNoParameters);
+ ConstructorInfo c =
type.getInfo().getPublicConstructor(cons -> cons.getParameterCount() == 0);
if (nn(c)) {
try {
return
c.<T>newInstance();
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
index bd45f89004..c62e44512a 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
@@ -1952,7 +1952,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
c = ci.getPublicConstructor(x
-> x.hasParameterTypes(String.class, Throwable.class));
if (nn(c))
throw
c.<Throwable>newInstance(nn(message) ? message :
response.getContent().asString(), null);
- c =
ci.getPublicConstructor(ConstructorInfo::hasNoParameters);
+ c =
ci.getPublicConstructor(cons -> cons.getParameterCount() == 0);
if (nn(c))
throw
c.<Throwable>newInstance();
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index 9d53837c98..839a31b2d1 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -1763,11 +1763,11 @@ public class RestContext extends Context {
// @formatter:off
rci.getAllFields().stream()
.filter(x -> x.hasAnnotation(RestInject.class))
- .forEach(x ->
x.getOptional(resource.get()).ifPresent(
+ .forEach(x ->
opt(x.get(resource.get())).ifPresent(
y -> beanStore.add(
- x.getType().inner(),
- y,
-
RestInjectAnnotation.name(x.getAnnotationInfo(RestInject.class).map(AnnotationInfo::inner).orElse(null))
+ x.getFieldType().inner(),
+ y,
+
RestInjectAnnotation.name(x.getAnnotationInfos(RestInject.class).findFirst().map(AnnotationInfo::inner).orElse(null))
)
));
// @formatter:on
@@ -1802,9 +1802,9 @@ public class RestContext extends Context {
.filter(x -> x.hasAnnotation(RestInject.class))
.forEach(x -> x.setIfNull(
resource.get(),
- beanStore.getBean(
- x.getType().inner(),
-
RestInjectAnnotation.name(x.getAnnotationInfo(RestInject.class).map(AnnotationInfo::inner).orElse(null))
+ beanStore.getBean(
+ x.getFieldType().inner(),
+
RestInjectAnnotation.name(x.getAnnotationInfos(RestInject.class).findFirst().map(AnnotationInfo::inner).orElse(null))
).orElse(null)
));
// @formatter:on
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
index df9e56c032..a3fd7dedb3 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
@@ -438,7 +438,7 @@ public class ClassInfo_Test extends TestBase {
}
@Test void getPublicNoArgConstructor() {
- check("E1()",
e1.getPublicConstructor(ConstructorInfo::hasNoParameters));
+ check("E1()", e1.getPublicConstructor(cons ->
cons.getParameterCount() == 0));
}
@Test void getConstructor() {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
index 92b2fdf48e..17dc5e003a 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
@@ -107,7 +107,7 @@ class ConstructorInfoTest extends TestBase {
}
static ClassInfo b = ClassInfo.of(B.class);
static ConstructorInfo
- b_c1 = b.getPublicConstructor(ConstructorInfo::hasNoParameters),
+ b_c1 = b.getPublicConstructor(cons -> cons.getParameterCount()
== 0),
b_c2 = b.getPublicConstructor(x ->
x.hasParameterTypes(String.class)),
b_c3 = b.getDeclaredConstructor(x ->
x.hasParameterTypes(int.class)),
b_c4 = b.getPublicConstructor(x ->
x.hasParameterTypes(String.class, String.class));
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
index c49bdbfacd..dee8dff8b6 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
@@ -74,12 +74,12 @@ class ExecutableInfo_Test extends TestBase {
static ClassInfo a = ClassInfo.of(A.class);
@Test void isConstructor() {
-
assertTrue(a.getPublicConstructor(ConstructorInfo::hasNoParameters).isConstructor());
+ assertTrue(a.getPublicConstructor(cons ->
cons.getParameterCount() == 0).isConstructor());
assertFalse(a.getPublicMethod(x ->
x.hasName("foo")).isConstructor());
}
@Test void getDeclaringClass() {
- check("A",
a.getPublicConstructor(ConstructorInfo::hasNoParameters).getDeclaringClass());
+ check("A", a.getPublicConstructor(cons ->
cons.getParameterCount() == 0).getDeclaringClass());
check("A", a.getPublicMethod(x ->
x.hasName("foo")).getDeclaringClass());
}
@@ -95,9 +95,9 @@ class ExecutableInfo_Test extends TestBase {
}
static ClassInfo b = ClassInfo.of(B.class);
static ExecutableInfo
- b_c1 = b.getPublicConstructor(ConstructorInfo::hasNoParameters),
+ b_c1 = b.getPublicConstructor(cons -> cons.getParameterCount()
== 0),
b_c2 = b.getPublicConstructor(x ->
x.hasParameterTypes(String.class)),
- b_m1 = b.getPublicMethod(x -> x.hasName("m") &&
x.hasNoParameters()),
+ b_m1 = b.getPublicMethod(x -> x.hasName("m") &&
x.getParameterCount() == 0),
b_m2 = b.getPublicMethod(x -> x.hasName("m") &&
x.hasParameterTypes(String.class))
;
@@ -116,10 +116,10 @@ class ExecutableInfo_Test extends TestBase {
}
@Test void hasNoParams() {
- assertEquals(true, b_c1.hasNoParameters());
- assertEquals(false, b_c2.hasNoParameters());
- assertEquals(true, b_m1.hasNoParameters());
- assertEquals(false, b_m2.hasNoParameters());
+ assertEquals(true, b_c1.getParameterCount() == 0);
+ assertEquals(false, b_c2.getParameterCount() == 0);
+ assertEquals(true, b_m1.getParameterCount() == 0);
+ assertEquals(false, b_m2.getParameterCount() == 0);
}
@Test void hasNumParams() {
@@ -160,7 +160,7 @@ class ExecutableInfo_Test extends TestBase {
@Test void getParam_indexOutOfBounds_noCache() {
var b2 = ClassInfo.of(B.class);
- assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '0'. No parameters.",
()->b2.getPublicConstructor(ConstructorInfo::hasNoParameters).getParameter(0));
+ assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '0'. No parameters.", ()->b2.getPublicConstructor(cons ->
cons.getParameterCount() == 0).getParameter(0));
assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '-1'. Parameter count: 1", ()->b2.getPublicConstructor(x ->
x.hasParameterTypes(String.class)).getParameter(-1));
assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '1'. Parameter count: 1", ()->b2.getPublicConstructor(x ->
x.hasParameterTypes(String.class)).getParameter(1));
}
@@ -248,12 +248,12 @@ class ExecutableInfo_Test extends TestBase {
}
static ClassInfo c = ClassInfo.of(C.class);
static ConstructorInfo
- c_c1=c.getPublicConstructor(ConstructorInfo::hasNoParameters),
+ c_c1=c.getPublicConstructor(cons -> cons.getParameterCount() ==
0),
c_c2=c.getPublicConstructor(x ->
x.hasParameterTypes(String.class)),
c_c3=c.getPublicConstructor(x -> x.hasParameterTypes(int.class))
;
static MethodInfo
- c_m1=c.getPublicMethod(x -> x.hasName("m") &&
x.hasNoParameters()),
+ c_m1=c.getPublicMethod(x -> x.hasName("m") &&
x.getParameterCount() == 0),
c_m2=c.getPublicMethod(x -> x.hasName("m") &&
x.hasParameterTypes(String.class)),
c_m3=c.getPublicMethod(x -> x.hasName("m") &&
x.hasParameterTypes(int.class))
;
@@ -292,7 +292,7 @@ class ExecutableInfo_Test extends TestBase {
}
static ClassInfo d = ClassInfo.of(D.class);
static ExecutableInfo
- d_c=d.getPublicConstructor(ConstructorInfo::hasNoParameters),
+ d_c=d.getPublicConstructor(cons -> cons.getParameterCount() ==
0),
d_m=d.getPublicMethod(x -> x.hasName("m"))
;
@@ -499,37 +499,37 @@ class ExecutableInfo_Test extends TestBase {
static ClassInfo x2 = ClassInfo.of(X.class);
@Test void getFullName_method() {
-
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X.foo()",
x2.getPublicMethod(x -> x.hasName("foo") && x.hasNoParameters()).getFullName());
+
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X.foo()",
x2.getPublicMethod(x -> x.hasName("foo") && x.getParameterCount() ==
0).getFullName());
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X.foo(java.lang.String)",
x2.getPublicMethod(x -> x.hasName("foo") &&
x.hasParameterTypes(String.class)).getFullName());
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X.foo(java.util.Map<java.lang.String,java.lang.Object>)",
x2.getPublicMethod(x -> x.hasName("foo") &&
x.hasParameterTypes(Map.class)).getFullName());
}
@Test void getFullName_constructor() {
-
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X()",
x2.getPublicConstructor(ConstructorInfo::hasNoParameters).getFullName());
+
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X()",
x2.getPublicConstructor(cons -> cons.getParameterCount() == 0).getFullName());
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X(java.lang.String)",
x2.getPublicConstructor(x -> x.hasParameterTypes(String.class)).getFullName());
assertEquals("org.apache.juneau.common.reflect.ExecutableInfo_Test$X(java.util.Map<java.lang.String,java.lang.Object>)",
x2.getPublicConstructor(x -> x.hasParameterTypes(Map.class)).getFullName());
}
@Test void getShortName_method() {
- assertEquals("foo()", x2.getPublicMethod(x -> x.hasName("foo")
&& x.hasNoParameters()).getShortName());
+ assertEquals("foo()", x2.getPublicMethod(x -> x.hasName("foo")
&& x.getParameterCount() == 0).getShortName());
assertEquals("foo(String)", x2.getPublicMethod(x ->
x.hasName("foo") && x.hasParameterTypes(String.class)).getShortName());
assertEquals("foo(Map)", x2.getPublicMethod(x ->
x.hasName("foo") && x.hasParameterTypes(Map.class)).getShortName());
}
@Test void getShortName_constructor() {
- assertEquals("X()",
x2.getPublicConstructor(ConstructorInfo::hasNoParameters).getShortName());
+ assertEquals("X()", x2.getPublicConstructor(cons ->
cons.getParameterCount() == 0).getShortName());
assertEquals("X(String)", x2.getPublicConstructor(x ->
x.hasParameterTypes(String.class)).getShortName());
assertEquals("X(Map)", x2.getPublicConstructor(x ->
x.hasParameterTypes(Map.class)).getShortName());
}
@Test void getSimpleName_method() {
- assertEquals("foo", x2.getPublicMethod(x -> x.hasName("foo") &&
x.hasNoParameters()).getSimpleName());
+ assertEquals("foo", x2.getPublicMethod(x -> x.hasName("foo") &&
x.getParameterCount() == 0).getSimpleName());
assertEquals("foo", x2.getPublicMethod(x -> x.hasName("foo") &&
x.hasParameterTypes(String.class)).getSimpleName());
assertEquals("foo", x2.getPublicMethod(x -> x.hasName("foo") &&
x.hasParameterTypes(Map.class)).getSimpleName());
}
@Test void getSimpleName_constructor() {
- assertEquals("X",
x2.getPublicConstructor(ConstructorInfo::hasNoParameters).getSimpleName());
+ assertEquals("X", x2.getPublicConstructor(cons ->
cons.getParameterCount() == 0).getSimpleName());
assertEquals("X", x2.getPublicConstructor(x ->
x.hasParameterTypes(String.class)).getSimpleName());
assertEquals("X", x2.getPublicConstructor(x ->
x.hasParameterTypes(Map.class)).getSimpleName());
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/FieldInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/FieldInfo_Test.java
index 4b7a0586fc..dcfc4586b5 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/FieldInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/FieldInfo_Test.java
@@ -289,13 +289,13 @@ class FieldInfo_Test extends TestBase {
e_a2 = e.getDeclaredField(x -> x.hasName("a2"));
@Test void getType() {
- check("int", e_a1.getType());
- check("int", e_a2.getType());
+ check("int", e_a1.getFieldType());
+ check("int", e_a2.getFieldType());
}
@Test void getType_twice() {
- check("int", e_a1.getType());
- check("int", e_a1.getType());
+ check("int", e_a1.getFieldType());
+ check("int", e_a1.getFieldType());
}
@Test void toString2() {