Package ghidra.framework.options
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 ghidra.framework.options.GProperties
DATE_FORMAT, map, NAME, TYPE, VALUE -
Constructor Summary
Constructors -
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 SaveStategetAttributes(String propertyName) Gets the attributes currently associated with the given property nameprotected voidinitializeElement(org.jdom.Element e) protected voidprocessElement(org.jdom.Element element) voidremoveAttributes(String propertyName) Removes all attributes associated with the given property name.Methods inherited from class ghidra.framework.options.SaveState
createElement, getSaveState, putSaveState, saveToFileMethods inherited from class ghidra.framework.options.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.jdom.Element root)
-
-
Method Details
-
addAttributes
Adds the given map of attribute name/value pairs to this save state.- Parameters:
propertyName- the property name within this save state that will be attributedattributes- the attributes
-
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
Gets the attributes currently associated with the given property name- Parameters:
propertyName- the property name for which to get attributes- Returns:
- the attributes or null
-
createSaveState
- Overrides:
createSaveStatein classSaveState
-
initializeElement
protected void initializeElement(org.jdom.Element e) - Overrides:
initializeElementin classGProperties
-
processElement
protected void processElement(org.jdom.Element element) - Overrides:
processElementin classSaveState
-