Annotation Interface Implementation


@Target(TYPE) @Retention(RUNTIME) @Scope public @interface Implementation

Indicates that the annotated class is a custom implementation that should replace the default implementation.

A class annotated with Implementation will be automatically searched for with help of the ClassFinders and instantiated by guice. Following types are candidates for automatic registration.

Example

@Implementation(priority = Priority.NORMAL)
public class CustomMiddleware implements Middleware {
    private static final Logger log = LoggerFactory.getLogger(FirstMiddleware.class);

    @Override
    public void accept(InvocationContext<?> context) {
        log.info("run custom middleware");
    }
}
  • Element Details

    • priority

      Priority priority
      Gets the Priority to register the Middleware with. If this implementation is not a subtype of Middleware, this field can be ignored.
      Returns:
      the Priority
      Default:
      NORMAL
    • annotation

      Class<? extends Annotation> annotation
      Gets the annotation the Validator should be mapped to. If this class is not a subtype of Validator, this field can be ignored.
      Returns:
      the annotation the Validator should be mapped to
      Default:
      com.github.kaktushose.jda.commands.annotations.constraints.Constraint.class
    • clazz

      Class<?> clazz
      Gets the Class to register a TypeAdapter with. If this implementation is not a subtype of TypeAdapter, this field can be ignored.
      Returns:
      the class the TypeAdapter should be mapped to
      Default:
      java.lang.Object.class