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

Class representing a method.

Implements the reflective Invocable<Object> contract for uniform dynamic invocation across evaluated functions, methods, and constructors.

import klyn.reflection

user = User("root")
method = type(user).getMethod("displayName")
result = method.invokeOn(user, Object[0]) as String
Properties
Modifier and Type Member Description
public readonly property annotations
annotations as ArrayList<Annotation>
Method annotations
public readonly property body
body as String
Method to get the body of the method
public readonly property declaringClass
declaringClass as String
Declaring class
public readonly property flags
flags as Int
Raw modifier flags
public property isAccessible
isAccessible as Boolean
Accessibility flag for private/protected member access.
public readonly property isNative
isNative as Boolean
True when the method is native.
public readonly property isPrivate
isPrivate as Boolean
True when the method is private.
public readonly property isProtected
isProtected as Boolean
True when the method is protected.
public readonly property isPublic
isPublic as Boolean
True when the method is public.
public readonly property isStatic
isStatic as Boolean
True when the method is static.
public readonly property name
name as String
Method to get the name of the method
public readonly property parameterCount
parameterCount as ULong
Parameter count for Invocable interface
public readonly property parameters
parameters as ArrayList<Parameter>
Method to get the parameters of the method
public readonly property returnType
returnType as String
Method to get the return type name required by Invocable
public readonly property returnTypeInfo
returnTypeInfo as Type
Method to get the return type metadata
Constructors
Modifier and Type Member Description
public Method
Method(name as String, returnType as Type, parameters as IList<Parameter> = [], body as String = "", flags as Int = 0, annotations as IList<Annotation> = [], declaringClass as String = null)
Constructor for Method
Methods
Modifier and Type Member Description
public native invoke
invoke(args as Object[]) as Object throws Exception
Invokes a static method with dynamic arguments.
public native invokeOn
invokeOn(instance as Object, args as Object[]) as Object throws Exception
Invokes the method on an instance.
public override toString
toString() as String
Method to convert the method to a string representation
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