Enum Class ConfigScope

java.lang.Object
java.lang.Enum<ConfigScope>
ru.vyarus.dropwizard.guice.module.context.ConfigScope
All Implemented Interfaces:
Serializable, Comparable<ConfigScope>, Constable

public enum ConfigScope extends Enum<ConfigScope>
Enum with type constants used for marking special configuration scopes. Guicey bundles are also scopes: all items registered by guicey bunlde is scoped with bundle type.

Scope represents configuration source (configuration entry point). Because bundle could be installed multiple times - it would multiple scopes with the same class and to identify scopes special abstraction is used: ItemId:combination of type + instance identity.

Since:
16.04.2018
  • Enum Constant Details

    • Application

      public static final ConfigScope Application
      Application scope: everything registered directly in guice bundle's builder.
    • BundleLookup

      public static final ConfigScope BundleLookup
      Lookup scope contains all bundles, resolved with lookup mechanism.
    • ClasspathScan

      public static final ConfigScope ClasspathScan
      Everything resolved with classpath scan.
    • Hook

      public static final ConfigScope Hook
      All configurations done by GuiceyConfigurationHook (most likely in integration tests).
    • GuiceyBundle

      public static final ConfigScope GuiceyBundle
      WARNING: guicey bundle scope is bundle class itself. Constant is useless for direct usage! It was added just for completeness of context recognition logic (see recognize(Class)) and to indicate all possible scopes.
    • DropwizardBundle

      public static final ConfigScope DropwizardBundle
      WARNING: dropwizard bundle scope is bundle class itself. Constant is useless for direct usage! It was added just for completeness of context recognition logic (see recognize(Class)) and to indicate all possible scopes.
    • Module

      public static final ConfigScope Module
      WARNING: binding extension scope is guice module name itself (not direct module, but topmost registered module - visible in configuration). It was added just for completeness of context recognition logic (see recognize(Class)) and to indicate all possible scopes.
    • OptionalExtensionDisable

      public static final ConfigScope OptionalExtensionDisable
      Special scope for optional extensions automatic disabling (when no matching installer available). Extra scope is required to differentiate automatic disabling from manual.
  • Method Details

    • values

      public static ConfigScope[] 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 ConfigScope 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
    • getType

      public Class<?> getType()
      Returns:
      class used for special scope identification
    • getKey

      public ItemId getKey()
      Returns:
      scope key
    • allExcept

      public static Class[] allExcept(ConfigScope scope)
      Useful for hiding all special scopes except one in diagnostic report.
      Parameters:
      scope - scope to exclude
      Returns:
      all special scopes except provided
    • recognize

      public static ConfigScope recognize(ItemId id)
      Shortcut for recognize(Class).
      Parameters:
      id - scope key
      Returns:
      recognized scope type
    • recognize

      public static ConfigScope recognize(Class<?> type)
      Scope recognition logic may be used in configuration analyzers to easily detect item scope.
      Parameters:
      type - type to recognize scope
      Returns:
      recognized scope
      Throws:
      IllegalStateException - is scope is not recognizable