Constructor
classin packageklyn.reflection
public class Constructor implements Invocable<Object>
Constructor
All Implemented Interfaces: Invocable

Runtime representation of a constructor.

Constructors implement Invocable<Object> so frameworks can instantiate classes through reflection without falling back to raw allocation.

Example
import klyn.reflection

ctor = User.type.getConstructor()
user = ctor() as User
Properties
Modifier and Type Member Description
public readonly property annotations
annotations as ArrayList<Annotation>
Constructor annotations.
public readonly property declaringClass
declaringClass as String
Full reflected name of the declaring class.
public readonly property flags
flags as Int
Raw modifier flags.
public readonly property index
index as Long
Runtime constructor index on the declaring class.
public property isAccessible
isAccessible as Boolean
Allows reflective access to non-public constructors when enabled.
public readonly property isPrivate
isPrivate as Boolean
True when the constructor is private.
public readonly property isProtected
isProtected as Boolean
True when the constructor is protected.
public readonly property isPublic
isPublic as Boolean
True when the constructor is public.
public readonly property name
name as String
Name required by Invocable.
public readonly property parameterCount
parameterCount as ULong
Number of constructor parameters.
public readonly property parameters
parameters as ArrayList<Parameter>
Constructor parameters.
public readonly property returnType
returnType as String
Constructed type name required by Invocable.
Constructors
Modifier and Type Member Description
public Constructor
Constructor(declaringClass as String = "", index as Long = -1, parameters as IList<Parameter> = [], flags as Int = 0, annotations as IList<Annotation> = [])
Builds constructor metadata.
Methods
Modifier and Type Member Description
public invoke
invoke(args... as Object) as Object throws Exception
Invokes the constructor with a direct argument list.
public native invoke
invoke(args as Object[]) as Object throws Exception
Invokes the constructor with dynamic arguments packed in an Object[].
Inherited Methods
methodInherited Methods from Invocable: invoke
Operators
Modifier and Type Member Description
public operator ()(args as Object[]) as Object throws Exception Direct call operator.
Inherited Operators
operatorInherited Operators from Invocable: operator ()(args as Object[]) as ReturnType throws Exception