const classafIoc::StrategyRegistry
sys::Obj afIoc::StrategyRegistry
A helper class that looks up Objs via Type inheritance search.
- clearCache
Void clearCache()
Clears the lookup caches
- findAllChildren
Obj?[] findAllChildren(Type type)
Returns the values of the children of the given type. Example:
strategy := StrategyRegistry( [Obj#:1, Num#:2, Int#:3] ) strategy.findChildrenOf(Obj#) // --> [1, 2, 3] strategy.findChildrenOf(Num#) // --> [2, 3] strategy.findChildrenOf(Float#) // --> [,]
- findClosestParent
Obj? findClosestParent(Type type, Bool checked := true)
Returns the value of the closest parent of the given type. Example:
strategy := StrategyRegistry( [Obj#:1, Num#:2, Int#:3] ) strategy.findClosestParent(Obj#) // --> 1 strategy.findClosestParent(Num#) // --> 2 strategy.findClosestParent(Float#) // --> 2
- findExactMatch
Obj? findExactMatch(Type exact, Bool checked := true)
Standard Map behaviour - looks up an Obj via the type.
- make
Creates an StrategyRegistry with the given list. All types are coerced to non-nullable types. An
Err
is thrown if a duplicate is found in the process.