Class PolicyRegistry
What resolves a profile's control kind to the code that decides it: a built-in kind to its Controller, and a kind the library never shipped to the policy the factory registered under its name builds.
public sealed class PolicyRegistry
- Inheritance
-
PolicyRegistry
- Inherited Members
Remarks
One program then runs any manifest its registry covers.
Properties
Kinds
Gets the custom kinds registered, in name order.
public IReadOnlyList<string> Kinds { get; }
Property Value
Methods
Register(string, Func<IReadOnlyDictionary<string, object>, IPolicy>)
Registers the factory for a custom kind, replacing one of the same name.
public PolicyRegistry Register(string kind, Func<IReadOnlyDictionary<string, object>, IPolicy> factory)
Parameters
kindstringThe kind as a manifest names it, such as
frost_guard.factoryFunc<IReadOnlyDictionary<string, object>, IPolicy>Builds the policy from the parameters beside the kind, each a double, a bool, or a string.
Returns
- PolicyRegistry
The registry, for chaining.
Resolve(Profile)
Resolves a profile's control kind to the policy that decides it.
public IPolicy Resolve(Profile profile)
Parameters
profileProfileThe profile whose kind is resolved.
Returns
- IPolicy
A fresh policy; a built-in kind's Controller is the caller's to dispose.
Exceptions
- PamojaException
The kind is custom and no factory is registered for it, naming the kind and the one it was probably meant to be.