const classafIoc::StrategyRegistry

sys::Obj
  afIoc::StrategyRegistry

A helper class that looks up Objs via Type inheritance search.

clearCache

Source

Void clearCache()

Clears the lookup caches

findAllChildren

Source

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

Source

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

Source

Obj? findExactMatch(Type exact, Bool checked := true)

Standard Map behaviour - looks up an Obj via the type.

make

Source

new make(Type:Obj? values)

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.