Skip to content
LeeGod edited this page Dec 2, 2021 · 1 revision

Register

@Register is an annotation that allows you to register an instance as SimpleContainerObject depend on the return value of the annotated static method

Annotation: io.fairyproject.container.Register

Example:

import io.fairyproject.container.Register;
import org.bukkit.Bukkit;
import org.bukkit.Server;

public class ExampleClass {

    @Register
    public static Server registerServer() {
        return Bukkit.getServer();
    }
...

After having it registered you can directly lookup by Containers.get(Server.class) or using @Autowired field injection

Clone this wiki locally