- All Known Implementing Classes:
AbstractProvider
,AbstractTreeBasedProvider
,ConfigSourceProvider
,EnvironmentVariableProvider
,InputStreamJacksonProvider
,JacksonProvider
,JsonProvider
,PropertiesProvider
,ProxyingProvider
,SystemPropertyProvider
,TomlProvider
,TypesafeConfigHoconProvider
,YamlProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Value
s that might be suitable for a
Loader
implementation to return.
Provider
instances are subordinate to DefaultLoader
.
Any Provider
implementation must have a public
constructor that has no arguments.
- Author:
- Laird Nelson
- See Also:
-
Method Details
-
lowerBound
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.- Returns:
- a
Type
representing the lower type bound of all possible values supplied by thisProvider
, ornull
to indicate the lowest possible type bound - Idempotency:
- This method is, and overrides of this method must be, idempotent and deterministic.
- Nullability:
- This method always does, and overrides often may,
return
null
. - Thread Safety:
- This method is, and overrides of this method must be, safe for concurrent use by multiple threads.
-
get
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.
- 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 - Throws:
NullPointerException
- if eitherrequestor
orabsolutePath
isnull
IllegalArgumentException
- ifabsolutePath
is not absolute, or if!absolutePath.startsWith(requestor.absolutePath())
, or ifabsolutePath.equals(requestor.absolutePath())
- Idempotency:
- Implementations of this method must be idempotent but are not assumed to be deterministic.
- Nullability:
- Implementations of this method may return
null
. - Thread Safety:
- Implementations of this method must be safe for concurrent use by multiple threads.
-