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 int
protected int
protected GuiPreferences
protected Instant
protected Object
protected GuiPreferences.GuiValueStore
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getIndex()
int
protected GuiPreferences.GuiValueStore
getTime()
getValue()
boolean
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)
.boolean
void
remove()
void
setIndex
(int index) void
setKeyIndexWithLoadOrStore
(int keyIndex) void
void
void
store()
void
protected void
protected Object
toValueInit
(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 aInstant
string.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
-