Enum ConfigScope
- java.lang.Object
-
- java.lang.Enum<ConfigScope>
-
- ru.vyarus.dropwizard.guice.module.context.ConfigScope
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ConfigScope>
public enum ConfigScope extends java.lang.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 Summary
Enum Constants Enum Constant Description Application
Application scope: everything registered directly in guice bundle's builder.BundleLookup
Lookup scope contains all bundles, resolved with lookup mechanism.ClasspathScan
Everything resolved with classpath scan.DropwizardBundle
WARNING: dropwizard bundle scope is bundle class itself.GuiceyBundle
WARNING: guicey bundle scope is bundle class itself.Hook
All configurations done byGuiceyConfigurationHook
(most likely in integration tests).Module
WARNING: binding extension scope is guice module name itself (not direct module, but topmost registered module - visible in configuration).OptionalExtensionDisable
Special scope for optional extensions automatic disabling (when no matching installer available).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.Class[]
allExcept(ConfigScope scope)
Useful for hiding all special scopes except one in diagnostic report.ItemId
getKey()
java.lang.Class<?>
getType()
static ConfigScope
recognize(java.lang.Class<?> type)
Scope recognition logic may be used in configuration analyzers to easily detect item scope.static ConfigScope
recognize(ItemId id)
Shortcut forrecognize(Class)
.static ConfigScope
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ConfigScope[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 byGuiceyConfigurationHook
(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 (seerecognize(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 (seerecognize(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 (seerecognize(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 Detail
-
values
public static ConfigScope[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ConfigScope c : ConfigScope.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConfigScope valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getType
public java.lang.Class<?> getType()
- Returns:
- class used for special scope identification
-
getKey
public ItemId getKey()
- Returns:
- scope key
-
allExcept
public static java.lang.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 forrecognize(Class)
.- Parameters:
id
- scope key- Returns:
- recognized scope type
-
recognize
public static ConfigScope recognize(java.lang.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:
java.lang.IllegalStateException
- is scope is not recognizable
-
-