Package ghidra.docking.settings
Class JavaEnumSettingsDefinition<T extends Enum<T>>
java.lang.Object
ghidra.docking.settings.JavaEnumSettingsDefinition<T>
- Type Parameters:
T- java Enum that defines the possible values to store.
- All Implemented Interfaces:
EnumSettingsDefinition,SettingsDefinition
- Direct Known Subclasses:
RenderUnicodeSettingsDefinition,TranslationSettingsDefinition
public class JavaEnumSettingsDefinition<T extends Enum<T>>
extends Object
implements EnumSettingsDefinition
A
SettingsDefinition implementation that uses a real java Enum.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJavaEnumSettingsDefinition(String settingName, String name, String description, T defaultValue) Creates a newJavaEnumSettingsDefinition. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves any values in the given settings object assocated with this settings definitionvoidcopySetting(Settings srcSettings, Settings destSettings) Copies any setting value associated with this settings definition from the srcSettings settings to the destSettings.intReturns the current value for this settingsReturns the Enum instance that is the default Enum for thisSettingsDefinition.final StringReturns a description of this settings definitiongetDisplayChoice(int value, Settings settings) Returns the String for the given enum valueString[]getDisplayChoices(Settings settings) Gets the list of choices as strings based on the current settingsgetEnumByOrdinal(int ordinal) Returns the Enum instance that corresponds to the specified ordinal value.getEnumValue(Settings settings) Returns an enum instance that corresponds to the setting stored, or thedefault enumif the setting has not been assigned yet.getEnumValue(Settings settings, T defaultValueOverride) Returns an enum instance that corresponds to the setting stored, or the a custom default value if the setting has not been assigned yet.final StringgetName()Returns the display name of this SettingsDefinitionintgetOrdinalByString(String stringValue) returns the Enum's ordinal using the Enum's string representation.final StringGet theSettingskey which is used when storing a key/value entry.getValueString(Settings settings) Get the setting value as a string which corresponds to this definition.booleanDetermine if a setting value has been storedvoidSets the given value into the settings object using this definition as a keyvoidsetEnumValue(Settings settings, T enumValue) Sets the value of thisSettingsDefinitionusing the ordinal of the specified enum.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.docking.settings.EnumSettingsDefinition
hasSameValue
-
Field Details
-
valueNames
-
-
Constructor Details
-
JavaEnumSettingsDefinition
public JavaEnumSettingsDefinition(String settingName, String name, String description, T defaultValue) Creates a newJavaEnumSettingsDefinition.- Parameters:
settingName- String that specifies how this setting is storedname- Descriptive name of this settingdescription- Longer descriptiondefaultValue- Enum instance that will be returned when thisSettingsDefinitionhas not been specified yet.
-
-
Method Details
-
getDefaultEnum
Returns the Enum instance that is the default Enum for thisSettingsDefinition.- Returns:
- Enum
-
getEnumValue
Returns an enum instance that corresponds to the setting stored, or thedefault enumif the setting has not been assigned yet.- Parameters:
settings-Settingsobject that stores the settings values.- Returns:
- Enum<T> value, or
getDefaultEnum()if not present.
-
getEnumValue
Returns an enum instance that corresponds to the setting stored, or the a custom default value if the setting has not been assigned yet.- Parameters:
settings-Settingsobject that stores the settings values.- Returns:
- Enum<T> value, or the specified defaultValueOveride if not present.
-
setEnumValue
Sets the value of thisSettingsDefinitionusing the ordinal of the specified enum.- Parameters:
settings- WhereSettingsDefinitionvalues are stored.enumValue- Enum to store
-
getEnumByOrdinal
Returns the Enum instance that corresponds to the specified ordinal value.- Parameters:
ordinal- integer that corresponds to an Enum.- Returns:
- Enum
-
getOrdinalByString
returns the Enum's ordinal using the Enum's string representation.- Parameters:
stringValue- Enum's string rep- Returns:
- integer index of the Enum
-
hasValue
Description copied from interface:SettingsDefinitionDetermine if a setting value has been stored- Specified by:
hasValuein interfaceSettingsDefinition- Parameters:
setting- stored settings- Returns:
- true if a value has been stored, else false
-
getName
Description copied from interface:SettingsDefinitionReturns the display name of this SettingsDefinition- Specified by:
getNamein interfaceSettingsDefinition- Returns:
- display name for setting
-
getStorageKey
Description copied from interface:SettingsDefinitionGet theSettingskey which is used when storing a key/value entry.- Specified by:
getStorageKeyin interfaceSettingsDefinition- Returns:
- settings storage key
-
getDescription
Description copied from interface:SettingsDefinitionReturns a description of this settings definition- Specified by:
getDescriptionin interfaceSettingsDefinition- Returns:
- setting description
-
clear
Description copied from interface:SettingsDefinitionRemoves any values in the given settings object assocated with this settings definition- Specified by:
clearin interfaceSettingsDefinition- Parameters:
settings- the settings object to be cleared.
-
copySetting
Description copied from interface:SettingsDefinitionCopies any setting value associated with this settings definition from the srcSettings settings to the destSettings.- Specified by:
copySettingin interfaceSettingsDefinition- Parameters:
srcSettings- the settings to be copieddestSettings- the settings to be updated.
-
getChoice
Description copied from interface:EnumSettingsDefinitionReturns the current value for this settings- Specified by:
getChoicein interfaceEnumSettingsDefinition- Parameters:
settings- The settings to search- Returns:
- the value for the settingsDefintions
-
getValueString
Description copied from interface:SettingsDefinitionGet the setting value as a string which corresponds to this definition. A default value string will be returned if a setting has not been stored.- Specified by:
getValueStringin interfaceSettingsDefinition- Parameters:
settings- settings- Returns:
- value string or null if not set and default has not specified by this definition
-
setChoice
Description copied from interface:EnumSettingsDefinitionSets the given value into the settings object using this definition as a key- Specified by:
setChoicein interfaceEnumSettingsDefinition- Parameters:
settings- the settings to store the value.value- the settings value to be stored.
-
getDisplayChoice
Description copied from interface:EnumSettingsDefinitionReturns the String for the given enum value- Specified by:
getDisplayChoicein interfaceEnumSettingsDefinition- Parameters:
value- the value to get a display string forsettings- the instance settings which may affect the results- Returns:
- the display string for the given settings.
-
getDisplayChoices
Description copied from interface:EnumSettingsDefinitionGets the list of choices as strings based on the current settings- Specified by:
getDisplayChoicesin interfaceEnumSettingsDefinition- Parameters:
settings- the instance settings- Returns:
- an array of strings which represent valid choices based on the current settings.
-