Class MethodInvokable<T>
java.lang.Object
cloud.opencode.base.reflect.invokable.Invokable<T,Object>
cloud.opencode.base.reflect.invokable.MethodInvokable<T>
- Type Parameters:
T- the declaring class type | 声明类类型
- All Implemented Interfaces:
AnnotatedElement
Method Invokable Implementation
方法Invokable实现
Implementation of Invokable for Method objects.
Method对象的Invokable实现。
Features | 主要功能:
- Method wrapping as Invokable - 将方法包装为Invokable
- Type-safe method invocation - 类型安全的方法调用
- Parameter and annotation access - 参数和注解访问
Usage Examples | 使用示例:
Invokable<Service, Object> invokable = Invokable.from(method);
Object result = invokable.invoke(service, args);
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: No (method must be non-null) - 空值安全: 否(方法须非空)
- Since:
- JDK 25, opencode-base-reflect V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected AccessibleObjectGets the underlying accessible object 获取底层可访问对象Gets the declaring class as TypeToken 获取声明类的TypeTokenClass<?> Gets the declaring class as raw Class 获取声明类的原始ClassGets the exception types 获取异常类型Gets the underlying Method 获取底层MethodintGets the modifiers 获取修饰符getName()Gets the name 获取名称Gets the parameter list 获取参数列表Gets the parameter types 获取参数类型Gets the return type as TypeToken 获取返回类型的TypeTokenTypeVariable<?>[]Gets the type parameters 获取类型参数inthashCode()Invokes the method/constructor 调用方法/构造器booleanisBridge()Checks if this is a bridge method 检查是否为桥接方法booleanChecks if this is a default method 检查是否为默认方法booleanChecks if synthetic 检查是否为合成booleanChecks if varargs 检查是否为可变参数toString()Methods inherited from class Invokable
from, from, getAnnotation, getAnnotations, getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotations, getDeclaredAnnotationsByType, invokeForced, invokeSafe, isAbstract, isAnnotationPresent, isFinal, isNative, isOverridable, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynchronized, setAccessible
-
Method Details
-
getMethod
-
getAccessibleObject
Description copied from class:InvokableGets the underlying accessible object 获取底层可访问对象- Specified by:
getAccessibleObjectin classInvokable<T,Object> - Returns:
- the accessible object | 可访问对象
-
getDeclaringClass
-
getDeclaringClassRaw
-
getReturnType
-
getParameters
-
getParameterTypes
-
getExceptionTypes
-
getTypeParameters
Description copied from class:InvokableGets the type parameters 获取类型参数- Specified by:
getTypeParametersin classInvokable<T,Object> - Returns:
- array of type variables | 类型变量数组
-
invoke
public Object invoke(T receiver, Object... args) throws InvocationTargetException, IllegalAccessException Description copied from class:InvokableInvokes the method/constructor 调用方法/构造器- Specified by:
invokein classInvokable<T,Object> - Parameters:
receiver- the receiver object | 接收对象args- the arguments | 参数- Returns:
- the result | 结果
- Throws:
InvocationTargetException- if invocation fails | 如果调用失败IllegalAccessException- if access denied | 如果访问被拒绝
-
isVarArgs
-
isSynthetic
public boolean isSynthetic()Description copied from class:InvokableChecks if synthetic 检查是否为合成- Specified by:
isSyntheticin classInvokable<T,Object> - Returns:
- true if synthetic | 如果是合成返回true
-
isBridge
public boolean isBridge()Checks if this is a bridge method 检查是否为桥接方法- Returns:
- true if bridge | 如果是桥接方法返回true
-
isDefault
public boolean isDefault()Checks if this is a default method 检查是否为默认方法- Returns:
- true if default | 如果是默认方法返回true
-
getName
-
getModifiers
public int getModifiers()Description copied from class:InvokableGets the modifiers 获取修饰符- Specified by:
getModifiersin classInvokable<T,Object> - Returns:
- the modifiers | 修饰符
-
equals
-
hashCode
-
toString
-