Class WorkflowReflectionUtils

java.lang.Object
io.axoniq.framework.workflow.runtime.util.WorkflowReflectionUtils

@Internal public class WorkflowReflectionUtils extends Object
Reflection utilities.
Since:
5.4.0
Author:
Simon Zambrovski
  • Method Details

    • createDefaultInstance

      public static <T> Optional<T> createDefaultInstance(Class<T> clazz)
      Creates an instance of specified type.
      Type Parameters:
      T - type of instance.
      Parameters:
      clazz - type to instantiate.
      Returns:
      optional instance or empty on every error.
    • requireIsAssignableFrom

      public static <C> Class<C> requireIsAssignableFrom(Class<?> expected, Class<C> clazz)
      Checks if provided class is a subtype of given type and throws an exception if this checks fails.
      Parameters:
      expected - expected type.
      clazz - class to check.
      Returns:
      provided class.
    • invoke

      public static Object invoke(Object instance, Method method, Object... args)
      Invokes a method.
      Parameters:
      instance - object to invoke on.
      method - method to invoke.
      args - args of the method.
      Returns:
      result of invocation.