Context parameters
Context resolvers allow for dynamic resolution of context-specific values into command parameters, enabling commands to adapt based on the environment or actor state.
Overview
ContextParameter
is a functional interface that allows you to resolve parameters based on the context of the command execution. This can be useful for extracting complex types or values from the command context.
ContextParameter Interface
The ContextParameter
interface is used to define how a parameter should be resolved from the command context.
ContextParameter.Factory Interface
The ContextParameter.Factory
interface is used to create ContextParameter
instances dynamically. It is helpful for creating custom parameter types.
Example: PlayerWorldContextParameterFactory
Here is an example of a ContextParameter.Factory
that resolves a World
from the Player
context:
Registering ContextParameter.Factory
You can register a ContextParameter.Factory
with the Lamp
builder to handle custom parameter types.
Last updated
Was this helpful?