- 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.
Values 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 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.- Returns:
- a
Typerepresenting the lower type bound of all possible values supplied by thisProvider, ornullto 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 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.
- 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 - Throws:
NullPointerException- if eitherrequestororabsolutePathisnullIllegalArgumentException- ifabsolutePathis 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.
-