Created
April 7, 2021 12:17
-
-
Save theopendle/8d652f63ff6677fab0ed78932128897d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.icfolson.aem.groovy.console.api.BindingExtensionProvider; | |
import com.icfolson.aem.groovy.console.api.BindingVariable; | |
import com.icfolson.aem.groovy.console.api.context.ScriptContext; | |
import org.osgi.service.component.annotations.Component; | |
import java.util.HashMap; | |
import java.util.Map; | |
// Tells the Groovy Console bundle to use this class as an extension to the default Binding | |
@Component(service = BindingExtensionProvider.class, immediate = true) | |
// Implementing this class gives us the method signature below | |
public class CustomBindingExtension implements BindingExtensionProvider { | |
@Override | |
public Map<String, BindingVariable> getBindingVariables(final ScriptContext scriptContext) { | |
// Simply return a map representing each new binding variable you wish to add, in this case just one | |
final HashMap<String, BindingVariable> bindingVariables = new HashMap<>(); | |
bindingVariables.put("importer", new BindingVariable(new Importer())); | |
return bindingVariables; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment