Package com.vaadin.swingkit.core
Class HandledInvocations
java.lang.Object
com.vaadin.swingkit.core.HandledInvocations
Class to handle and synchronize calls from Swing app to Vaadin app. It
registers available methods that can be called and deals with the invocation
to the corresponding method.
- Author:
- Vaadin Ltd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MethoddescriptionToMethod(MethodDescription desc, ClassLoader cl) Transform aMethodDescriptionand its relatedClassLoader.Get the handled (registered)MethodDescriptionby this handler.invoke(MethodInvocation methodInvocation) Calls the corresponding method invocation if it is found on the registered method descriptions of the handler.booleanisHandled(MethodInvocation methodInvocation) Checks if theMethodInvocationis handled (registered) by the handler.voidregister(MethodDescription description, SwingVaadinInvocation<?> runner) Register a pairMethodDescriptionandSwingVaadinInvocationvoidregister(String className, String returnType, String methodName, String[] argTypes, SwingVaadinInvocation<?> runner)
-
Constructor Details
-
HandledInvocations
public HandledInvocations()Constructor of the class. It initializes themethodCacheandregistrationsfields.
-
-
Method Details
-
register
Register a pairMethodDescriptionandSwingVaadinInvocation- Parameters:
description-MethodDescriptiondescribing the method to be invokedrunner-SwingVaadinInvocationthat implements the invocation of the method
-
register
public void register(String className, String returnType, String methodName, String[] argTypes, SwingVaadinInvocation<?> runner) - Parameters:
className- Class name of the methodreturnType- Return type of the methodmethodName- Method nameargTypes- Arguments types of the methodrunner-SwingVaadinInvocationthat implements the invocation of the method
-
invoke
Calls the corresponding method invocation if it is found on the registered method descriptions of the handler.- Parameters:
methodInvocation-MethodInvocation- Returns:
- Result of the invocation
- Throws:
ClassNotFoundException- If Class not found during invoke callIOException- If IOException during invoke call
-
isHandled
Checks if theMethodInvocationis handled (registered) by the handler.- Parameters:
methodInvocation-MethodInvocationto discover if it is registered by the handler- Returns:
- true if the
MethodInvocationis already registered by the handler.
-
descriptionToMethod
protected Method descriptionToMethod(MethodDescription desc, ClassLoader cl) throws ClassNotFoundException, NoSuchMethodException Transform aMethodDescriptionand its relatedClassLoader. The class loader should be aSwingVaadinCallable.- Parameters:
desc- TheMethodDescriptionof the method.cl- TheClassLoadervalid for the method.- Returns:
- A
Methodrelated to theMethodDescription - Throws:
ClassNotFoundException- If the class cannot be retrieved from theMethodDescriptionand theClassLoaderNoSuchMethodException- If a matching method is not found or if the name is "init"or "clinit".
-
getHandledInvocations
Get the handled (registered)MethodDescriptionby this handler.- Returns:
- The list of registered
MethodDescription
-