Class Option

java.lang.Object
ghidra.app.util.Option
Direct Known Subclasses:
DomainFolderOption, LibrarySearchPathDummyOption

public class Option extends Object
Container class to hold a name, value, and class of the value.
  • Constructor Details Link icon

    • Option Link icon

      public Option(String name, Object value)
      Construct a new Option.
      Parameters:
      name - name of the option
      value - value of the option. Value can't be null with this constructor.
      Throws:
      IllegalArgumentException - if value is null
    • Option Link icon

      public Option(String group, String name, Object value)
      Construct a new Option.
      Parameters:
      group - Name for group of options
      name - name of the option
      value - value of the option
      Throws:
      IllegalArgumentException - if value is null
    • Option Link icon

      public Option(String name, Class<?> valueClass)
      Construct a new Option.
      Parameters:
      name - name of the option
      valueClass - class of the option's value
    • Option Link icon

      public Option(String name, Object value, Class<?> valueClass, String arg)
      Construct a new Option
      Parameters:
      name - name of the option
      value - value of the option
      valueClass - class of the option's value
      arg - the option's command line argument
    • Option Link icon

      public Option(String name, Class<?> valueClass, Object value, String arg, String group)
      Construct a new Option
      Parameters:
      name - name of the option
      valueClass - class of the option's value
      value - value of the option
      arg - the option's command line argument
      group - Name for group of options
    • Option Link icon

      public Option(String name, Class<?> valueClass, Object value, String arg, String group, String stateKey, boolean hidden)
      Construct a new Option
      Parameters:
      name - name of the option
      valueClass - class of the option's value
      value - value of the option
      arg - the option's command line argument
      group - Name for group of options
      stateKey - state key name
      hidden - true if this option should be hidden from the user; otherwise, false
  • Method Details Link icon

    • setOptionListener Link icon

      public void setOptionListener(OptionListener listener)
    • getCustomEditorComponent Link icon

      public Component getCustomEditorComponent()
      Override if you want to provide a custom widget for selecting your options.

      Important! If you override this you MUST also override the copy() method so it returns a new instance of your custom editor.

      Returns:
      the custom editor
    • getValueClass Link icon

      public Class<?> getValueClass()
      Returns the class of the value for this option.
      Returns:
      the class of the value for this option
    • getGroup Link icon

      public String getGroup()
      Returns the group name for this option; may be null if group was not specified.
      Returns:
      the group name for this option; may be null if group was not specified
    • getName Link icon

      public String getName()
      Returns the name of this option.
      Returns:
      the name of this option
    • getValue Link icon

      public Object getValue()
      Returns the value of this option.
      Returns:
      the value of this option
    • setValue Link icon

      public void setValue(Object object)
      Set the value for this option.
      Parameters:
      object - value of this option
    • parseAndSetValueByType Link icon

      public boolean parseAndSetValueByType(String str, AddressFactory addressFactory)
      Set the value for this option by parsing the given string and converting it to the option's type. Fails if this option doesn't have a type associated with it, or if an unsupported type is needed to be parsed.
      Parameters:
      str - The value to set, in string form.
      addressFactory - An address factory to use for when the option trying to be set is an Address. If null, an exception will be thrown for Address type options.
      Returns:
      True if the value was successfully parsed and set; otherwise, false.
    • getArg Link icon

      public String getArg()
      Returns the command line argument for this option (could be null).
      Returns:
      the command line argument for this option (could be null)
    • getStateKey Link icon

      public String getStateKey()
      Returns the state key name (could be null).
      Returns:
      the state key name (could be null)
    • getState Link icon

      public SaveState getState()
      Returns the current project state associated with this option (could be null).
      Returns:
      the current project state associated with this option (could be null)
    • isHidden Link icon

      public boolean isHidden()
      Returns whether or not this option is hidden.
      Returns:
      whether or not this option is hidden
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • copy Link icon

      public Option copy()
      Creates a copy of this Option object.
      Returns:
      a copy of this Option object.