When building a dynamic parameter, you can define how choices are retrieved and how they are converted to the target type using two different patterns:
Pattern 1: Combined Map (Recommended)
Use choicesAndResults to provide a Supplier<Map<String, ? extends T>>. This ensures that the keys of the map serve as the command choices and the values serve as the resulting objects, maintaining consistency between what the user types and what the command receives.
Pattern 2: Separate Choices and Results
Use choices(Supplier<? extends Collection<String>>) and results(Function<String, ? extends T>) independently. This is useful if the list of strings and the logic to resolve them come from different sources.