Class ReflectionUtils

java.lang.Object
madkit.reflection.ReflectionUtils

public class ReflectionUtils extends Object
Utilities for finding method references in Agent classes.
Since:
6.0
  • Method Details

    • enumToMethodName

      public static <E extends Enum<E>> String enumToMethodName(E e)
      Converts the name of an enum object to a Java standardized method name. For instance, using this on AgentAction.LAUNCH_AGENT will return launchAgent. It is especially used by AgentAction to create Actions that reflexively call the methods of an agent or send a message to it. See Agent.handleRequestActionMessage(madkit.action.RequestActionMessage)
      Type Parameters:
      E - enum type
      Parameters:
      e - the enum object to convert
      Returns:
      a string having a Java standardized method name form.
    • getSignature

      public static String getSignature(String methodName, Class<?>... types)
      Converts a signature to its string representation. This is used by MethodFinder to store the signature of methods in a map.
      Parameters:
      methodName - the name of the method
      types - the types of the arguments of the method
      Returns:
      a string representation of the signature
    • convertArgToTypes

      public static Class<?>[] convertArgToTypes(Object[] parameters)
      Converts the primitive types in the array to their corresponding wrapper classes.
      Parameters:
      parameters - the parameters to convert
      Returns:
      the converted parameters array