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 4251d473b5 Utility class modernization
4251d473b5 is described below
commit 4251d473b538e299413c4e8646613e640a730efb
Author: James Bognar <[email protected]>
AuthorDate: Mon Nov 3 16:18:33 2025 -0500
Utility class modernization
---
.../juneau/common/reflect/ConstructorInfo.java | 4 +-
.../juneau/common/reflect/ExecutableInfo.java | 57 +++++------
.../apache/juneau/common/reflect/MethodInfo.java | 2 +-
.../juneau/common/reflect/ParameterInfo.java | 110 ++++++++++++---------
.../src/main/java/org/apache/juneau/BeanMeta.java | 6 +-
.../src/main/java/org/apache/juneau/Context.java | 6 +-
.../java/org/apache/juneau/cp/BeanCreator.java | 8 +-
.../main/java/org/apache/juneau/cp/BeanStore.java | 12 +--
.../org/apache/juneau/swap/AutoNumberSwap.java | 4 +-
.../rest/client/remote/RemoteOperationMeta.java | 2 +-
.../java/org/apache/juneau/rest/RestContext.java | 2 +-
.../java/org/apache/juneau/rest/RestOpInvoker.java | 2 +-
.../java/org/apache/juneau/rest/arg/PathArg.java | 2 +-
.../rest/swagger/BasicSwaggerProviderSession.java | 4 +-
.../juneau/common/reflect/ExecutableInfo_Test.java | 40 ++++----
.../juneau/common/reflect/ParamInfoTest.java | 30 +++---
.../juneau/httppart/HttpPartSchema_Body_Test.java | 4 +-
.../httppart/HttpPartSchema_FormData_Test.java | 4 +-
.../httppart/HttpPartSchema_Header_Test.java | 4 +-
.../juneau/httppart/HttpPartSchema_Path_Test.java | 4 +-
.../juneau/httppart/HttpPartSchema_Query_Test.java | 4 +-
.../HttpPartSchema_ResponseHeader_Test.java | 4 +-
.../org/apache/juneau/reflect/ParamInfoTest.java | 30 +++---
.../apache/juneau/rest/arg/ArgException_Test.java | 2 +-
24 files changed, 185 insertions(+), 162 deletions(-)
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
index 227a087e52..249afbf103 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
@@ -127,9 +127,9 @@ public class ConstructorInfo extends ExecutableInfo
implements Comparable<Constr
public int compareTo(ConstructorInfo o) {
int i = getSimpleName().compareTo(o.getSimpleName());
if (i == 0) {
- i = getParamCount() - o.getParamCount();
+ i = getParameterCount() - o.getParameterCount();
if (i == 0) {
- for (int j = 0; j < getParamCount() && i == 0;
j++) {
+ for (int j = 0; j < getParameterCount() && i ==
0; j++) {
Class<?>[] tpt = _getRawParamTypes(),
opt = o._getRawParamTypes();
i =
tpt[j].getName().compareTo(opt[j].getName());
}
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 d621fc5582..def5d8a8e6 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
@@ -26,6 +26,7 @@ import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
import java.util.function.*;
+import java.util.stream.*;
/**
* Contains common methods between {@link ConstructorInfo} and {@link
MethodInfo}.
@@ -42,13 +43,14 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
Executable e; // Effectively final.
final boolean isConstructor;
- private volatile ParameterInfo[] params;
+ private final Supplier<List<ParameterInfo>> parameters =
memoize(this::findParameters);
+
private volatile ClassInfo[] paramTypes, exceptionInfos;
private volatile Class<?>[] rawParamTypes;
private volatile Type[] rawGenericParamTypes;
private volatile Parameter[] rawParameters;
- private volatile Annotation[][] parameterAnnotations;
- private volatile Annotation[] declaredAnnotations;
+ private volatile Annotation[][] rawParameterAnnotations;
+ private volatile Annotation[] rawDeclaredAnnotations;
/**
* Returns a predicate that evaluates to true only when the value is an
instance of the given type and the provided
@@ -244,7 +246,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
* @param index The parameter index.
* @return The parameter information, never <jk>null</jk>.
*/
- public final ParameterInfo getParam(int index) {
+ public final ParameterInfo getParameter(int index) {
checkIndex(index);
return _getParams()[index];
}
@@ -257,7 +259,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
*
* @return The number of parameters in this executable.
*/
- public final int getParamCount() { return e.getParameterCount(); }
+ public final int getParameterCount() { return e.getParameterCount(); }
/**
* Returns the parameters defined on this executable.
@@ -267,7 +269,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
*
* @return An array of parameter information, never <jk>null</jk>.
*/
- public final List<ParameterInfo> getParams() { return
u(l(_getParams())); }
+ public final List<ParameterInfo> getParameters() { return
parameters.get(); }
/**
* Returns the parameter type of the parameter at the specified index.
@@ -478,7 +480,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
* @return <jk>true</jk> if this executable has no parameters.
*/
public final boolean hasNoParams() {
- return getParamCount() == 0;
+ return getParameterCount() == 0;
}
/**
@@ -491,7 +493,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
* @return <jk>true</jk> if this executable has this number of
arguments.
*/
public final boolean hasNumParams(int number) {
- return getParamCount() == number;
+ return getParameterCount() == number;
}
/**
@@ -503,7 +505,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
* @return <jk>true</jk> if this executable has at least one parameter.
*/
public final boolean hasParams() {
- return getParamCount() != 0;
+ return getParameterCount() != 0;
}
/**
@@ -1012,7 +1014,7 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
}
private void checkIndex(int index) {
- int pc = getParamCount();
+ int pc = getParameterCount();
if (pc == 0)
throw new IndexOutOfBoundsException(format("Invalid
index ''{0}''. No parameters.", index));
if (index < 0 || index >= pc)
@@ -1020,12 +1022,12 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
}
final Annotation[] _getDeclaredAnnotations() {
- if (declaredAnnotations == null) {
+ if (rawDeclaredAnnotations == null) {
synchronized (this) {
- declaredAnnotations =
e.getDeclaredAnnotations();
+ rawDeclaredAnnotations =
e.getDeclaredAnnotations();
}
}
- return declaredAnnotations;
+ return rawDeclaredAnnotations;
}
final ClassInfo[] _getExceptionTypes() {
@@ -1042,12 +1044,12 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
}
final Annotation[][] _getParameterAnnotations() {
- if (parameterAnnotations == null) {
+ if (rawParameterAnnotations == null) {
synchronized (this) {
- parameterAnnotations =
e.getParameterAnnotations();
+ rawParameterAnnotations =
e.getParameterAnnotations();
}
}
- return parameterAnnotations;
+ return rawParameterAnnotations;
}
final Annotation[] _getParameterAnnotations(int index) {
@@ -1070,10 +1072,10 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
final ClassInfo[] _getParameterTypes() {
if (paramTypes == null) {
synchronized (this) {
- Class<?>[] ptc = _getRawParamTypes();
+ Class<?>[] ptc = e.getParameterTypes();
// Note that due to a bug involving Enum
constructors, getGenericParameterTypes() may
// always return an empty array. This appears
to be fixed in Java 8 b75.
- Type[] ptt = _getRawGenericParamTypes();
+ Type[] ptt = e.getGenericParameterTypes();
if (ptt.length != ptc.length) {
// Bug in javac: generic type array
excludes enclosing instance parameter
// for inner classes with at least one
generic constructor parameter.
@@ -1096,17 +1098,16 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
return paramTypes;
}
+ private List<ParameterInfo> findParameters() {
+ var rp = e.getParameters();
+ var types = _getParameterTypes();
+ return IntStream.range(0, rp.length)
+ .mapToObj(i -> new ParameterInfo(this, rp[i], i,
types[i]))
+ .toList();
+ }
+
final ParameterInfo[] _getParams() {
- if (params == null) {
- synchronized (this) {
- Parameter[] rp = _getRawParameters();
- ParameterInfo[] l = new
ParameterInfo[rp.length];
- for (int i = 0; i < rp.length; i++)
- l[i] = new ParameterInfo(this, rp[i],
i);
- params = l;
- }
- }
- return params;
+ return parameters.get().toArray(new ParameterInfo[0]);
}
final Type[] _getRawGenericParamTypes() {
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 362ffe3644..b9a3287e2c 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
@@ -445,7 +445,7 @@ public class MethodInfo extends ExecutableInfo implements
Comparable<MethodInfo>
Class<?>[] pt = _getRawParamTypes();
if (pt.length > 0) {
sb.append('(');
- List<ParameterInfo> mpi = getParams();
+ List<ParameterInfo> mpi = getParameters();
for (int i = 0; i < pt.length; i++) {
if (i > 0)
sb.append(',');
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
index ddb6a64688..7a16d042b2 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ParameterInfo.java
@@ -17,6 +17,7 @@
package org.apache.juneau.common.reflect;
+import static org.apache.juneau.common.utils.CollectionUtils.*;
import static org.apache.juneau.common.utils.PredicateUtils.*;
import static org.apache.juneau.common.utils.Utils.*;
@@ -35,27 +36,36 @@ import org.apache.juneau.common.collections.*;
*/
public class ParameterInfo implements Annotatable {
- private final ExecutableInfo eInfo;
- private final Parameter p;
+ private final ExecutableInfo executable;
+ private final Parameter parameter;
private final int index;
-
+ private final ClassInfo type;
+
@SuppressWarnings({"rawtypes", "unchecked"})
- private final Cache annotationCache =
+ private final Cache annotationCache =
Cache.of(Class.class, Optional.class)
.supplier(k -> opt(findAnnotation(k)))
.build();
+ private final Supplier<List<AnnotationInfo<Annotation>>> annotations =
memoize(this::findAnnotations);
+
/**
* Constructor.
*
* @param eInfo The constructor or method wrapper.
* @param p The parameter being wrapped.
* @param index The parameter index.
+ * @param type The parameter type.
*/
- protected ParameterInfo(ExecutableInfo eInfo, Parameter p, int index) {
- this.eInfo = eInfo;
- this.p = p;
+ protected ParameterInfo(ExecutableInfo eInfo, Parameter p, int index,
ClassInfo type) {
+ this.executable = eInfo;
+ this.parameter = p;
this.index = index;
+ this.type = type;
+ }
+
+ private List<AnnotationInfo<Annotation>> findAnnotations() {
+ return stream(parameter.getAnnotations()).map(a ->
AnnotationInfo.of(this, a)).toList();
}
/**
@@ -110,7 +120,7 @@ public class ParameterInfo implements Annotatable {
* @return This object.
*/
public <A extends Annotation> ParameterInfo
forEachDeclaredAnnotation(Class<A> type, Predicate<A> filter, Consumer<A>
action) {
- for (var a : eInfo._getParameterAnnotations(index))
+ for (var a : executable._getParameterAnnotations(index))
if (type.isInstance(a))
consumeIf(filter, action, type.cast(a));
return this;
@@ -153,17 +163,17 @@ public class ParameterInfo implements Annotatable {
*/
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<A> type,
Predicate<A> filter) {
- if (eInfo.isConstructor) {
- ClassInfo ci =
eInfo.getParamType(index).unwrap(Value.class, Optional.class);
+ if (executable.isConstructor) {
+ ClassInfo ci =
executable.getParamType(index).unwrap(Value.class, Optional.class);
A o = ci.getAnnotation(type, filter);
if (nn(o))
return o;
- for (var a2 : eInfo._getParameterAnnotations(index))
+ for (var a2 :
executable._getParameterAnnotations(index))
if (type.isInstance(a2) && test(filter,
type.cast(a2)))
return (A)a2;
} else {
- var mi = (MethodInfo)eInfo;
- ClassInfo ci =
eInfo.getParamType(index).unwrap(Value.class, Optional.class);
+ var mi = (MethodInfo)executable;
+ ClassInfo ci =
executable.getParamType(index).unwrap(Value.class, Optional.class);
A o = ci.getAnnotation(type, filter);
if (nn(o))
return o;
@@ -179,7 +189,7 @@ public class ParameterInfo implements Annotatable {
*
* @return The constructor that this parameter belongs to, or
<jk>null</jk> if it belongs to a method.
*/
- public ConstructorInfo getConstructor() { return eInfo.isConstructor()
? (ConstructorInfo)eInfo : null; }
+ public ConstructorInfo getConstructor() { return
executable.isConstructor() ? (ConstructorInfo)executable : null; }
/**
* Returns the specified parameter annotation declared on this
parameter.
@@ -190,7 +200,7 @@ public class ParameterInfo implements Annotatable {
*/
public <A extends Annotation> A getDeclaredAnnotation(Class<A> type) {
if (nn(type))
- for (var a : eInfo._getParameterAnnotations(index))
+ for (var a : executable._getParameterAnnotations(index))
if (type.isInstance(a))
return type.cast(a);
return null;
@@ -208,7 +218,7 @@ public class ParameterInfo implements Annotatable {
*
* @return The method that this parameter belongs to, or <jk>null</jk>
if it belongs to a constructor.
*/
- public MethodInfo getMethod() { return eInfo.isConstructor() ? null :
(MethodInfo)eInfo; }
+ public MethodInfo getMethod() { return executable.isConstructor() ?
null : (MethodInfo)executable; }
/**
* Helper method to extract the name from any annotation with the
simple name "Name".
@@ -222,7 +232,7 @@ public class ParameterInfo implements Annotatable {
* @return The name from the annotation, or <jk>null</jk> if no
compatible annotation is found.
*/
private String getNameFromAnnotation() {
- for (var annotation : p.getAnnotations()) {
+ for (var annotation : parameter.getAnnotations()) {
var annotationType = annotation.annotationType();
if ("Name".equals(annotationType.getSimpleName())) {
try {
@@ -259,17 +269,29 @@ public class ParameterInfo implements Annotatable {
String name = getNameFromAnnotation();
if (name != null)
return name;
- if (p.isNamePresent())
- return p.getName();
+ if (parameter.isNamePresent())
+ return parameter.getName();
return null;
}
+ /**
+ * Returns all annotations declared on this parameter.
+ *
+ * <p>
+ * Returns annotations directly declared on this parameter, wrapped as
{@link AnnotationInfo} objects.
+ *
+ * @return An unmodifiable list of annotations on this parameter, never
<jk>null</jk>.
+ */
+ public List<AnnotationInfo<Annotation>> getAnnotationInfos() {
+ return annotations.get();
+ }
+
/**
* Returns the class type of this parameter.
*
* @return The class type of this parameter.
*/
- public ClassInfo getParameterType() { return eInfo.getParamType(index);
}
+ public ClassInfo getParameterType() { return type; }
/**
* Returns <jk>true</jk> if this parameter has the specified annotation.
@@ -293,7 +315,7 @@ public class ParameterInfo implements Annotatable {
* @return <jk>true</jk> if the parameter has a name.
*/
public boolean hasName() {
- return getNameFromAnnotation() != null || p.isNamePresent();
+ return getNameFromAnnotation() != null ||
parameter.isNamePresent();
}
/**
@@ -352,7 +374,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#getDeclaringExecutable()
*/
public ExecutableInfo getDeclaringExecutable() {
- return eInfo;
+ return executable;
}
/**
@@ -377,7 +399,7 @@ public class ParameterInfo implements Annotatable {
* @see java.lang.reflect.Modifier
*/
public int getModifiers() {
- return p.getModifiers();
+ return parameter.getModifiers();
}
/**
@@ -404,7 +426,7 @@ public class ParameterInfo implements Annotatable {
* @see #hasName()
*/
public boolean isNamePresent() {
- return p.isNamePresent();
+ return parameter.isNamePresent();
}
/**
@@ -429,7 +451,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#isImplicit()
*/
public boolean isImplicit() {
- return p.isImplicit();
+ return parameter.isImplicit();
}
/**
@@ -451,7 +473,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#isSynthetic()
*/
public boolean isSynthetic() {
- return p.isSynthetic();
+ return parameter.isSynthetic();
}
/**
@@ -476,7 +498,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#isVarArgs()
*/
public boolean isVarArgs() {
- return p.isVarArgs();
+ return parameter.isVarArgs();
}
/**
@@ -500,7 +522,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#getParameterizedType()
*/
public Type getParameterizedType() {
- return p.getParameterizedType();
+ return parameter.getParameterizedType();
}
/**
@@ -521,7 +543,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#getAnnotatedType()
*/
public AnnotatedType getAnnotatedType() {
- return p.getAnnotatedType();
+ return parameter.getAnnotatedType();
}
/**
@@ -545,7 +567,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#getAnnotations()
*/
public Annotation[] getAnnotations() {
- return p.getAnnotations();
+ return parameter.getAnnotations();
}
/**
@@ -569,7 +591,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#getDeclaredAnnotations()
*/
public Annotation[] getDeclaredAnnotations() {
- return p.getDeclaredAnnotations();
+ return parameter.getDeclaredAnnotations();
}
//-----------------------------------------------------------------------------------------------------------------
@@ -598,7 +620,7 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#getAnnotationsByType(Class)
*/
public <A extends Annotation> A[] getAnnotationsByType(Class<A>
annotationClass) {
- return p.getAnnotationsByType(annotationClass);
+ return parameter.getAnnotationsByType(annotationClass);
}
/**
@@ -624,38 +646,38 @@ public class ParameterInfo implements Annotatable {
* @see Parameter#getDeclaredAnnotationsByType(Class)
*/
public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A>
annotationClass) {
- return p.getDeclaredAnnotationsByType(annotationClass);
+ return parameter.getDeclaredAnnotationsByType(annotationClass);
}
@Override
public String toString() {
- return (eInfo.getSimpleName()) + "[" + index + "]";
+ return (executable.getSimpleName()) + "[" + index + "]";
}
private <A extends Annotation> A findAnnotation(Class<A> type) {
- if (eInfo.isConstructor()) {
- for (var a2 : eInfo._getParameterAnnotations(index))
+ if (executable.isConstructor()) {
+ for (var a2 :
executable._getParameterAnnotations(index))
if (type.isInstance(a2))
return type.cast(a2);
- return eInfo.getParamType(index).unwrap(Value.class,
Optional.class).getAnnotation(type);
+ return
executable.getParamType(index).unwrap(Value.class,
Optional.class).getAnnotation(type);
}
- var mi = (MethodInfo)eInfo;
+ var mi = (MethodInfo)executable;
Value<A> v = Value.empty();
mi.forEachMatchingParentFirst(x -> true, x ->
x.forEachParameterAnnotation(index, type, y -> true, y -> v.set(y)));
- return v.orElseGet(() ->
eInfo.getParamType(index).unwrap(Value.class,
Optional.class).getAnnotation(type));
+ return v.orElseGet(() ->
executable.getParamType(index).unwrap(Value.class,
Optional.class).getAnnotation(type));
}
private <A extends Annotation> ParameterInfo
forEachAnnotation(AnnotationProvider ap, Class<A> a, Predicate<A> filter,
Consumer<A> action) {
- if (eInfo.isConstructor) {
- ClassInfo ci =
eInfo.getParamType(index).unwrap(Value.class, Optional.class);
- Annotation[] annotations =
eInfo._getParameterAnnotations(index);
+ if (executable.isConstructor) {
+ ClassInfo ci =
executable.getParamType(index).unwrap(Value.class, Optional.class);
+ Annotation[] annotations =
executable._getParameterAnnotations(index);
ci.forEachAnnotation(ap, a, filter, action);
for (var a2 : annotations)
if (a.isInstance(a2))
consumeIf(filter, action, a.cast(a2));
} else {
- var mi = (MethodInfo)eInfo;
- ClassInfo ci =
eInfo.getParamType(index).unwrap(Value.class, Optional.class);
+ var mi = (MethodInfo)executable;
+ ClassInfo ci =
executable.getParamType(index).unwrap(Value.class, Optional.class);
ci.forEachAnnotation(ap, a, filter, action);
mi.forEachMatchingParentFirst(x -> true, x ->
x.forEachParameterAnnotation(index, a, filter, action));
}
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 2970285776..23ec935d46 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
@@ -256,7 +256,7 @@ public class BeanMeta<T> {
if (!
x.hasNumParams(constructorArgs.length)) {
if (constructorArgs.length != 0)
throw new
BeanRuntimeException(c, "Number of properties defined in '@Beanc' annotation
does not match number of parameters in constructor.");
- constructorArgs = new
String[x.getParamCount()];
+ constructorArgs = new
String[x.getParameterCount()];
var i = IntegerValue.create();
x.forEachParam(null, pi -> {
String pn =
pi.getName();
@@ -279,7 +279,7 @@ public class BeanMeta<T> {
if (!
x.hasNumParams(constructorArgs.length)) {
if
(constructorArgs.length != 0)
throw new
BeanRuntimeException(c, "Number of properties defined in '@Beanc' annotation
does not match number of parameters in constructor.");
- constructorArgs = new
String[x.getParamCount()];
+ constructorArgs = new
String[x.getParameterCount()];
var i =
IntegerValue.create();
x.forEachParam(null, y
-> {
String pn =
y.getName();
@@ -592,7 +592,7 @@ public class BeanMeta<T> {
forEachClass(ClassInfo.of(c), stopClass, c2 -> {
for (var m : c2.getDeclaredMethods()) {
- if (m.isStatic() || m.isBridge() ||
m.getParamCount() > 2 || m.hasAnnotation(ctx, BeanIgnore.class))
+ if (m.isStatic() || m.isBridge() ||
m.getParameterCount() > 2 || m.hasAnnotation(ctx, BeanIgnore.class))
continue;
Transient t = m.getAnnotation(ctx,
Transient.class);
if (nn(t) && t.value())
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
index b3f3747b55..fe47a2f8ba 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
@@ -651,7 +651,7 @@ public abstract class Context implements AnnotationProvider
{
// @formatter:off
cci = ClassInfo.of(type).getPublicConstructor(
x -> x.hasNumParams(1)
- && x.getParam(0).canAccept(this)
+ && x.getParameter(0).canAccept(this)
);
// @formatter:on
if (cci == null)
@@ -730,13 +730,13 @@ public abstract class Context implements
AnnotationProvider {
if (mi == null) {
var c = ClassInfo.of(type);
for (var ci : c.getPublicConstructors()) {
- if (ci.matches(x -> x.hasNumParams(1)
&& ! x.getParam(0).getParameterType().is(type))) {
+ if (ci.matches(x -> x.hasNumParams(1)
&& ! x.getParameter(0).getParameterType().is(type))) {
// @formatter:off
mi = c.getPublicMethod(
x -> x.isStatic()
&& x.isNotDeprecated()
&& x.hasName("create")
- &&
x.hasReturnType(ci.getParam(0).getParameterType())
+ &&
x.hasReturnType(ci.getParameter(0).getParameterType())
);
// @formatter:on
if (nn(mi))
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 1938c78ea9..3782a6f758 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
@@ -122,8 +122,8 @@ public class BeanCreator<T> {
@SuppressWarnings("unchecked")
void add(T ei) {
- if (ei.getParamCount() > numMatches) {
- numMatches = ei.getParamCount();
+ if (ei.getParameterCount() > numMatches) {
+ numMatches = ei.getParameterCount();
executable = (T)ei.accessible();
}
}
@@ -253,7 +253,7 @@ public class BeanCreator<T> {
x -> x.isStatic()
&& x.isNotDeprecated()
&& x.hasNumParams(1)
- && x.getParam(0).canAccept(builder)
+ && x.getParameter(0).canAccept(builder)
&& x.hasReturnType(type)
&& x.hasNoAnnotation(BeanIgnore.class)
&& x.hasName("getInstance")
@@ -332,7 +332,7 @@ public class BeanCreator<T> {
// Look for static-builder/protected-constructor pair.
Value<T> value = Value.empty();
type.forEachDeclaredConstructor(x -> x.hasNumParams(1)
&& x.isVisible(PROTECTED), x -> {
- Class<?> pt =
x.getParam(0).getParameterType().inner();
+ Class<?> pt =
x.getParameter(0).getParameterType().inner();
MethodInfo m = type.getPublicMethod(y ->
isStaticCreateMethod(y, pt));
if (nn(m)) {
Object builder = m.invoke(null);
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 c939eae7af..a7f4bdbfb9 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
@@ -502,7 +502,7 @@ public class BeanStore {
* @return A comma-delimited list of types that are missing from this
factory, or <jk>null</jk> if none are missing.
*/
public String getMissingParams(ExecutableInfo executable) {
- List<ParameterInfo> params = executable.getParams();
+ List<ParameterInfo> params = executable.getParameters();
List<String> l = list();
loop: for (int i = 0; i < params.size(); i++) {
ParameterInfo pi = params.get(i);
@@ -528,9 +528,9 @@ public class BeanStore {
* @return The corresponding beans in this factory for the specified
param types.
*/
public Object[] getParams(ExecutableInfo executable) {
- Object[] o = new Object[executable.getParamCount()];
- for (int i = 0; i < executable.getParamCount(); i++) {
- ParameterInfo pi = executable.getParam(i);
+ Object[] o = new Object[executable.getParameterCount()];
+ for (int i = 0; i < executable.getParameterCount(); i++) {
+ ParameterInfo pi = executable.getParameter(i);
ClassInfo pt = pi.getParameterType();
if (i == 0 && outer.isPresent() &&
pt.isInstance(outer.get())) {
o[i] = outer.get();
@@ -553,8 +553,8 @@ public class BeanStore {
* @return A comma-delimited list of types that are missing from this
factory.
*/
public boolean hasAllParams(ExecutableInfo executable) {
- loop: for (int i = 0; i < executable.getParamCount(); i++) {
- ParameterInfo pi = executable.getParam(i);
+ loop: for (int i = 0; i < executable.getParameterCount(); i++) {
+ ParameterInfo pi = executable.getParameter(i);
ClassInfo pt = pi.getParameterType();
if (i == 0 && outer.isPresent() &&
pt.isInstance(outer.get()))
continue loop;
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 1d643de825..d104ae1b24 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
@@ -210,11 +210,11 @@ public class AutoNumberSwap<T> extends
ObjectSwap<T,Number> {
Class<?> unswapType = null;
if (nn(unswapMethod)) {
- for (var pi : unswapMethod.getParams())
+ for (var pi : unswapMethod.getParameters())
if (!
pi.getParameterType().is(BeanSession.class))
unswapType =
pi.getParameterType().getWrapperIfPrimitive();
} else if (nn(unswapConstructor)) {
- for (var pi : unswapConstructor.getParams())
+ for (var pi : unswapConstructor.getParameters())
if (!
pi.getParameterType().is(BeanSession.class))
unswapType =
pi.getParameterType().getWrapperIfPrimitive();
}
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
index 93e209d293..e7f509961f 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
@@ -108,7 +108,7 @@ public class RemoteOperationMeta {
fullPath = path.indexOf("://") != -1 ? path :
(parentPath.isEmpty() ? urlEncodePath(path) : (trimSlashes(parentPath) + '/' +
urlEncodePath(path)));
- mi.getParams().forEach(x -> {
+ mi.getParameters().forEach(x -> {
var rma = RemoteOperationArg.create(x);
if (nn(rma)) {
HttpPartType pt = rma.getPartType();
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 ae21cc3c83..8e9b220007 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
@@ -5913,7 +5913,7 @@ public class RestContext extends Context {
beanStore = BeanStore.of(beanStore, getResource());
for (int i = 0; i < pt.size(); i++) {
- ParameterInfo pi = mi.getParam(i);
+ ParameterInfo pi = mi.getParameter(i);
beanStore.addBean(ParameterInfo.class, pi);
for (var c : restOpArgs) {
try {
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpInvoker.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpInvoker.java
index 1e359eb6af..191b869d64 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpInvoker.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpInvoker.java
@@ -57,7 +57,7 @@ public class RestOpInvoker extends MethodInvoker {
public void invoke(RestOpSession opSession) throws Throwable {
var args = new Object[opArgs.length];
for (int i = 0; i < opArgs.length; i++) {
- ParameterInfo pi = inner().getParam(i);
+ ParameterInfo pi = inner().getParameter(i);
try {
args[i] = opArgs[i].resolve(opSession);
} catch (BasicHttpException e) {
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java
index e8b86addce..5732a8d3b3 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java
@@ -201,7 +201,7 @@ public class PathArg implements RestOpArg {
MethodInfo mi = pi.getMethod();
for (int j = 0; j < i; j++)
- if
(nn(mi.getParam(i).getAnnotation(Path.class)))
+ if
(nn(mi.getParameter(i).getAnnotation(Path.class)))
idx++;
String[] vars = pathMatcher.getVars();
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
index 58d2a41717..c32fe9b182 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
@@ -374,7 +374,7 @@ public class BasicSwaggerProviderSession {
paramMap.put(param.getString("in") +
'.' + ("body".equals(param.getString("in")) ? "body" :
param.getString("name")), param);
// Finally, look for parameters defined on method.
- for (var mpi : mi.getParams()) {
+ for (var mpi : mi.getParameters()) {
ClassInfo pt = mpi.getParameterType();
Type type = pt.innerType();
@@ -510,7 +510,7 @@ public class BasicSwaggerProviderSession {
}
// Finally, look for Value @Header parameters defined
on method.
- for (var mpi : mi.getParams()) {
+ for (var mpi : mi.getParameters()) {
ClassInfo pt = mpi.getParameterType();
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 da935e821a..9f016d49b8 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
@@ -100,10 +100,10 @@ class ExecutableInfo_Test extends TestBase {
;
@Test void getParamCount() {
- assertEquals(0, b_c1.getParamCount());
- assertEquals(1, b_c2.getParamCount());
- assertEquals(0, b_m1.getParamCount());
- assertEquals(1, b_m2.getParamCount());
+ assertEquals(0, b_c1.getParameterCount());
+ assertEquals(1, b_c2.getParameterCount());
+ assertEquals(0, b_m1.getParameterCount());
+ assertEquals(1, b_m2.getParameterCount());
}
@Test void hasParams() {
@@ -128,39 +128,39 @@ class ExecutableInfo_Test extends TestBase {
}
@Test void getParams() {
- check("", b_c1.getParams());
- check("B[0]", b_c2.getParams());
- check("", b_m1.getParams());
- check("m[0]", b_m2.getParams());
+ check("", b_c1.getParameters());
+ check("B[0]", b_c2.getParameters());
+ check("", b_m1.getParameters());
+ check("m[0]", b_m2.getParameters());
}
@Test void getParams_twice() {
- check("", b_c1.getParams());
- check("", b_c1.getParams());
+ check("", b_c1.getParameters());
+ check("", b_c1.getParameters());
}
@Test void getParam() {
- check("B[0]", b_c2.getParam(0));
- check("m[0]", b_m2.getParam(0));
+ check("B[0]", b_c2.getParameter(0));
+ check("m[0]", b_m2.getParameter(0));
}
@Test void getParam_nocache() {
var b2 = ClassInfo.of(B.class);
- check("B[0]", b2.getPublicConstructor(x ->
x.hasParamTypes(String.class)).getParam(0));
- check("m[0]", b2.getPublicMethod(x -> x.hasName("m") &&
x.hasParamTypes(String.class)).getParam(0));
+ check("B[0]", b2.getPublicConstructor(x ->
x.hasParamTypes(String.class)).getParameter(0));
+ check("m[0]", b2.getPublicMethod(x -> x.hasName("m") &&
x.hasParamTypes(String.class)).getParameter(0));
}
@Test void getParam_indexOutOfBounds() {
- assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '0'. No parameters.", ()->b_c1.getParam(0));
- assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '-1'. Parameter count: 1", ()->b_c2.getParam(-1));
- assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '1'. Parameter count: 1", ()->b_c2.getParam(1));
+ assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '0'. No parameters.", ()->b_c1.getParameter(0));
+ assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '-1'. Parameter count: 1", ()->b_c2.getParameter(-1));
+ assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '1'. Parameter count: 1", ()->b_c2.getParameter(1));
}
@Test void getParam_indexOutOfBounds_noCache() {
var b2 = ClassInfo.of(B.class);
- assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '0'. No parameters.",
()->b2.getPublicConstructor(ConstructorInfo::hasNoParams).getParam(0));
- assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '-1'. Parameter count: 1", ()->b2.getPublicConstructor(x ->
x.hasParamTypes(String.class)).getParam(-1));
- assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '1'. Parameter count: 1", ()->b2.getPublicConstructor(x ->
x.hasParamTypes(String.class)).getParam(1));
+ assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '0'. No parameters.",
()->b2.getPublicConstructor(ConstructorInfo::hasNoParams).getParameter(0));
+ assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '-1'. Parameter count: 1", ()->b2.getPublicConstructor(x ->
x.hasParamTypes(String.class)).getParameter(-1));
+ assertThrowsWithMessage(IndexOutOfBoundsException.class,
"Invalid index '1'. Parameter count: 1", ()->b2.getPublicConstructor(x ->
x.hasParamTypes(String.class)).getParameter(1));
}
@Test void getParamTypes() {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ParamInfoTest.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ParamInfoTest.java
index 1a8ab045d5..1c5c14071d 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ParamInfoTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ParamInfoTest.java
@@ -89,12 +89,12 @@ class ParamInfoTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
static ParameterInfo
- b_b_a = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParam(0), // NOSONAR
- b_b_b = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParam(1), // NOSONAR
- b_a1_a = b.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- b_a1_b = b.getMethod(x -> x.hasName("a1")).getParam(1), //
NOSONAR
- b_a2_a = b.getMethod(x -> x.hasName("a2")).getParam(0), //
NOSONAR
- b_a2_b = b.getMethod(x -> x.hasName("a2")).getParam(1); //
NOSONAR
+ b_b_a = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParameter(0), // NOSONAR
+ b_b_b = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParameter(1), // NOSONAR
+ b_a1_a = b.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ b_a1_b = b.getMethod(x -> x.hasName("a1")).getParameter(1), //
NOSONAR
+ b_a2_a = b.getMethod(x -> x.hasName("a2")).getParameter(0), //
NOSONAR
+ b_a2_b = b.getMethod(x -> x.hasName("a2")).getParameter(1); //
NOSONAR
@Test void getIndex() {
assertEquals(0, b_b_a.getIndex());
@@ -168,11 +168,11 @@ class ParamInfoTest extends TestBase {
cb = ClassInfo.of(CB.class),
cc = ClassInfo.of(CC.class);
static ParameterInfo
- cc_cc = cc.getPublicConstructor(x ->
x.hasParamTypes(C1.class)).getParam(0), // NOSONAR
- cb_a1 = cb.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- cb_a2 = cb.getMethod(x -> x.hasName("a2")).getParam(0), //
NOSONAR
- cc_a1 = cc.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- cc_a2 = cc.getMethod(x -> x.hasName("a2")).getParam(0); //
NOSONAR
+ cc_cc = cc.getPublicConstructor(x ->
x.hasParamTypes(C1.class)).getParameter(0), // NOSONAR
+ cb_a1 = cb.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ cb_a2 = cb.getMethod(x -> x.hasName("a2")).getParameter(0), //
NOSONAR
+ cc_a1 = cc.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ cc_a2 = cc.getMethod(x -> x.hasName("a2")).getParameter(0); //
NOSONAR
@Test void getDeclaredAnnotations() {
check("@CA(5)", declaredAnnotations(cb_a1, CA.class));
@@ -302,8 +302,8 @@ class ParamInfoTest extends TestBase {
db = ClassInfo.of(DB.class),
dc = ClassInfo.of(DC.class);
static ParameterInfo
- db_a1 = db.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- dc_a1 = dc.getMethod(x -> x.hasName("a1")).getParam(0); //
NOSONAR
+ db_a1 = db.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ dc_a1 = dc.getMethod(x -> x.hasName("a1")).getParameter(0); //
NOSONAR
@Test void getAnnotationsParentFirst_inherited() {
check("@DA(4),@DA(3),@DA(2),@DA(1),@DA(0)", annotations(db_a1,
DA.class));
@@ -333,8 +333,8 @@ class ParamInfoTest extends TestBase {
static ClassInfo e = ClassInfo.of(E.class);
static ParameterInfo
- e_a1_a = e.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- e_a1_b = e.getMethod(x -> x.hasName("a1")).getParam(1); //
NOSONAR
+ e_a1_a = e.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ e_a1_b = e.getMethod(x -> x.hasName("a1")).getParameter(1); //
NOSONAR
@Test void hasName() {
e_a1_a.hasName(); // This might be true or false based on the
JVM compiler used.
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Body_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Body_Test.java
index 325d2ba611..65c6035cc0 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Body_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Body_Test.java
@@ -69,7 +69,7 @@ class HttpPartSchema_Body_Test extends TestBase {
}
@Test void a03_basic_onParameter() throws Exception {
- var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParam(0);
+ var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParameter(0);
var s = HttpPartSchema.create().applyAll(Content.class,
mpi).noValidate().build();
assertTrue(s.isRequired());
}
@@ -89,7 +89,7 @@ class HttpPartSchema_Body_Test extends TestBase {
}
@Test void a04_basic_onParameterAndClass() throws Exception {
- var mpi = MethodInfo.of(A04.class.getMethod("a",
A02.class)).getParam(0);
+ var mpi = MethodInfo.of(A04.class.getMethod("a",
A02.class)).getParameter(0);
var s = HttpPartSchema.create().applyAll(Content.class,
mpi).noValidate().build();
assertTrue(s.isRequired());
}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_FormData_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_FormData_Test.java
index 8ca706a542..0e72353f62 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_FormData_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_FormData_Test.java
@@ -116,7 +116,7 @@ class HttpPartSchema_FormData_Test extends TestBase {
}
@Test void a03_basic_onParameter() throws Exception {
- var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParam(0);
+ var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(FormData.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,required,skipIfEmpty,enum,default",
@@ -156,7 +156,7 @@ class HttpPartSchema_FormData_Test extends TestBase {
}
@Test void a04_basic_onParameterAndClass() throws Exception {
- var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParam(0);
+ var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(FormData.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,required,skipIfEmpty,enum,default",
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Header_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Header_Test.java
index 1128259f67..6342c73ad6 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Header_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Header_Test.java
@@ -116,7 +116,7 @@ class HttpPartSchema_Header_Test extends TestBase {
}
@Test void a03_basic_onParameter() throws Exception {
- var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParam(0);
+ var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Header.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,required,skipIfEmpty,enum,default",
@@ -156,7 +156,7 @@ class HttpPartSchema_Header_Test extends TestBase {
}
@Test void a04_basic_onParameterAndClass() throws Exception {
- var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParam(0);
+ var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Header.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,required,skipIfEmpty,enum,default",
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Path_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Path_Test.java
index 2cec16325f..599b2445f8 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Path_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Path_Test.java
@@ -104,7 +104,7 @@ class HttpPartSchema_Path_Test extends TestBase {
}
@Test void a03_basic_onParameter() throws Exception {
- var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParam(0);
+ var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Path.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,exclusiveMaximum,exclusiveMinimum,enum",
@@ -138,7 +138,7 @@ class HttpPartSchema_Path_Test extends TestBase {
}
@Test void a04_basic_onParameterAndClass() throws Exception {
- var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParam(0);
+ var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Path.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,exclusiveMaximum,exclusiveMinimum,enum",
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Query_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Query_Test.java
index 6679a9974c..dc823a26e5 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Query_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_Query_Test.java
@@ -116,7 +116,7 @@ class HttpPartSchema_Query_Test extends TestBase {
}
@Test void a03_basic_onParameter() throws Exception {
- var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParam(0);
+ var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Query.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,required,skipIfEmpty,enum,default",
@@ -156,7 +156,7 @@ class HttpPartSchema_Query_Test extends TestBase {
}
@Test void a04_basic_onParameterAndClass() throws Exception {
- var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParam(0);
+ var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Query.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,required,skipIfEmpty,enum,default",
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_ResponseHeader_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_ResponseHeader_Test.java
index 259cfe1a35..a7ee26744f 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_ResponseHeader_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/httppart/HttpPartSchema_ResponseHeader_Test.java
@@ -110,7 +110,7 @@ class HttpPartSchema_ResponseHeader_Test extends TestBase {
}
@Test void a03_basic_onParameter() throws Exception {
- var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParam(0);
+ var mpi = MethodInfo.of(A03.class.getMethod("a",
String.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Header.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,enum,default",
@@ -148,7 +148,7 @@ class HttpPartSchema_ResponseHeader_Test extends TestBase {
}
@Test void a04_basic_onParameterAndClass() throws Exception {
- var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParam(0);
+ var mpi = MethodInfo.of(A04.class.getMethod("a",
A01.class)).getParameter(0);
assertBean(
HttpPartSchema.create().applyAll(Header.class,
mpi).noValidate().build(),
"name,type,format,collectionFormat,maximum,minimum,multipleOf,pattern,maxLength,minLength,maxItems,minItems,exclusiveMaximum,exclusiveMinimum,uniqueItems,required,skipIfEmpty,enum,default",
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/reflect/ParamInfoTest.java
b/juneau-utest/src/test/java/org/apache/juneau/reflect/ParamInfoTest.java
index a507f51e52..e78ab2576c 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/reflect/ParamInfoTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/reflect/ParamInfoTest.java
@@ -90,12 +90,12 @@ class ParamInfoTest extends TestBase {
static ClassInfo b = ClassInfo.of(B.class);
static ParameterInfo
- b_b_a = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParam(0), // NOSONAR
- b_b_b = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParam(1), // NOSONAR
- b_a1_a = b.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- b_a1_b = b.getMethod(x -> x.hasName("a1")).getParam(1), //
NOSONAR
- b_a2_a = b.getMethod(x -> x.hasName("a2")).getParam(0), //
NOSONAR
- b_a2_b = b.getMethod(x -> x.hasName("a2")).getParam(1); //
NOSONAR
+ b_b_a = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParameter(0), // NOSONAR
+ b_b_b = b.getPublicConstructor(x -> x.hasParamTypes(int.class,
String.class)).getParameter(1), // NOSONAR
+ b_a1_a = b.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ b_a1_b = b.getMethod(x -> x.hasName("a1")).getParameter(1), //
NOSONAR
+ b_a2_a = b.getMethod(x -> x.hasName("a2")).getParameter(0), //
NOSONAR
+ b_a2_b = b.getMethod(x -> x.hasName("a2")).getParameter(1); //
NOSONAR
@Test void getIndex() {
assertEquals(0, b_b_a.getIndex());
@@ -169,11 +169,11 @@ class ParamInfoTest extends TestBase {
cb = ClassInfo.of(CB.class),
cc = ClassInfo.of(CC.class);
static ParameterInfo
- cc_cc = cc.getPublicConstructor(x ->
x.hasParamTypes(C1.class)).getParam(0), // NOSONAR
- cb_a1 = cb.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- cb_a2 = cb.getMethod(x -> x.hasName("a2")).getParam(0), //
NOSONAR
- cc_a1 = cc.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- cc_a2 = cc.getMethod(x -> x.hasName("a2")).getParam(0); //
NOSONAR
+ cc_cc = cc.getPublicConstructor(x ->
x.hasParamTypes(C1.class)).getParameter(0), // NOSONAR
+ cb_a1 = cb.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ cb_a2 = cb.getMethod(x -> x.hasName("a2")).getParameter(0), //
NOSONAR
+ cc_a1 = cc.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ cc_a2 = cc.getMethod(x -> x.hasName("a2")).getParameter(0); //
NOSONAR
@Test void getDeclaredAnnotations() {
check("@CA(5)", declaredAnnotations(cb_a1, CA.class));
@@ -303,8 +303,8 @@ class ParamInfoTest extends TestBase {
db = ClassInfo.of(DB.class),
dc = ClassInfo.of(DC.class);
static ParameterInfo
- db_a1 = db.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- dc_a1 = dc.getMethod(x -> x.hasName("a1")).getParam(0); //
NOSONAR
+ db_a1 = db.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ dc_a1 = dc.getMethod(x -> x.hasName("a1")).getParameter(0); //
NOSONAR
@Test void getAnnotationsParentFirst_inherited() {
check("@DA(4),@DA(3),@DA(2),@DA(1),@DA(0)", annotations(db_a1,
DA.class));
@@ -334,8 +334,8 @@ class ParamInfoTest extends TestBase {
static ClassInfo e = ClassInfo.of(E.class);
static ParameterInfo
- e_a1_a = e.getMethod(x -> x.hasName("a1")).getParam(0), //
NOSONAR
- e_a1_b = e.getMethod(x -> x.hasName("a1")).getParam(1); //
NOSONAR
+ e_a1_a = e.getMethod(x -> x.hasName("a1")).getParameter(0), //
NOSONAR
+ e_a1_b = e.getMethod(x -> x.hasName("a1")).getParameter(1); //
NOSONAR
@Test void hasName() {
e_a1_a.hasName(); // This might be true or false based on the
JVM compiler used.
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/arg/ArgException_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/arg/ArgException_Test.java
index e71363d740..1f0bb453a2 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/arg/ArgException_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/arg/ArgException_Test.java
@@ -36,7 +36,7 @@ class ArgException_Test extends TestBase {
public static void setup() throws Exception {
// Create a test ParamInfo for a sample method parameter
var mi =
MethodInfo.of(ArgException_Test.class.getMethod("sampleMethod", String.class));
- testParamInfo = mi.getParam(0);
+ testParamInfo = mi.getParameter(0);
}
public static void sampleMethod(String param) {