Class DefaultScopeContainer
java.lang.Object
com.cumulocity.microservice.context.scope.DefaultScopeContainer
- All Implemented Interfaces:
ScopeContainer
Implements a scope container.
- Author:
- Darek Kaczynski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDestructionCallback(String name, Runnable callback) Adds a detruction callback for the bean of given name.voidclear()Clears the container destroying all contained beans.booleanChecks if a bean of given name is present within the container.Gets the given bean by name.Gets the names of all beans within the container.voidPuts a bean of given name into the container.removeObject(String name) Removes the bean of given name from the container.
-
Constructor Details
-
DefaultScopeContainer
public DefaultScopeContainer()
-
-
Method Details
-
getObjectNames
Description copied from interface:ScopeContainerGets the names of all beans within the container.- Specified by:
getObjectNamesin interfaceScopeContainer- Returns:
- the list of contained bean names.
-
contains
Description copied from interface:ScopeContainerChecks if a bean of given name is present within the container.- Specified by:
containsin interfaceScopeContainer- Parameters:
name- the name of the bean to check.- Returns:
- true if the bean was found, false otherwise.
-
getObject
Description copied from interface:ScopeContainerGets the given bean by name.- Specified by:
getObjectin interfaceScopeContainer- Parameters:
name- the name of the bean to retrieve.- Returns:
- the bean of given name, or
nullif was not contained.
-
putObject
Description copied from interface:ScopeContainerPuts a bean of given name into the container.- Specified by:
putObjectin interfaceScopeContainer- Parameters:
name- the bean name to put.obj- the bean instance to put.
-
removeObject
Description copied from interface:ScopeContainerRemoves the bean of given name from the container.- Specified by:
removeObjectin interfaceScopeContainer- Parameters:
name- the name of the bean to remove.- Returns:
- the removed bean, or
nullif it was not contained.
-
addDestructionCallback
Description copied from interface:ScopeContainerAdds a detruction callback for the bean of given name. All added callbacks will be run upon bean removal from the container.- Specified by:
addDestructionCallbackin interfaceScopeContainer- Parameters:
name- the name of the bean to register callback for.callback- the destrution callback to register.
-
clear
public void clear()Description copied from interface:ScopeContainerClears the container destroying all contained beans.- Specified by:
clearin interfaceScopeContainer
-