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 configuration method that allows to inject external dependencies, like other RemotePropertyGetter.
The method is
public static void configure(PropertyGetter fileGetter, PropertyGetter envGetter, RemotePropertyGetter remoteGetter);
that can be used as follows
Properties.configure(myFileGetter, myEnvGetter, myRemoteGetter);
Such a method can be used to configure the entire PropertyManager instance.