Class Option
java.lang.Object
ghidra.app.util.Option
- Direct Known Subclasses:
AbstractOption
Container class to hold an option
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadOption(String name, Class<?> valueClass, Object value, String arg, String group, String stateKey, boolean hidden) Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadprotectedOption(String name, Class<?> valueClass, Object value, String arg, String group, String stateKey, boolean hidden, String description) Constructs a newOption.Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadDeprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadDeprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses instead -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a copy of thisOptionobject.getArg()Returns the command line argument for this option (could be null).getCustomEditorComponent(AddressFactoryService addressFactoryService) Override if you want to provide a custom widget for selecting your options.Returns the option's description (could be null).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.booleanisHidden()Returns whether or not this option is hidden.static AddressOption.BuildernewAddress(String name) Returns a newAddressOption.Builder.static AddressSpaceOption.BuildernewAddressSpace(String name) Returns a newAddressSpaceOption.Builder.static BooleanOption.BuildernewBoolean(String name) Returns a newBooleanOption.Builder.static DomainFileOption.BuildernewDomainFile(String name) Returns a newDomainFileOption.Builder.static DomainFolderOption.BuildernewDomainFolder(String name) Returns a newDomainFolderOption.Builder.static HexLongOption.BuildernewHexLong(String name) Returns a newHexLongOption.Builder.static IntegerOption.BuildernewInteger(String name) Returns a newIntegerOption.Builder.static StringOption.BuilderReturns a newStringOption.Builder.booleanparseAndSetValueByType(String str, AddressFactory addressFactory) Set the value for this option by parsing the given string and converting it to the option's type.voidsetOptionListener(OptionListener listener) Sets this option's listenervoidSet the value for this optiontoString()
-
Constructor Details
-
Option
Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadConstructs a newOption- Parameters:
name- the name of the optionvalue- the value of the option- Throws:
IllegalArgumentException- if value isnull
-
Option
Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadConstructs a newOption- Parameters:
group- the name for group of optionsname- the name of the optionvalue- the value of the option- Throws:
IllegalArgumentException- if value isnull
-
Option
Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadConstructs a newOption- Parameters:
name- the name of the optionvalueClass- valueClass the type of the option value
-
Option
@Deprecated(since="12.2", forRemoval=true) public Option(String name, Object value, Class<?> valueClass, String arg) Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadConstructs a newOption- Parameters:
name- the name of the optionvalue- the value of the option (could benull)valueClass- valueClass the type of the option value, which should match<T>arg- the option's command line argument (could benull)
-
Option
@Deprecated(since="12.2", forRemoval=true) public Option(String name, Class<?> valueClass, Object value, String arg, String group) Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadConstructs a newOption- Parameters:
name- the name of the optionvalueClass- valueClass the type of the option value, which should match<T>value- the value of the option (could benull)arg- the option's command line argument (could benull)group- the name for group of options (could benull)
-
Option
@Deprecated(since="12.2", forRemoval=true) public Option(String name, Class<?> valueClass, Object value, String arg, String group, String stateKey, boolean hidden) Deprecated, for removal: This API element is subject to removal in a future version.useAbstractOptionBuildersubclasses insteadConstructs a newOption- Parameters:
name- the name of the optionvalueClass- valueClass the type of the option value, which should match<T>value- the value of the option (could benull)arg- the option's command line argument (could benull)group- the name for group of options (could benull)stateKey- the state key name (could benull)hidden- true if this option should be hidden from the user; otherwise, false
-
Option
protected Option(String name, Class<?> valueClass, Object value, String arg, String group, String stateKey, boolean hidden, String description) Constructs a newOption.- Parameters:
name- the name of the optionvalueClass- valueClass the type of the option value, which should match<T>value- the value of the option (could benull)arg- the option's command line argument (could benull)group- the name for group of options (could benull)stateKey- the state key name (could benull)hidden- true if this option should be hidden from the user; otherwise, falsedescription- a description of the option (could benull)
-
-
Method Details
-
newBoolean
Returns a newBooleanOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
BooleanOption.Builder
-
newString
Returns a newStringOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
StringOption.Builder
-
newInteger
Returns a newIntegerOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
IntegerOption.Builder
-
newHexLong
Returns a newHexLongOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
HexLongOption.Builder
-
newAddress
Returns a newAddressOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
AddressOption.Builder
-
newAddressSpace
Returns a newAddressSpaceOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
AddressSpaceOption.Builder
-
newDomainFile
Returns a newDomainFileOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
DomainFileOption.Builder
-
newDomainFolder
Returns a newDomainFolderOption.Builder.- Parameters:
name- The name of the option- Returns:
- a new
DomainFolderOption.Builder
-
setOptionListener
Sets this option's listener- Parameters:
listener- TheOptionListenerto set
-
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.- Parameters:
addressFactoryService- TheAddressFactoryService- Returns:
- the custom editor
Component, ornullif there isn't one
-
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
-
getValue
-
setValue
Set the value for this option- Parameters:
object- value of this option- Throws:
IllegalArgumentException- if the type of the object doesn't not match this option's value class
-
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)
-
isHidden
public boolean isHidden()Returns whether or not this option is hidden.- Returns:
- whether or not this option is hidden
-
getDescription
Returns the option's description (could be null).- Returns:
- the option's description (could be null)
-
toString
-
copy
Returns a copy of thisOptionobject.NOTE:
Optionsubclasses should always overwrite this method so they can return their exact type, instead of the more genericOptiontype.NOTE: When the deprecated constructors of this class get removed, this method should become abstract.
- Returns:
- a copy of this
Optionobject
-
AbstractOptionBuildersubclasses instead