Annotation Interface Suggestions
Special annotation available for use on methods returning
String
(including Optional<String>) values.
The presence of this annotation generates a union type of string and enum, where the values provided by value() will be the
enum items. This makes it possible to create suggested/recommended values while still leaving the option to provide a
custom one.
Example:
@Suggestions({"red", "blue", "yellow"}) String getColor();
The above example would generate a configuration union type where the colors "red", "blue" and "yellow" are suggested options, but one could still provide a custom value like "magenta".
Note that, when used with Optional<String>, the annotation should be added on the String type as in the
following example:
Optional<@Suggestions({"red", "blue", "yellow"}) String> getColor();
- Since:
- 3.0.0
-
Required Element Summary
Required Elements
-
Element Details
-
value
String[] valueAn array of suggested values.- Returns:
- The suggested values
-