Class Parameter
java.lang.Object
cloud.opencode.base.reflect.invokable.Parameter
- All Implemented Interfaces:
AnnotatedElement
Parameter Wrapper
参数包装
Wraps a method/constructor parameter with additional metadata.
包装方法/构造器参数及其附加元数据。
Features | 主要功能:
- Type information access - 类型信息访问
- Parameter name access - 参数名访问
- Annotation access - 注解访问
- Parameter metadata - 参数元数据
Usage Examples | 使用示例:
Parameter param = invokable.getParameters().get(0);
String name = param.getName();
TypeToken<?> type = param.getType();
boolean hasAnnotation = param.isAnnotationPresent(NotNull.class);
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: No (parameter must be non-null) - 空值安全: 否(参数须非空)
- Since:
- JDK 25, opencode-base-reflect V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean<A extends Annotation>
AgetAnnotation(Class<A> annotationClass) <A extends Annotation>
A[]getAnnotationsByType(Class<A> annotationClass) <A extends Annotation>
AgetDeclaredAnnotation(Class<A> annotationClass) <A extends Annotation>
A[]getDeclaredAnnotationsByType(Class<A> annotationClass) intgetIndex()Gets the parameter index 获取参数索引getName()Gets the parameter name 获取参数名Class<?> Gets the raw parameter type 获取原始参数类型TypeToken<?> getType()Gets the parameter type as TypeToken 获取参数类型的TypeTokenGets the underlying parameter 获取底层参数inthashCode()booleanisAnnotationPresent(Class<? extends Annotation> annotationClass) booleanChecks if this is an implicit parameter 检查是否为隐式参数booleanChecks if the parameter name is present 检查参数名是否存在booleanChecks if this is a synthetic parameter 检查是否为合成参数booleanChecks if this is a varargs parameter 检查是否为可变参数toString()
-
Constructor Details
-
Parameter
Creates a Parameter wrapper 创建参数包装- Parameters:
parameter- the underlying parameter | 底层参数index- the parameter index | 参数索引
-
-
Method Details
-
getType
Gets the parameter type as TypeToken 获取参数类型的TypeToken- Returns:
- TypeToken of parameter type | 参数类型的TypeToken
-
getRawType
-
getName
-
isNamePresent
public boolean isNamePresent()Checks if the parameter name is present 检查参数名是否存在- Returns:
- true if name is present | 如果名称存在返回true
-
getIndex
public int getIndex()Gets the parameter index 获取参数索引- Returns:
- the index | 索引
-
isVarArgs
public boolean isVarArgs()Checks if this is a varargs parameter 检查是否为可变参数- Returns:
- true if varargs | 如果是可变参数返回true
-
isImplicit
public boolean isImplicit()Checks if this is an implicit parameter 检查是否为隐式参数- Returns:
- true if implicit | 如果是隐式参数返回true
-
isSynthetic
public boolean isSynthetic()Checks if this is a synthetic parameter 检查是否为合成参数- Returns:
- true if synthetic | 如果是合成参数返回true
-
getUnderlying
Gets the underlying parameter 获取底层参数- Returns:
- the underlying parameter | 底层参数
-
isAnnotationPresent
- Specified by:
isAnnotationPresentin interfaceAnnotatedElement
-
getAnnotation
- Specified by:
getAnnotationin interfaceAnnotatedElement
-
getAnnotations
- Specified by:
getAnnotationsin interfaceAnnotatedElement
-
getAnnotationsByType
- Specified by:
getAnnotationsByTypein interfaceAnnotatedElement
-
getDeclaredAnnotation
- Specified by:
getDeclaredAnnotationin interfaceAnnotatedElement
-
getDeclaredAnnotationsByType
- Specified by:
getDeclaredAnnotationsByTypein interfaceAnnotatedElement
-
getDeclaredAnnotations
- Specified by:
getDeclaredAnnotationsin interfaceAnnotatedElement
-
equals
-
hashCode
-
toString
-