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
@TubingConfigurationpublicclassTubingConfiguration { @IocBeanProviderpublicstaticPermissionHandlerinstantiatePermissionHandler(Options options) {finalPluginManager pluginManager =TubingExample.get().getServer().getPluginManager();Plugin gMplugin =pluginManager.getPlugin("GroupManager");if(gMplugin !=null&&gMplugin.isEnabled()) {TubingExample.get().getLogger().info("GroupManager found. Permissions will be handled by GroupManager");returnnewGroupManagerPermissionHandler(options); }RegisteredServiceProvider<Permission> registration =Bukkit.getServer().getServicesManager().getRegistration(Permission.class);if (registration !=null) {TubingExample.get().getLogger().info("Vault found. Permissions will be handled by Vault");returnnewVaultPermissionHandler(options); }TubingExample.get().getLogger().info("Permissions handled by Bukkit");returnnewDefaultPermissionHandler(options); } @IocMultiProvider(ChatInterceptor.class)publicstaticList<ChatInterceptor> loadChatInterceptors(StaffChatConfiguration staffChatConfiguration,SessionManagerImpl sessionManager,PermissionHandler permissionHandler,StaffChatServiceImpl staffChatService) {returnstaffChatConfiguration.getChannelConfigurations().stream().map(c ->newStaffChatChatInterceptor(staffChatService, permissionHandler, sessionManager, c, staffChatConfiguration)).collect(Collectors.toList()); }}
@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
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