java.lang.Object
io.inverno.mod.base.Scope<T>
io.inverno.mod.base.KeyScope<T>
- Type Parameters:
T
- the type of the scoped instances
A key scope is used to provide bean instances bound to an arbitrary key.
- Since:
- 1.2
- Author:
- Jeremy Kuhn
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
KeyScope
public KeyScope()Creates a key scope.
-
-
Method Details
-
hookOnGet
Optional hook executed when an instance is retrieved.
- Parameters:
instance
- the instance
-
get
Returns the instance bound to the specified key.
If no instance is bound to the key, a new instance is created and kept in the scope.
- Parameters:
key
- the key defining the scope of the instance- Returns:
- the instance
-
remove
Removes the instance currently bound to the specified key.
- Parameters:
key
- the key defining the scope of the instance
-