IConfigurable

An interface used to set configuration parameters to an object.

See also ConfigParams

Description

IConfigurable is an interface used to set configuration parameters. It can be implemented by any class that needs to define configuration parameters, such as access control credentials.

Important points

  • A class that implements this interface needs to implement a single Configure() method.
  • If you need to emphasize the fact that Configure() method can be called multiple times to change object configuration in runtime, use the IReconfigurable interface instead.

Instance methods

Configure

Configures a component by passing its configuration parameters.

void Configure(ConfigParams config)

  • config: ConfigParams - configuration parameters to be set.

Examples

public class MyClass: IConfigurable 
{
    private var _myParam = "default value";
    public Task configure(ConfigParams config)
    {
        this._myParam = config.getAsStringWithDefault("options.param", myParam);
        ...
    }
}

See also