Skip to content

Basic Setup

Harry Freeborough edited this page Dec 6, 2016 · 1 revision

Basic Setup

Creating a Module

In order to create a module, simply annotate a class with the @Module annotation like the following:

import com.harryfreeborough.modularity.Module;

@Module(name = "Test", desc = "A test module")
public class TestModule {
    
}

Registering Your Modules

In order to register all your modules you simply have to do:

new ModuleLoader().load();

That's it! Since annotations are scanned at compile-time in order, you don't need to create a new instance and register each module independently.

Disabling Modules

Since modules are automatically loaded, you might be wondering how modules can be disabled, but don't worry, it's very simple! Simply set your module's annotation's module variable to false.

@Module(name = "Test", desc = "A test module", enabled = false)
public class TestModule {

}

You can also enable and disable modules using configs or even filter the analyzed modules with filters.