Package com.thecoderscorner.menu.persist
Class JsonMenuItemSerializer
java.lang.Object
com.thecoderscorner.menu.persist.JsonMenuItemSerializer
Creates a menu serializer instance that can convert menu structures to and from JSON format. In the simplest case
just create a new instance of the class and you can use it to convert between formats.
var jsonSerializer = new JsonMenuItemSerializer();
var tree = jsonSerializer.newMenuTreeWithItems(textCopiedFromTcMenuDesigner);
var json = jsonSerializer.itemsToCopyText(MenuTree.ROOT, tree);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckItemValueCanPersist(PersistedMenu persistedMenu) There are some menu types that should not have a default value, these generally don't have a value associated with them that can be easily saved, such as lists, action items, builder items and submenus.copyTextToItems(String items) com.google.gson.GsongetGson()itemsToCopyText(MenuItem startingPoint, MenuTree tree) newMenuTreeWithItems(String tcMenuCopy) populateListInOrder(SubMenuItem node, MenuTree menuTree, boolean processingRoot)
-
Constructor Details
-
JsonMenuItemSerializer
public JsonMenuItemSerializer() -
JsonMenuItemSerializer
-
-
Method Details
-
getGson
public com.google.gson.Gson getGson() -
copyTextToItems
-
newMenuTreeWithItems
-