Class AttributedSaveState
java.lang.Object
ghidra.framework.options.GProperties
ghidra.framework.options.XmlProperties
ghidra.framework.options.SaveState
ghidra.framework.options.AttributedSaveState
A version of
SaveState that allows clients to add attributes to properties in this save
state. The following code shows how to use this class:
AttributedSaveState ss = new AttributedSaveState();
ss.putBoolean("Happy", true);
Map<String, String> attrs = Map.of("MyAttribute", "AttributeValue");
ss.addAttrbibutes("Happy", attrs);
In this example, the property "Happy" will be given the attribute "MyAttribute" with the value of "AttributeValue". This is useful for clients that wish to add attributes to individual properties, such as a date for tracking usage.
Usage Note: The given attributes are only supported when writing and reading xml. Json is not supported.
-
Field Summary
Fields inherited from class GProperties
ATTRIBUTE_KEY, ATTRIBUTE_NAME, ATTRIBUTE_TYPE, ATTRIBUTE_VALUE, DATE_FORMAT, map, STATE -
Constructor Summary
ConstructorsConstructorDescriptionAttributedSaveState(String name) AttributedSaveState(org.jdom2.Element root) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributes(String propertyName, Map<String, String> attributes) Adds the given map of attribute name/value pairs to this save state.protected SaveStatecreateSaveState(String name) getAttributes(String propertyName) Gets the attributes currently associated with the given property nameprotected voidinitializeElement(org.jdom2.Element e) protected voidprocessElement(org.jdom2.Element element) Called to restore this class' properties when restoring from xml.voidremoveAttributes(String propertyName) Removes all attributes associated with the given property name.Methods inherited from class SaveState
createElement, getSaveState, putSaveState, saveToFileMethods inherited from class GProperties
clear, createElement, createElementFromElement, getAsType, getBoolean, getBooleans, getByte, getBytes, getColor, getDate, getDouble, getDoubles, getEnum, getFile, getFloat, getFloats, getFont, getGProperties, getInt, getInts, getKeyStroke, getLong, getLongs, getName, getNames, getShort, getShorts, getString, getStrings, getXmlElement, hasValue, isEmpty, putBoolean, putBooleans, putByte, putBytes, putColor, putDate, putDouble, putDoubles, putEnum, putFile, putFloat, putFloats, putFont, putGProperties, putInt, putInts, putKeyStroke, putLong, putLongs, putShort, putShorts, putString, putStrings, putXmlElement, remove, saveToJson, saveToJsonFile, saveToXml, saveToXmlFile, size, toString
-
Constructor Details
-
AttributedSaveState
public AttributedSaveState() -
AttributedSaveState
-
AttributedSaveState
public AttributedSaveState(org.jdom2.Element root)
-
-
Method Details
-
addAttributes
-
removeAttributes
Removes all attributes associated with the given property name.- Parameters:
propertyName- the property name within this save state that has the given attributes
-
getAttributes
-
createSaveState
- Overrides:
createSaveStatein classSaveState
-
initializeElement
protected void initializeElement(org.jdom2.Element e) - Overrides:
initializeElementin classGProperties
-
processElement
protected void processElement(org.jdom2.Element element) Description copied from class:GPropertiesCalled to restore this class' properties when restoring from xml.- Overrides:
processElementin classSaveState- Parameters:
element- the element
-