Interface PluginAnnotationProcessor<R>
- Type Parameters:
R- the result type of the processor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A centralized mechanism for processing annotations of plugin objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PluginAnnotationProcessor<List<Object>>compose(PluginAnnotationProcessor<?>... processors) Composes multiple processors into one that returns their result in a list.static PluginAnnotationProcessor<List<Object>>compose(Collection<PluginAnnotationProcessor<?>> processors) Composes multiple processors into one that returns their result in a list.events(MindustryPlugin plugin) Processes theEventHandlermethod annotations of a given object to create event listeners.Processes the annotations of the given object.static PluginAnnotationProcessor<Cancellable>tasks(MindustryPlugin plugin) Processes theTaskHandlermethod annotations of a given object to create tasks.triggers(MindustryPlugin plugin) Processes theTriggerHandlermethod annotations of a given object to create trigger listeners.
-
Method Details
-
events
Processes theEventHandlermethod annotations of a given object to create event listeners. The result is anEventSubscriptiontied to all created event listeners. If none, an empty result is returned.- Parameters:
plugin- the owning plugin- Returns:
- a new event handler processor
-
tasks
Processes theTaskHandlermethod annotations of a given object to create tasks. The result is aCancellabletied to all created tasks. If none, an empty result is returned.- Parameters:
plugin- the owning plugin- Returns:
- a new task handler processor
-
triggers
Processes theTriggerHandlermethod annotations of a given object to create trigger listeners. The result is anEventSubscriptiontied to all created trigger listeners. If none, an empty result is returned.- Parameters:
plugin- the owning plugin- Returns:
- a new trigger handler processor
-
compose
Composes multiple processors into one that returns their result in a list.
Note that if a composed processor is in the list of processors, it will be flattened. Such as:
compose(p1, p2, compose(p3, p4), p5)will becomecompose(p1, p2, p3, p4, p5)- Parameters:
processors- the processors- Returns:
- the composed processor
-
compose
static PluginAnnotationProcessor<List<Object>> compose(Collection<PluginAnnotationProcessor<?>> processors) Composes multiple processors into one that returns their result in a list.
Note that if a composed processor is in the list of processors, it will be flattened. Such as:
compose(p1, p2, compose(p3, p4), p5)will becomecompose(p1, p2, p3, p4, p5)- Parameters:
processors- the processors- Returns:
- the composed processor
-
process
Processes the annotations of the given object.- Parameters:
instance- the object- Returns:
- the result of the processing
-