Skip to content
Pierre T. edited this page Jan 9, 2015 · 7 revisions

Plugin is the main API used by Nuun users. Its role is to provide scan request to the kernel and compute the results to provide classes to bind to the DI engine (e.g. Guice Module).

Create a Plugin

  • Extend AbstractPlugin. This abstract class provides default method for the Plugin interface, so when you extend it, the only mandatory method is public String name().
public class MyPlugin extends AbstractPlugin {

    @Override
    public String name() {
        return "my-plugin";
    }

    ...
}
  • Do some action at the plugin life cycle steps (See Plugin life cycle).
  • Do some requests to the kernel by implementing associated methods (See Request API).
  • If you have some classes to bind implements the following method (See Native module).
@Override
public Object nativeUnitModule() {
    return new MyModule(classesToBind); // Could be a Guice Module
}

Notice that these steps are optional, is it regarding your needs.

Content

Clone this wiki locally