Package org.pipservices3.commons.config
Interface IConfigurable
- All Known Subinterfaces:
IReconfigurable
- All Known Implementing Classes:
DependencyResolver
public interface IConfigurable
An interface to set configuration parameters to an object.
It can be added to any existing class by implementing a single configure()
method.
If you need to emphasis the fact that configure()
method can be called multiple times
to change object configuration in runtime, use IReconfigurable
interface instead.
### Example ###
public class MyClass implements IConfigurable {
private String _myParam = "default value";
public void configure(ConfigParams config) {
this._myParam = config.getAsStringWithDefault("options.param", myParam);
...
}
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(ConfigParams config) Configures object by passing configuration parameters.
-
Method Details
-
configure
Configures object by passing configuration parameters.- Parameters:
config
- configuration parameters to be set.- Throws:
ConfigException
- when configuration is wrong
-