public class MyConceptNodeAdapter extends ConceptNodeAdapter { public MyConceptNodeAdapter(SNode node) { super(node); } public void doSomethingCustom() { // custom implementation here } } MetaAdapterFactory.INSTANCE.register(myConcept, MyConceptNodeAdapter::new);
public class MyCustomStructureAdapter extends SNodeStructureAdapter { public MyCustomStructureAdapter(SNode node) { super(node); } public void doSomethingCustom() { // custom implementation here } } MetaAdapterFactory.INSTANCE.register("myLanguageId.myCustomStructure", MyCustomStructureAdapter::new);In this example, we're creating an adapter for a custom structure in a language with the ID "myLanguageId". We extend the SNodeStructureAdapter class, and add our own method "doSomethingCustom". We then register our adapter with the MetaAdapterFactory using the fully-qualified name of our custom structure. The MetaAdapterFactory class is part of the Jetbrains MPS platform, a language workbench for creating domain-specific languages. The jetbrains.mps.smodel.adapter.structure package library provides tools for manipulating SNode structures in a generic way, so that they can be adapted to different domain-specific use cases.