1 package net.mograsim.logic.model.serializing;
3 import java.util.function.Function;
5 import net.mograsim.logic.model.model.components.GUIComponent;
6 import net.mograsim.logic.model.snippets.HighLevelStateHandler;
7 import net.mograsim.logic.model.snippets.Renderer;
8 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.atomic.AtomicHighLevelStateHandler;
9 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.subcomponent.SubcomponentHighLevelStateHandler;
12 public class IdentifierGetter
14 // TODO save IDs for everything than can be deserialized / serialized (=every JSONSerializable?)
15 public Function<GUIComponent, String> componentIDs;
16 public Function<Renderer, String> symbolRendererIDs;
17 public Function<Renderer, String> outlineRendererIDs;
18 public Function<HighLevelStateHandler, String> highLevelStateHandlerIDs;
19 public Function<SubcomponentHighLevelStateHandler, String> subcomponentHighLevelStateHandlerIDs;
20 public Function<AtomicHighLevelStateHandler, String> atomicHighLevelStateHandlerIDs;
23 * Creates a new IdentifierGetter using "class:" concatenated with a component's / snippet's complete (canonical) class name as the
24 * default for all ID getter functions.
26 public IdentifierGetter()
28 Function<Object, String> defaultSnippetIDGetter = c -> "class:" + c.getClass().getCanonicalName();
29 this.componentIDs = defaultSnippetIDGetter::apply;
30 this.symbolRendererIDs = defaultSnippetIDGetter::apply;
31 this.outlineRendererIDs = defaultSnippetIDGetter::apply;
32 this.highLevelStateHandlerIDs = defaultSnippetIDGetter::apply;
33 this.subcomponentHighLevelStateHandlerIDs = defaultSnippetIDGetter::apply;
34 this.atomicHighLevelStateHandlerIDs = defaultSnippetIDGetter::apply;