Class ConstructorInvokable<T>
java.lang.Object
cloud.opencode.base.reflect.invokable.Invokable<T,T>
cloud.opencode.base.reflect.invokable.ConstructorInvokable<T>
- Type Parameters:
T- the type | 类型
- All Implemented Interfaces:
AnnotatedElement
Constructor Invokable Implementation
构造器Invokable实现
Implementation of Invokable for Constructor objects.
Constructor对象的Invokable实现。
Features | 主要功能:
- Constructor wrapping as Invokable - 将构造器包装为Invokable
- Type-safe constructor invocation - 类型安全的构造器调用
- Parameter and annotation access - 参数和注解访问
Usage Examples | 使用示例:
Invokable<User, User> invokable = Invokable.from(constructor);
User user = invokable.invoke(null, "Alice", 25);
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: No (constructor 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 underlying Constructor 获取底层ConstructorGets the declaring class as TypeToken 获取声明类的TypeTokenClass<?> Gets the declaring class as raw Class 获取声明类的原始ClassGets the exception types 获取异常类型intGets 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 调用方法/构造器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
-
getConstructor
Gets the underlying Constructor 获取底层Constructor- Returns:
- the Constructor | 构造器
-
getAccessibleObject
Description copied from class:InvokableGets the underlying accessible object 获取底层可访问对象- Specified by:
getAccessibleObjectin classInvokable<T,T> - Returns:
- the accessible object | 可访问对象
-
getDeclaringClass
-
getDeclaringClassRaw
-
getReturnType
-
getParameters
-
getParameterTypes
-
getExceptionTypes
-
getTypeParameters
Description copied from class:InvokableGets the type parameters 获取类型参数- Specified by:
getTypeParametersin classInvokable<T,T> - Returns:
- array of type variables | 类型变量数组
-
invoke
public T invoke(T receiver, Object... args) throws InvocationTargetException, IllegalAccessException Description copied from class:InvokableInvokes the method/constructor 调用方法/构造器- Specified by:
invokein classInvokable<T,T> - 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,T> - Returns:
- true if synthetic | 如果是合成返回true
-
getName
-
getModifiers
public int getModifiers()Description copied from class:InvokableGets the modifiers 获取修饰符- Specified by:
getModifiersin classInvokable<T,T> - Returns:
- the modifiers | 修饰符
-
equals
-
hashCode
-
toString
-