Package ghidra.app.util
Class Option
java.lang.Object
ghidra.app.util.Option
- Direct Known Subclasses:
DomainFolderOption
,LibrarySearchPathDummyOption
Container class to hold a name, value, and class of the value.
-
Constructor Summary
ConstructorDescriptionConstruct a new Option.Construct a new OptionConstruct a new OptionConstruct a new Option.Construct a new OptionConstruct a new Option. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a copy of this Option object.getArg()
Returns the command line argument for this option (could be null).Override if you want to provide a custom widget for selecting your options.getGroup()
Returns the group name for this option; may be null if group was not specified.getName()
Returns the name of this option.getState()
Returns the current project state associated with this option (could be null).Returns the state key name (could be null).getValue()
Returns the value of this option.Class
<?> Returns the class of the value for this option.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.void
setOptionListener
(OptionListener listener) void
Set the value for this option.toString()
-
Constructor Details
-
Option
Construct a new Option.- Parameters:
name
- name of the optionvalue
- value of the option. Value can't be null with this constructor.- Throws:
IllegalArgumentException
- if value is null
-
Option
Construct a new Option.- Parameters:
group
- Name for group of optionsname
- name of the optionvalue
- value of the option- Throws:
IllegalArgumentException
- if value is null
-
Option
Construct a new Option.- Parameters:
name
- name of the optionvalueClass
- class of the option's value
-
Option
Construct a new Option- Parameters:
name
- name of the optionvalue
- value of the optionvalueClass
- class of the option's valuearg
- the option's command line argument
-
Option
Construct a new Option- Parameters:
name
- name of the optionvalueClass
- class of the option's valuevalue
- value of the optionarg
- the option's command line argumentgroup
- Name for group of options
-
Option
public Option(String name, Class<?> valueClass, Object value, String arg, String group, String stateKey) Construct a new Option- Parameters:
name
- name of the optionvalueClass
- class of the option's valuevalue
- value of the optionarg
- the option's command line argumentgroup
- Name for group of optionsstateKey
- state key name
-
-
Method Details
-
setOptionListener
-
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
Returns the class of the value for this option.- Returns:
- the class of the value for this option
-
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
Returns the name of this option.- Returns:
- the name of this option
-
getValue
Returns the value of this option.- Returns:
- the value of this option
-
setValue
Set the value for this option.- Parameters:
object
- value of this option
-
parseAndSetValueByType
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
Returns the command line argument for this option (could be null).- Returns:
- the command line argument for this option (could be null)
-
getStateKey
Returns the state key name (could be null).- Returns:
- the state key name (could be null)
-
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)
-
toString
-
copy
Creates a copy of this Option object.- Returns:
- a copy of this Option object.
-