I have a annotation @ToolExecution
. At the moment I use annotation processing and throwing Error
to ensure that only one method is annotated with this annotation.
Is there an native way to create a constraint and allow my custom annotation to be only applied to one annotation per class?
This should not be possible
@Tool(id = "scheduledtool")
public class ScheduledTool extends SimpleTool {
private String parameter;
@ToolExecution
public void configuration(@ToolParameters(fields = {"config"}, credentials = true) ToolParameter parameters) {
String parameter = parameters.getParameter("config");
this.parameter = parameter;
}
@ToolExecution
public void execute() {
toolLog(Level.INFO, "Configured Param: " + parameter);
toolLog(Level.INFO, "Finished scheduled tool");
}
}