- Function<Object, String> defaultSnippetIDGetter = c -> "class:" + c.getClass().getCanonicalName();
- this.componentIDs = defaultSnippetIDGetter::apply;
- this.symbolRendererIDs = defaultSnippetIDGetter::apply;
- this.outlineRendererIDs = defaultSnippetIDGetter::apply;
- this.highLevelStateHandlerIDs = defaultSnippetIDGetter::apply;
- this.subcomponentHighLevelStateHandlerIDs = defaultSnippetIDGetter::apply;
- this.atomicHighLevelStateHandlerIDs = defaultSnippetIDGetter::apply;
+ componentIDs = generateStandardIDFunction(IndirectGUIComponentCreator.getStandardComponentIDs());
+ symbolRendererIDs = generateStandardIDFunction(symbolRendererSupplier);
+ outlineRendererIDs = generateStandardIDFunction(outlineRendererSupplier);
+ highLevelStateHandlerIDs = generateStandardIDFunction(highLevelStateHandlerSupplier);
+ atomicHighLevelStateHandlerIDs = generateStandardIDFunction(atomicHandlerSupplier);
+ subcomponentHighLevelStateHandlerIDs = generateStandardIDFunction(subcomponentHandlerSupplier);
+ }
+
+ private static <T> Function<T, String> generateStandardIDFunction(CodeSnippetSupplier<?, T> snippetSupplier)
+ {
+ return generateStandardIDFunction(snippetSupplier.getStandardSnippetIDs());
+ }
+
+ private static <T> Function<T, String> generateStandardIDFunction(Map<String, String> standardComponentIDs)
+ {
+ return t ->
+ {
+ String verboseID = "class:" + t.getClass().getCanonicalName();
+ return standardComponentIDs.entrySet().stream().filter(e -> e.getValue().equals(verboseID)).map(Entry::getKey).findAny()
+ .orElse(verboseID);
+ };