tcMenuJavaAPI
Public Member Functions | List of all members
com.thecoderscorner.menu.persist.PropertiesMenuStateSerialiser Class Reference
Inheritance diagram for com.thecoderscorner.menu.persist.PropertiesMenuStateSerialiser:
com.thecoderscorner.menu.persist.MenuStateSerialiser

Public Member Functions

 PropertiesMenuStateSerialiser (MenuTree tree, Path propertiesFile)
 
void loadMenuStatesAndApply ()
 
List< AnyMenuStateloadMenuStates ()
 
void saveMenuStates ()
 

Detailed Description

An implementation of menu state serialization that stores data in a properties file at a given location.

    var tree = new MenuTree();
    var propStore = new PropertiesMenuStateSerialiser(tree, Path.of("./props.properties"));
    propStore.loadMenuStatesAndApply();
    // Some time later...
    propStore.saveMenuStates();

Member Function Documentation

◆ loadMenuStates()

List<AnyMenuState> com.thecoderscorner.menu.persist.PropertiesMenuStateSerialiser.loadMenuStates ( )

load the menu states but do not apply them to the tree

Returns
the list of states loaded from storage

Implements com.thecoderscorner.menu.persist.MenuStateSerialiser.

◆ loadMenuStatesAndApply()

void com.thecoderscorner.menu.persist.PropertiesMenuStateSerialiser.loadMenuStatesAndApply ( )

load back all states from the storage and apply them all to the tree, after this all items in the tree will contain the updated value.

Implements com.thecoderscorner.menu.persist.MenuStateSerialiser.

◆ saveMenuStates()

void com.thecoderscorner.menu.persist.PropertiesMenuStateSerialiser.saveMenuStates ( )

Save the latest state of the tree into storage.

Implements com.thecoderscorner.menu.persist.MenuStateSerialiser.


The documentation for this class was generated from the following file: