Annotation Interface Produces


@Target(METHOD) @Retention(RUNTIME) public @interface Produces

Methods annotated with Produces will be used to get the instance of a dependency.

The instances provided by producer methods are used to inject values to the fields inside a Interaction that are annotated with Inject. The access modifier of a producer method must be public.

Classes containing producer methods will be found automatically on startup. They can also be registered via DependencyInjector.registerProvider(Object)

Please note that this is only a very basic implementation of dependency injection and can only be used inside interaction controller classes or custom Implementations. Furthermore, each type can only have one producer. In other words you cannot register different instances of the same dependency.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether jda-commands should ignore this method at indexing during startup.
  • Element Details

    • skipIndexing

      boolean skipIndexing
      Whether jda-commands should ignore this method at indexing during startup. Useful if you wish to register your dependency providers manually by calling DependencyInjector.registerProvider(Object)
      Returns:
      Whether jda-commands should ignore this method, default true
      Default:
      false