java.lang.Object
org.autogui.base.mapping.GuiPreferences.HistoryValueEntry
- Direct Known Subclasses:
GuiPreferences.HistoryValueEntryJsonSupported,GuiPreferences.HistoryValueEntryOnMemory
- Enclosing class:
GuiPreferences
an entry of the value history, consisting of a value, an index and a time-stamp, associated with a key-index.
preferences/
"$history"/
keyIndex/ : valueStore
"index" : int
"value" : String
"time" : String //Instant
...
The value has the following stages. Some types have same form in the multiple stages.
- rawObject : actual object. the constructor takes it.
- value : the instance-field holds on the memory,
toValueInit(Object)with rawObject. if non-nullisJsonValue()rawObject, it will be converted as JSON by repr, otherwise, rawObject.setValue(Object)takes it. - storedJsonValue : a JSON object internally created by
getStoredJsonValue(). ifisJsonValue(), value itself, otherwise, converted JSON by repr. - source : JSON source by
getStoredJsonValue()
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected GuiPreferencesprotected Instantprotected Objectprotected GuiPreferences.GuiValueStore -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetIndex()intprotected GuiPreferences.GuiValueStoregetTime()getValue()booleanvoidload()load the "$history/index" value, and if the value is not -1, then also load "$history/value" and decode it as JSON andGuiRepresentation.fromJson(GuiMappingContext, Object, Object).booleanvoidremove()voidsetIndex(int index) voidsetKeyIndexWithLoadOrStore(int keyIndex) voidvoidvoidstore()voidprotected voidprotected ObjecttoValueInit(Object rawObject) called from the constructor
-
Field Details
-
preferences
-
value
-
keyIndex
protected int keyIndex -
index
protected int index -
valueStore
-
time
-
-
Constructor Details
-
HistoryValueEntry
-
-
Method Details
-
toValueInit
called from the constructor- Parameters:
rawObject- the constructor argument- Returns:
- stored value as a prefs entry
- Since:
- 1.5
-
match
-
getValue
-
setValue
-
storeValue
protected void storeValue() -
getKeyIndex
public int getKeyIndex() -
getIndex
public int getIndex() -
getTime
-
remove
public void remove() -
setKeyIndexWithLoadOrStore
public void setKeyIndexWithLoadOrStore(int keyIndex) - Parameters:
keyIndex- the key index
-
load
public void load()load the "$history/index" value, and if the value is not -1, then also load "$history/value" and decode it as JSON andGuiRepresentation.fromJson(GuiMappingContext, Object, Object). Also, when the value is not -1, load "$history/time" and decode it as aInstantstring.getValue()will be null if it failed. -
fromJsonSource
-
isJsonValue
public boolean isJsonValue()- Returns:
- if false, the value holds a raw-object which might be a non-JSON object, and then the associated representation can create a new value from a JSON source without any raw-object.
-
store
public void store() -
getStoredJsonValue
-
getValueStore
-
getParent
-
setIndex
public void setIndex(int index) -
setTime
-
storeAsCurrentValue
public void storeAsCurrentValue() -
loadAsCurrentValue
-