Class ReflectionUtilities

java.lang.Object
gov.nasa.jpl.input.ReflectionUtilities

public class ReflectionUtilities extends Object
  • Field Details

  • Method Details

    • getClassNameWithoutPackage

      public static String getClassNameWithoutPackage(String withPackage)
      This method takes in the name of a fully qualified package and returns the relative name (without prefixes)
      Parameters:
      withPackage - - name of the string that contains a package prefix
      Returns:
      - a string with only the relative name (last level of hierarchy)
    • getListOfAllCustomClasses

      public static List<Class> getListOfAllCustomClasses()
      Finds all the classes in current classloader and assigns to static variable those in our custom namespace, so we don't have to waste time running getPackages or classLoader more than once ever
      Returns:
      a list of Class objects that represent all the ones the core or adapters have devised
    • returnValueOf

      public static Object returnValueOf(String typeString, String valueString, boolean removeDoubleQuotes)
      This method takes in the name of a class and a value as a string and returns an object of the given class with the input value.
      Parameters:
      typeString - - name of data class type (String, Time, Duration, etc.)
      valueString - - string of the value to be converted
      removeDoubleQuotes - - if a string comes in with double quotes, should they be removed?
      Returns:
      - the input value string as an object of the input className
    • parseActivityParameters

      public static Object[] parseActivityParameters(String parameterString, String[] paramTypes)
      Takes in a parameter string which contains zero or more parameters, separated by commas and returns an object list of parameters.
      Parameters:
      parameterString - - String containing comma-separated parameterValues
      paramTypes - - List of strings representing the type of each expected parameter
      Returns:
      - returns array of arguments to be used for the activity constructor
    • getActivityParameterTypeArray

      public static String[] getActivityParameterTypeArray(List<Map<String,String>> parameters)
      Goes from List<Map<String, String>> to String[], where the only key pulled out is 'type' and 'Time' is artificially added as the zeroth element Used for grabbing parameter types from the Activity type list so parseActivityParameters knows what to do with it
      Parameters:
      parameters -
      Returns:
    • instantiateActivity

      public static void instantiateActivity(Class<?> actClass, Object[] args, UUID actID)
      Instantiates an activity and updates the actID.
      Parameters:
      args -
      actID -
      actClass -