Interface InteractionControllerInstantiator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An InteractionControllerInstantiator is used get instances of classes annotated with Interaction, if needed creating those.
At the time of Runtime creation, forRuntime(String, JDA) is called,
allowing the InteractionControllerInstantiator to provide an instance that has not to be thread safe and is bound to one Runtime.
Please also note that per Runtime there can be multiple
classes annotated with Interaction but there can be only one instance per class of those per Runtime.
Instances of interactions should be treated like runtime scoped singletons, so to speak.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionforRuntime(String id, net.dv8tion.jda.api.JDA jda) Called each time a newRuntimeis created.<T> Tinstance(Class<T> clazz, InteractionControllerInstantiator.Context context) This method will be called each time an instance of a class annotated withInteractionis needed.
-
Method Details
-
instance
This method will be called each time an instance of a class annotated withInteractionis needed.- Parameters:
clazz- theClassof needed instancecontext- a context that gives additional useful information or provide some needed functionality
-
forRuntime
Called each time a newRuntimeis created.- Parameters:
id- the runtime idjda- theJDAinstance associated with the event responsible for creating the new Runtime instance- Returns:
- a specific instance of
InteractionControllerInstantiatorbelonging to provided runtime.
-