public class ParameterTypes
extends Object
Manages parameter type information for methods and constructors, supporting lazy initialization.
Stores both cached class representations and native Java Class objects,
initializing them on-demand with thread-safe synchronization.
| Constructor and description |
|---|
ParameterTypes()Constructs a ParameterTypes with uninitialized parameter types. |
ParameterTypes(Class[] pt)Constructs a ParameterTypes with the specified native parameter types. |
ParameterTypes(String[] pt)Constructs a ParameterTypes from class names. |
ParameterTypes(CachedClass[] pt)Constructs a ParameterTypes with the specified cached parameter types. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public final Object[] |
coerceArgumentsToClasses(Object[] arguments)Coerces arguments to match the expected parameter types, handling type conversions and varargs expansion. |
|
public Object[] |
correctArguments(Object[] arguments)Corrects argument count to match method signature, handling varargs expansion and null filling. |
|
public Class[] |
getNativeParameterTypes()Returns the native Java Class objects for the parameter types.
|
|
protected Class[] |
getPT()Protected method subclasses override to provide parameter types. |
|
public CachedClass[] |
getParameterTypes()Returns the cached class representations of the parameter types. |
|
public boolean |
isValidExactMethod(Object[] args)Checks if the given actual arguments exactly match this method's parameter types. |
|
public boolean |
isValidExactMethod(Class[] args)Checks if the given argument types exactly match this method's parameter types. |
|
public boolean |
isValidMethod(Class[] argumentTypes)Checks if the given argument types are valid for this method, considering varargs conversion. |
|
public boolean |
isValidMethod(Object[] arguments)Checks if the given actual arguments are valid for this method, considering varargs conversion. |
|
public boolean |
isVargsMethod()Returns whether this represents a varargs (variable arguments) method. |
|
public boolean |
isVargsMethod(Object[] arguments)Checks if this varargs method should treat arguments as a varargs invocation. |
|
protected final void |
setParametersTypes(CachedClass[] pt)Sets the cached parameter types and determines if this is a varargs method. |
Constructs a ParameterTypes with uninitialized parameter types.
Constructs a ParameterTypes with the specified native parameter types.
pt - the native Java Class array representing method parameters Constructs a ParameterTypes from class names.
pt - an array of fully qualified class names Constructs a ParameterTypes with the specified cached parameter types.
pt - an array of cached class objects representing method parametersCoerces arguments to match the expected parameter types, handling type conversions and varargs expansion. First corrects argument count for varargs methods, then coerces each argument to its target type.
arguments - the arguments to coerceCorrects argument count to match method signature, handling varargs expansion and null filling. Transforms arguments to match the expected parameter count by expanding varargs arrays or filling nulls.
arguments - the arguments to correct Returns the native Java Class objects for the parameter types.
Lazily initializes the types on first access.
Protected method subclasses override to provide parameter types.
Default implementation throws UnsupportedOperationException.
Returns the cached class representations of the parameter types. Lazily initializes the types on first access.
Checks if the given actual arguments exactly match this method's parameter types. All arguments must be assignable to their corresponding parameters.
args - the actual arguments to validatetrue if the arguments are valid for exact invocation; false otherwiseChecks if the given argument types exactly match this method's parameter types. All types must be assignable to their corresponding parameters.
args - the argument types to validatetrue if the types are valid for exact invocation; false otherwiseChecks if the given argument types are valid for this method, considering varargs conversion.
argumentTypes - the argument types to validatetrue if the types match the method parameters; false otherwiseChecks if the given actual arguments are valid for this method, considering varargs conversion.
arguments - the actual arguments to validatetrue if the arguments are valid for this method; false otherwiseReturns whether this represents a varargs (variable arguments) method.
true if the last parameter is an array type, false otherwiseChecks if this varargs method should treat arguments as a varargs invocation.
arguments - the actual arguments passed to the methodtrue if varargs conversion is needed, false otherwiseSets the cached parameter types and determines if this is a varargs method.
pt - the array of cached parameter typesCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.