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

Class representing a method.

Implements Invocable for uniform invocation across functions, methods, and constructors.

import klyn.reflection

user = User("root")
method = type(user).getMethod("displayName")
if method is Invocable<String>:
result = method.invokeOn(user, [] as Object[])
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 Int:
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
Inherited Properties
propertyInherited Properties from Invocable: name, parameterCount, returnType
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 call(args as Object[]) as Object throws Exception: Direct call operator.
Inherited Operators
operatorInherited Operators from Invocable: operator call(args as Object[]) as ReturnType throws Exception