Interface ConfigSourceInterceptor
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractMappingConfigSourceInterceptor,ExpressionConfigSourceInterceptor,FallbackConfigSourceInterceptor,LoggingConfigSourceInterceptor,ProfileConfigSourceInterceptor,RelocateConfigSourceInterceptor,SecretKeysConfigSourceInterceptor,SecretKeysHandlerConfigSourceInterceptor
public interface ConfigSourceInterceptor extends Serializable
The ConfigSourceInterceptor allows to intercept the resolution of a configuration name before the configuration value is resolved by the Config and before any conversion taking place. It can also intercept iteration of configuration names and values.This is useful to provide logging, transform names or substitute values.
Implementations of
ConfigSourceInterceptorare loaded via theServiceLoadermechanism and can be registered by providing a resource namedMETA-INF/services/io.smallrye.config.ConfigSourceInterceptor, which contains the fully qualifiedConfigSourceInterceptorimplementation class name as its content.Alternatively, a
ConfigSourceInterceptorcan also be loaded with aConfigSourceInterceptorFactory.A
ConfigSourceInterceptorimplementation class can specify a priority by way of the standardjakarta.annotation.Priorityannotation. If no priority is explicitly assigned, the default priority value ofio.smallrye.config.Priorities#APPLICATIONis assumed. If multiple interceptors are registered with the same priority, then their execution order may be non deterministic.
-
-
Field Summary
Fields Modifier and Type Field Description static ConfigSourceInterceptorEMPTY
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description ConfigValuegetValue(ConfigSourceInterceptorContext context, String name)Intercept the resolution of a configuration name and either return the correspondingConfigValueor a customConfigValuebuilt by the interceptor.default Iterator<String>iterateNames(ConfigSourceInterceptorContext context)Intercept the resolution of the configuration names.default Iterator<ConfigValue>iterateValues(ConfigSourceInterceptorContext context)Deprecated, for removal: This API element is subject to removal in a future version.
-
-
-
Field Detail
-
EMPTY
static final ConfigSourceInterceptor EMPTY
-
-
Method Detail
-
getValue
ConfigValue getValue(ConfigSourceInterceptorContext context, String name)
Intercept the resolution of a configuration name and either return the correspondingConfigValueor a customConfigValuebuilt by the interceptor. CallingConfigSourceInterceptorContext.proceed(String)will continue to execute the interceptor chain. The chain can be short-circuited by returning another instance ofConfigValue.- Parameters:
context- the interceptor context. SeeConfigSourceInterceptorContextname- the configuration name being intercepted.- Returns:
- a
ConfigValuewith information about the name, value, config source and ordinal, ornullif the value isn't present.
-
iterateNames
default Iterator<String> iterateNames(ConfigSourceInterceptorContext context)
Intercept the resolution of the configuration names. The Iterator names may be a subset of the total names retrieved from all the registered ConfigSources. CallingConfigSourceInterceptorContext.iterateNames()will continue to execute the interceptor chain. The chain can be short-circuited by returning another instance of the Iterator.- Parameters:
context- the interceptor context. SeeConfigSourceInterceptorContext- Returns:
- an Iterator of Strings with configuration names.
-
iterateValues
@Deprecated(forRemoval=true) default Iterator<ConfigValue> iterateValues(ConfigSourceInterceptorContext context)
Deprecated, for removal: This API element is subject to removal in a future version.Intercept the resolution of the configurationConfigValue. CallingConfigSourceInterceptorContext.iterateNames()will continue to execute the interceptor chain. The chain can be short-circuited by returning another instance of the Iterator.- Parameters:
context- the interceptor context. SeeConfigSourceInterceptorContext- Returns:
- an Iterator of
ConfigValuewith information about the name, value, config source and ordinal.
-
-