Class InvocationUtils

java.lang.Object
com.vaadin.swingkit.core.InvocationUtils

public class InvocationUtils extends Object
Utility class to handle method invocations between a Swing app and a Vaadin app embedded in a JVaadinPanel.
  • Method Details

    • encode

      public static String encode(Object methodInvocation) throws IOException
      Encode a method invocation call or any other object into a Base64 string.
      Parameters:
      methodInvocation - the object to encode, usually a MethodInvocation instance.
      Returns:
      a Base64 string encoding of the object.
      Throws:
      IOException - if any problems occur while encoding the object.
      See Also:
    • encode

      public static String encode(Method method, Object[] args) throws IOException
      Encode a method invocation call and its arguments into a Base64 string.
      Parameters:
      method - the method to encode.
      args - the arguments of the method call.
      Returns:
      a Base64 String encoding of the method call.
      Throws:
      IOException - if any problems occur while encoding the object.
    • create

      public static MethodInvocation create(Method method, Object[] args)
      Creates a MethodInvocation instance out of a method and the arguments used in its call.
      Parameters:
      method - the method in question.
      args - the arguments used when calling the method.
      Returns:
      a MethodInvocation representing the method call with the passed in arguments.
    • decode

      public static <E> E decode(String encodedMethodInvocation) throws IOException, ClassNotFoundException
      Decodes a Base64 String and returns the object encoded in it. The encoded object can be anything, whether an InvocationResponse, a MethodInvocation or a VaadinSwingEvent.
      Type Parameters:
      E - the type of the encoded object.
      Parameters:
      encodedMethodInvocation - the Base64 String to decode.
      Returns:
      the object represented by the encoded String.
      Throws:
      IOException - if there's any problem decoding the object.
      ClassNotFoundException - if the class of the object is not present at runtime.