Package com.scriptbasic.executors
Class BasicMethodRegistry
- java.lang.Object
-
- com.scriptbasic.executors.BasicMethodRegistry
-
- All Implemented Interfaces:
MethodRegistry
public class BasicMethodRegistry extends java.lang.Object implements MethodRegistry
-
-
Constructor Summary
Constructors Constructor Description BasicMethodRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.MethodgetJavaMethod(java.lang.Class<?> klass, java.lang.String alias)Get the method for a given alias used to name a method in a specific Java class.voidregisterJavaMethod(java.lang.String alias, java.lang.Class<?> klass, java.lang.String methodName, java.lang.Class<?>[] argumentTypes)Register a java method.
-
-
-
Method Detail
-
getJavaMethod
public java.lang.reflect.Method getJavaMethod(java.lang.Class<?> klass, java.lang.String alias)Description copied from interface:MethodRegistryGet the method for a given alias used to name a method in a specific Java class.- Specified by:
getJavaMethodin interfaceMethodRegistry- Parameters:
klass- the class where the method is. If this parameter isnullthen the class will be fetched from the global registry of methods.alias- the alias with which the method was registered for a specific signature.- Returns:
- the located method that match the name and the signature what was registered.
-
registerJavaMethod
public void registerJavaMethod(java.lang.String alias, java.lang.Class<?> klass, java.lang.String methodName, java.lang.Class<?>[] argumentTypes) throws BasicRuntimeExceptionDescription copied from interface:MethodRegistryRegister a java method.- Specified by:
registerJavaMethodin interfaceMethodRegistry- Parameters:
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 parametermethodNamebut it should be passed here and should not benullklass- 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.- Throws:
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.
-
-