Class ConfigSourceProvider
- All Implemented Interfaces:
Provider
Provider that uses a MicroProfile Config ConfigSource and
MicroProfile Config Converters to
produce Values.- Author:
- Laird Nelson
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA coupling of aType, a priority (as defined in the MicroProfile Config specification), and aConverter. -
Constructor Summary
ConstructorsConstructorDescriptionConfigSourceProvider(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- theConfigSourcewhose getValue(String) method will be used to backValues produced by theget(Loader, Path)method; must not benullconverters- aMapofConverters indexed by their conversionType; may benull- Throws:
NullPointerException- ifconfigSourceisnull
-
ConfigSourceProvider
public ConfigSourceProvider(ConfigSource configSource, Collection<? extends ConfigSourceProvider.ConverterRegistration<?>> converterRegistrations) Creates a newConfigSourceProvider.- Parameters:
configSource- theConfigSourcewhose getValue(String) method will be used to backValues produced by theget(Loader, Path)method; must not benullconverterRegistrations- aCollectionofConfigSourceProvider.ConverterRegistrations; may benull- Throws:
NullPointerException- ifconfigSourceisnull- See Also:
-
-
Method Details
-
lowerBound
Description copied from interface:ProviderReturns aTyperepresenting 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 theProviderhas a chance of producing aValuefor any requested type.A return value of, for example,
String.classindicates that theProvidermay satisfy requests forString.class, or any of its supertypes (such asCharSequenceorObject), but cannot satisfy requests forInteger.class, for example.A return value of
Object.classwould be extremely unusual and would indicate a maximally opaque type, i.e. only requests for exactlyObject.classhave the possibility of being satisfied by thisProvider. Such a return value is possible, but rarely used, andProviderimplementations 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
Providermay indicate via an implementation of this method that a givenTypeis suitable, it is not thereby obliged to return aValuecorresponding to it from itsget(Loader, Path)method implementation.The default implementation of this method returns
null. ManyProviderimplementations will choose not to override this method. -
get
Description copied from interface:ProviderReturns aValuesuitable for the suppliedLoaderandPath, ornullif there is no suchValuenow and if there never will be such aValuefor 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:
getin interfaceProvider- Parameters:
requestor- theLoaderseeking aValue; must not benullabsolutePath- an absolutePathfor which the suppliedLoaderis seeking a value; must not benull- Returns:
- a
Valuemore or less suitable for the combination of the suppliedLoaderandPath, ornullif there is no suchValuenow and if there never will be such aValuefor the supplied arguments
-