Package org.incendo.cloud.injection
Interface ParameterInjector<C,T>
- Type Parameters:
C- command sender typeT- Type of the value that is injected by this injector
- All Known Implementing Classes:
ParameterInjector.ConstantInjector
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Injector that injects parameters into Command annotated
methods
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <C,T> @NonNull ParameterInjector <C, T> constantInjector(@NonNull T value) Returns a parameter injector that always injectsvalue.create(@NonNull CommandContext<C> context, @NonNull AnnotationAccessor annotationAccessor) Attempts to create a value that should then be injected into the Command annotated method.
-
Method Details
-
constantInjector
@API(status=STABLE) static <C,T> @NonNull ParameterInjector<C,T> constantInjector(@NonNull T value) Returns a parameter injector that always injectsvalue.- Type Parameters:
C- command sender typeT- type of the value- Parameters:
value- value to inject- Returns:
- the injector
-
create
@Nullable T create(@NonNull CommandContext<C> context, @NonNull AnnotationAccessor annotationAccessor) Attempts to create a value that should then be injected into the Command annotated method.If the injector cannot (or shouldn't) create a value, it is free to return
null.- Parameters:
context- command context that is requesting the injectionannotationAccessor- annotation accessor proxying the method and parameter which the value is being injected into- Returns:
- the value if it could be created, else
nullin which case no value will be injected by this particular injector
-