APIs¶
PropertyManager is very simple to use. The basic usage costs only of the following public API
public static Optional<String> get(String key);
that can be used as follows
Properties.get("mypropertyname");
Automatically the PropertyManager will implement all the fallback procedure accordingly to the supplied configuration.
The returned value is a java.util.Optional over which it’s a good practice to perform some verification.
Advanced usage¶
PropertyManager provides also a builder that allows to inject external dependencies, like other RemotePropertyGetter.
The class is PropertiesBuilder that can be used as follows:
PropertiesBuilder.getInstance()
.hasFileGetter(getterFromFile)
.hasEnvGetter(getterFromEnvironment)
.hasRemoteGetter(remoteGetterInstance)
.configure();
Such a method can be used to configure the entire PropertyManager instance.