public class BasicMethodRegistry extends Object implements MethodRegistry
Constructor and Description |
---|
BasicMethodRegistry() |
Modifier and Type | Method and Description |
---|---|
Method |
getJavaMethod(Class<?> klass,
String alias)
Get the method for a given alias used to name a method in a specific Java
class.
|
void |
registerJavaMethod(String alias,
Class<?> klass,
String methodName,
Class<?>[] argumentTypes)
Register a java method.
|
public Method getJavaMethod(Class<?> klass, String alias) throws ExecutionException
MethodRegistry
getJavaMethod
in interface MethodRegistry
klass
- the class where the method is. If this parameter is
null
then the class will be fetched from the global
registry of methods.alias
- the alias with which the method was registered for a specific
signature.ExecutionException
- if the method can not be accessed, e.g. there is no such
method or accessing the method violates java security (e.g.
the method is private)public void registerJavaMethod(String alias, Class<?> klass, String methodName, Class<?>[] argumentTypes) throws BasicRuntimeException
MethodRegistry
registerJavaMethod
in interface MethodRegistry
alias
- the alias of the method. This is the name how the BASIC
program will refer to the method. Although the BASIC source
code makes it optional to provide an alias it is not optional
here. It may be same as the string contained in the parameter
methodName
but it should be passed here and should not
be null
klass
- the class in which the method is implemented.methodName
- the Java name of the method.argumentTypes
- the argument classes that form the signature of the method
together with the name and class of the method.BasicRuntimeException
- is thrown if the registration of the alias is not unique in
the actual interpreter. You can not register a name for a
method and then later the same alias for a different method.Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.