Class ConfigSourceProvider
- All Implemented Interfaces:
Provider
Provider
that uses a MicroProfile Config ConfigSource
and
MicroProfile Config Converter
s to
produce Value
s.- Author:
- Laird Nelson
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A coupling of aType
, a priority (as defined in the MicroProfile Config specification), and aConverter
. -
Constructor Summary
ConstructorDescriptionConfigSourceProvider
(ConfigSource configSource, Collection<? extends ConfigSourceProvider.ConverterRegistration<?>> converterRegistrations) Creates a newConfigSourceProvider
.ConfigSourceProvider
(ConfigSource configSource, Map<? extends Type, ? extends Converter<?>> converters) Creates a newConfigSourceProvider
. -
Method Summary
-
Constructor Details
-
ConfigSourceProvider
public ConfigSourceProvider(ConfigSource configSource, Map<? extends Type, ? extends Converter<?>> converters) Creates a newConfigSourceProvider
.- Parameters:
configSource
- theConfigSource
whose getValue(String) method will be used to backValue
s produced by theget(Loader, Path)
method; must not benull
converters
- aMap
ofConverter
s indexed by their conversionType
; may benull
- Throws:
NullPointerException
- ifconfigSource
isnull
-
ConfigSourceProvider
public ConfigSourceProvider(ConfigSource configSource, Collection<? extends ConfigSourceProvider.ConverterRegistration<?>> converterRegistrations) Creates a newConfigSourceProvider
.- Parameters:
configSource
- theConfigSource
whose getValue(String) method will be used to backValue
s produced by theget(Loader, Path)
method; must not benull
converterRegistrations
- aCollection
ofConfigSourceProvider.ConverterRegistration
s; may benull
- Throws:
NullPointerException
- ifconfigSource
isnull
- See Also:
-
-
Method Details
-
lowerBound
Description copied from interface:Provider
Returns aType
representing the lower type bound of all possible values supplied by thisProvider
.Often the value returned by implementations of this method is no more specific than the lowest possible type, which is
null
, meaning that theProvider
has a chance of producing aValue
for any requested type.A return value of, for example,
String.class
indicates that theProvider
may satisfy requests forString.class
, or any of its supertypes (such asCharSequence
orObject
), but cannot satisfy requests forInteger.class
, for example.A return value of
Object.class
would be extremely unusual and would indicate a maximally opaque type, i.e. only requests for exactlyObject.class
have the possibility of being satisfied by thisProvider
. Such a return value is possible, but rarely used, andProvider
implementations are urged to consider returning a differentType
.Note that this method is used solely to help eliminate types from consideration, not permit them. That is, although
Provider
may indicate via an implementation of this method that a givenType
is suitable, it is not thereby obliged to return aValue
corresponding to it from itsget(Loader, Path)
method implementation.The default implementation of this method returns
null
. ManyProvider
implementations will choose not to override this method. -
get
Description copied from interface:Provider
Returns aValue
suitable for the suppliedLoader
andPath
, ornull
if there is no suchValue
now and if there never will be such aValue
for the supplied arguments.In addition to the other requirements described here, the following assertions will be (and must be) true when this method is called in the normal course of events:
assert absolutePath.isAbsolute();
assert absolutePath.startsWith(requestor.absolutePath());
assert !absolutePath.equals(requestor.absolutePath());
If any caller does not honor these requirements, undefined behavior may result.
- Specified by:
get
in interfaceProvider
- Parameters:
requestor
- theLoader
seeking aValue
; must not benull
absolutePath
- an absolutePath
for which the suppliedLoader
is seeking a value; must not benull
- Returns:
- a
Value
more or less suitable for the combination of the suppliedLoader
andPath
, ornull
if there is no suchValue
now and if there never will be such aValue
for the supplied arguments
-