Package com.scriptbasic.executors
Class BasicMethodRegistry
java.lang.Object
com.scriptbasic.executors.BasicMethodRegistry
- All Implemented Interfaces:
MethodRegistry
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetJavaMethod(Class<?> klass, String alias) Get the method for a given alias used to name a method in a specific Java class.voidregisterJavaMethod(String alias, Class<?> klass, String methodName, Class<?>[] argumentTypes) Register a java method.
-
Constructor Details
-
BasicMethodRegistry
public BasicMethodRegistry()
-
-
Method Details
-
getJavaMethod
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(String alias, Class<?> klass, String methodName, Class<?>[] argumentTypes) throws BasicRuntimeException Description 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.
-