Interface ConfigSourceInterceptor
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractMappingConfigSourceInterceptor,ExpressionConfigSourceInterceptor,FallbackConfigSourceInterceptor,LoggingConfigSourceInterceptor,ProfileConfigSourceInterceptor,RelocateConfigSourceInterceptor,SecretKeysConfigSourceInterceptor
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
jakarta.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.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetValue(ConfigSourceInterceptorContext context, String name) Intercept the resolution of a configuration name and either return the correspondingConfigValueor a customConfigValuebuilt by the interceptor.Intercept the resolution of the configuration names.
-
Field Details
-
EMPTY
-
-
Method Details
-
getValue
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
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.
-