Class PropertiesConfigProvider
java.lang.Object
io.javaoperatorsdk.operator.config.loader.provider.PropertiesConfigProvider
- All Implemented Interfaces:
ConfigProvider
A
ConfigProvider that resolves configuration values from a Properties file.
Keys are looked up as-is against the loaded properties. Supported value types are: String, Boolean, Integer, Long, Double, and Duration (ISO-8601 format, e.g. PT30S).
-
Constructor Summary
ConstructorsConstructorDescriptionLoads properties from the given file path.PropertiesConfigProvider(Path path) Loads properties from the given file path.PropertiesConfigProvider(Properties properties) Uses the suppliedPropertiesinstance directly. -
Method Summary
Modifier and TypeMethodDescription<T> Optional<T>Returns the value associated withkey, converted totype, or an emptyOptionalif the key is not set.static PropertiesConfigProviderReturns aPropertiesConfigProviderbacked bySystem.getProperties().
-
Constructor Details
-
PropertiesConfigProvider
Loads properties from the given file path.- Throws:
UncheckedIOException- if the file cannot be read. Does not throw an exception if the file does not exist.
-
PropertiesConfigProvider
Loads properties from the given file path.- Throws:
UncheckedIOException- if the file cannot be read. Does not throw an exception if the file does not exist.
-
PropertiesConfigProvider
Uses the suppliedPropertiesinstance directly.
-
-
Method Details
-
systemProperties
Returns aPropertiesConfigProviderbacked bySystem.getProperties(). -
getValue
Description copied from interface:ConfigProviderReturns the value associated withkey, converted totype, or an emptyOptionalif the key is not set.- Specified by:
getValuein interfaceConfigProvider- Type Parameters:
T- the value type- Parameters:
key- the dot-separated configuration key, e.g.josdk.cache.sync.timeouttype- the expected type of the value; supported types depend on the implementation- Returns:
- an
Optionalcontaining the typed value, or empty if the key is absent
-