@Experimental(value="Interceptor API to intercept resolution of a configuration name") public interface ConfigSourceInterceptor extends Serializable
This is useful to provide logging, transform names or substitute values.
Implementations of ConfigSourceInterceptor are loaded via the ServiceLoader mechanism and
can be registered by providing a resource named META-INF/services/io.smallrye.config.ConfigSourceInterceptor,
which contains the fully qualified ConfigSourceInterceptor implementation class name as its content.
Alternatively, a ConfigSourceInterceptor can also be loaded with a ConfigSourceInterceptorFactory.
A ConfigSourceInterceptor implementation class can specify a priority by way of the standard
javax.annotation.Priority annotation. If no priority is explicitly assigned, the default priority value
of io.smallrye.config.Priorities#APPLICATION is assumed. If multiple interceptors are registered with the
same priority, then their execution order may be non deterministic.
| Modifier and Type | Field and Description |
|---|---|
static ConfigSourceInterceptor |
EMPTY |
| Modifier and Type | Method and Description |
|---|---|
ConfigValue |
getValue(ConfigSourceInterceptorContext context,
String name)
Intercept the resolution of a configuration name and either return the corresponding
ConfigValue or a
custom ConfigValue built by the interceptor. |
default Iterator<String> |
iterateNames(ConfigSourceInterceptorContext context)
Intercept the resolution of the configuration names.
|
default Iterator<ConfigValue> |
iterateValues(ConfigSourceInterceptorContext context)
Intercept the resolution of the configuration
ConfigValue. |
static final ConfigSourceInterceptor EMPTY
ConfigValue getValue(ConfigSourceInterceptorContext context, String name)
ConfigValue or a
custom ConfigValue built by the interceptor. Calling
ConfigSourceInterceptorContext.proceed(String) will continue to execute the interceptor chain. The chain
can be short-circuited by returning another instance of ConfigValue.context - the interceptor context. See ConfigSourceInterceptorContextname - the configuration name being intercepted.ConfigValue with information about the name, value, config source and ordinal, or null
if the value isn't present.default Iterator<String> iterateNames(ConfigSourceInterceptorContext context)
ConfigSourceInterceptorContext.iterateNames() will continue to execute the interceptor chain. The chain
can be short-circuited by returning another instance of the Iterator.context - the interceptor context. See ConfigSourceInterceptorContextdefault Iterator<ConfigValue> iterateValues(ConfigSourceInterceptorContext context)
ConfigValue. Calling
ConfigSourceInterceptorContext.iterateNames() will continue to execute the interceptor chain. The chain
can be short-circuited by returning another instance of the Iterator.context - the interceptor context. See ConfigSourceInterceptorContextConfigValue with information about the name, value, config source and ordinal.Copyright © 2018–2021. All rights reserved.