This page describes all annotations provided by the Tubing framework.
@IocBean
This is the most used annotation. It registers the class annotated with this bean inside the ioc container of Tubing. Making it a bean. The class can now be injected into other Tubing beans, or can inject other Tubing beans in its constructor.
Property
conditionalOnProperty
you can specify this optional property inside the annotation if you want to conditionally register this bean. The bean will only be created if the property specified can be found and has the specified value.
Notates a class as a tubing configuration class. This type of class can contain Tubing bean provider methods. Provider methods are used when you want to register a bean that is determined based on some logic that is more complex than can be handled by the @IocBean annotation
@IocBeanProvider
Can only be used on methods inside a Tubing Configuration class.
Inside the arguments of this method we can use tubing beans. Tubing will inject the beans when using this method when creating the bean.
@IocCommandHandler
Specify this bean as a command executor. More info
property
description
value
The name of the command as specified in the plugin.yml
@IocListener
Specify this bean as a Bukkit event listener.
@IocMessageListener
Specify this bean as a Bungee message listener.
property
Description
channel
The channel on which the listener should listen.
@ConfigProperty
This annotation can only be used on fields of Tubing beans.
Inject a property from the config file inside a bean.
Property
Description
value
The config yml path.
Config
@ConfigTransformer
This annotation must be used on a field annotated with the @ConfigProperty annotation.
The ConfigTransformer class must implement the IConfigTransformer interface.
Specify a class which will be used to transform the property before it gets injected into the bean
@IocBean
public class Configuration {
@ConfigProperty("tubing-example.broadcast-prefix")
public String broadcastPrefix;
}
@IocBean
public class Configuration {
@ConfigProperty("multiline-property")
@ConfigTransformer(MessageMultiLineTransformer.class)
public List<String> broadcastPrefix;
}
public class MessageMultiLineTransformer implements IConfigTransformer<List<String>, String> {
@Override
public List<String> mapConfig(String value) {
return Arrays.asList(commas.split("\\s*,\\s*"));
}
}