- All Implemented Interfaces:
- Provider
AbstractProvider that can return Values backed
 by System properties.
 While System properties are often casually assumed to be stable
 and String-typed, the exact opposite is true: System
 properties may contain arbitrarily-typed Objects under
 arbitrarily-typed keys, and the properties themselves may be replaced at any point.
 This means that all Values supplied by this SystemPropertyProvider are non-deterministic and may change type and presence from one call
 to another.
It is also worth mentioning explicitly that, deliberately, no type conversion of any System property value takes place in this class.
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a newSystemPropertyProviderthat uses flat keys, does not presume that the only things stored in the System properties areStrings, and honors the fact that System properties are mutable.SystemPropertyProvider(boolean flatKeys, boolean onlyStrings, boolean mutable) Creates a newSystemPropertyProvider.
- 
Method SummaryModifier and TypeMethodDescriptionprotected Supplier<?>protected static final StringOverrides theAbstractProvider.path(Loader, Path)method to return a (relative)Pathconsisting solely of the last element of the suppliedabsolutePath.Methods inherited from class org.microbean.loader.spi.AbstractProviderget, lowerBound
- 
Constructor Details- 
SystemPropertyProviderpublic SystemPropertyProvider()Creates a newSystemPropertyProviderthat uses flat keys, does not presume that the only things stored in the System properties areStrings, and honors the fact that System properties are mutable.
- 
SystemPropertyProviderCreates a newSystemPropertyProvider.- Parameters:
- flatKeys- whether the key for a system property is derived from a- Path's last element's name only
- onlyStrings- whether all System properties are expected to be- String-typed
- mutable- whether System properties should be treated as mutable (which they are, strictly speaking, but for many applications this may not matter in practice)
 
 
- 
- 
Method Details- 
findReturns aSuppliersuitable for the System property represented by the suppliedPath.This method never returns null. Its overrides may if they wish.The name of the last element of the supplied Pathis taken to be the name of the System property value to retrieve. If the type erasure of the suppliedPath'squalified()method is assignable fromString.class, then calls will be made by the returnedValue'sget()method toSystem.getProperty(String)before simple calls toSystem.getProperties().get(String).Any Supplierreturned by this method will be non-deterministic, since system properties may change at any point. Additionally, if the suppliedPath's type is not assignable from that borne by a System property value, then theSupplierwill returnnullfrom itsget()method in such a case, indicating that the value is present but cannot be represented. Overrides are strongly encouraged to abide by these conditions.- Specified by:
- findin class- AbstractProvider
- Parameters:
- requestor- the- Loaderseeking a- Value; must not be- null
- absolutePath- an absolute- Pathfor which a- Valueis being sought; must not be- null
- Returns:
- a Suppliersuitable for the System property whose name is represented by the suppliedPath's lastElement's name
- Throws:
- NullPointerException- if an argument for either parameter is- null
- See Also:
- Idempotency:
- This method is idempotent and deterministic.
 Overrides must be idempotent, but need not be deterministic.
 Suppliers returned by this method or its overrides are not guaranteed to be idempotent or deterministic.
- Nullability:
- This method never returns nullbut its overrides may.
- Thread Safety:
- This method is, and its overrides must be, safe for concurrent use by multiple threads.
 
- 
pathOverrides theAbstractProvider.path(Loader, Path)method to return a (relative)Pathconsisting solely of the last element of the suppliedabsolutePath.- Overrides:
- pathin class- AbstractProvider
- Type Parameters:
- T- the type of both the supplied and returned- Paths
- Parameters:
- requestor- the- Loaderseeking a- Value; must not be- null
- absolutePath- an absolute- Pathfor which a- Valueis being sought; must not be- null
- Returns:
- a Paththat will be used to build aValueto be returned by theAbstractProvider.get(Loader, Path)method
- See Also:
- Idempotency:
- This method is, and its overrides must be, idempotent and deterministic.
- Nullability:
- This method does not, but overrides may, return
 null.
- Thread Safety:
- This method is, and its overrides must be, safe for concurrent use by multiple threads.
 
- 
key- Parameters:
- path- the- Pathin question; must not be- null
- flat- whether the key is derived from the supplied- Path's last element's name only
- Returns:
- a Stringrepresentation of the suppliedPath
- Throws:
- NullPointerException- if- pathis- null
- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns null.
- Thread Safety:
- This method is safe for concurrent use by multiple threads.
 
 
-