Class TraceMethod.ParameterDescription<T>

java.lang.Object
ghidra.trace.model.target.iface.TraceMethod.ParameterDescription<T>
Type Parameters:
T - the type of the parameter
Enclosing interface:
TraceMethod

public static class TraceMethod.ParameterDescription<T> extends Object
A description of a method parameter

TODO: Should this be incorporated into schemas?

  • Field Details

    • type

      public final Class<T> type
    • name

      public final String name
    • defaultValue

      public final T defaultValue
    • required

      public final boolean required
    • display

      public final String display
    • description

      public final String description
    • schema

      public final String schema
    • choices

      public final Set<T> choices
  • Method Details

    • create

      public static <T> TraceMethod.ParameterDescription<T> create(Class<T> type, String name, boolean required, T defaultValue, String display, String description, String schema)
      Create a parameter
      Type Parameters:
      T - the type of the parameter
      Parameters:
      type - the class representing the type of the parameter
      name - the name of the parameter
      required - true if this parameter must be provided
      defaultValue - the default value of this parameter
      display - the human-readable name of this parameter
      description - the human-readable description of this parameter
      schema - the parameter's schema
      Returns:
      the new parameter description
    • create

      public static <T> TraceMethod.ParameterDescription<T> create(Class<T> type, String name, boolean required, T defaultValue, String display, String description)
      Create a parameter
      Type Parameters:
      T - the type of the parameter
      Parameters:
      type - the class representing the type of the parameter
      name - the name of the parameter
      required - true if this parameter must be provided
      defaultValue - the default value of this parameter
      display - the human-readable name of this parameter
      description - the human-readable description of this parameter
      Returns:
      the new parameter description
    • choices

      public static <T> TraceMethod.ParameterDescription<T> choices(Class<T> type, String name, Collection<T> choices, String display, String description)
      Create a parameter having enumerated choices
      Type Parameters:
      T - the type of the parameter
      Parameters:
      type - the class representing the type of the parameter
      name - the name of the parameter
      choices - the non-empty set of choices. The first is the default.
      display - the human-readable name of this parameter
      description - the human-readable description of this parameter
      Returns:
      the new parameter description
    • choices

      public static <T> TraceMethod.ParameterDescription<T> choices(Class<T> type, String name, Collection<T> choices, T defaultValue, String display, String description)
      Create a parameter having enumerated choices
      Type Parameters:
      T - the type of the parameter
      Parameters:
      type - the class representing the type of the parameter
      name - the name of the parameter
      choices - the non-empty set of choices
      defaultValue - the default value of this parameter
      display - the human-readable name of this parameter
      description - the human-readable description of this parameter
      Returns:
      the new parameter description
    • isRequired

      protected static boolean isRequired(Class<?> type, TraceMethod.Param param)
    • getDefault

      protected static Object getDefault(TraceMethod.Param annot)
    • getDefault

      protected static <T> T getDefault(Class<T> type, TraceMethod.Param annot)
    • annotated

      protected static <T> TraceMethod.ParameterDescription<T> annotated(Class<T> type, TraceMethod.Param annot, String name)
    • annotated

      public static TraceMethod.ParameterDescription<?> annotated(Parameter parameter)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • get

      public T get(Map<String,?> arguments)
      Extract the argument for this parameter

      You must validate the arguments, using TraceMethod.validateArguments(Map, Map, boolean), first.

      Parameters:
      arguments - the validated arguments
      Returns:
      the parameter
    • set

      public void set(Map<String,? super T> arguments, T value)
      Set the argument for this parameter
      Parameters:
      arguments - the arguments to modify
      value - the value to assign the parameter
    • adjust

      public void adjust(Map<String,? super T> arguments, Function<T,T> adjuster)
      Adjust the argument for this parameter
      Parameters:
      arguments - the arguments to modify
      adjuster - a function of the old argument to the new argument. If the argument is not currently set, the function will receive null.
    • toString

      public String toString()
      Overrides:
      toString in class Object