Enum Class JDACScope

java.lang.Object
java.lang.Enum<JDACScope>
io.github.kaktushose.jdac.property.JDACScope
All Implemented Interfaces:
Scope, Serializable, Comparable<JDACScope>, Constable

public enum JDACScope extends Enum<JDACScope> implements Scope

The scope or "scope" inside the framework at which a properties value is set.

JDA-Commands has the following scopes in this order:

  1. CONFIGURATION -> setting of builder properties, extension loading, construction of framework components
  2. INITIALIZED -> after starting the framework (basically after JDACBuilder.start() completed), e.g. all definitions are indexed etc.
  3. RUNTIME -> inside a runtime but outside of processing an GenericInteractionCreateEvent, e.g. when Instantiator.instance(Class, JDACIntrospection) is called
  4. PREPARATION -> during the preparation of an GenericInteractionCreateEvent for the INTERACTION scope, e.g. where type adapters get called
  5. INTERACTION -> when processing an GenericInteractionCreateEvent, e.g. in Middleware.accept(InvocationContext) or inside a user defined interaction controller method

Generally, a scope includes all properties that were set in a former scope:

To know in which scope a Property is available take a look at Property.scope().

More technical, a Scope with a certain priority contains all scopes with a lower ordinal value:

scopeA ⊆ scopeB if scopeA.ordinal < scopeB.ordinal

Many user implementable methods are annotated with IntrospectionAccess. To get a hint in which scope this method will be called by JDA-Commands you can take a look at IntrospectionAccess.value().

  • Enum Constant Details

    • CONFIGURATION

      public static final JDACScope CONFIGURATION
    • INITIALIZED

      public static final JDACScope INITIALIZED
    • RUNTIME

      public static final JDACScope RUNTIME
    • PREPARATION

      public static final JDACScope PREPARATION
    • INTERACTION

      public static final JDACScope INTERACTION
  • Method Details

    • values

      public static JDACScope[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JDACScope valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • priority

      public int priority()
      Specified by:
      priority in interface Scope