Class DefaultScopeContainer

java.lang.Object
com.cumulocity.microservice.context.scope.DefaultScopeContainer
All Implemented Interfaces:
ScopeContainer

public class DefaultScopeContainer extends Object implements ScopeContainer
Implements a scope container.
Author:
Darek Kaczynski
  • Constructor Details

    • DefaultScopeContainer

      public DefaultScopeContainer()
  • Method Details

    • getObjectNames

      public Set<String> getObjectNames()
      Description copied from interface: ScopeContainer
      Gets the names of all beans within the container.
      Specified by:
      getObjectNames in interface ScopeContainer
      Returns:
      the list of contained bean names.
    • contains

      public boolean contains(String name)
      Description copied from interface: ScopeContainer
      Checks if a bean of given name is present within the container.
      Specified by:
      contains in interface ScopeContainer
      Parameters:
      name - the name of the bean to check.
      Returns:
      true if the bean was found, false otherwise.
    • getObject

      public Object getObject(String name)
      Description copied from interface: ScopeContainer
      Gets the given bean by name.
      Specified by:
      getObject in interface ScopeContainer
      Parameters:
      name - the name of the bean to retrieve.
      Returns:
      the bean of given name, or null if was not contained.
    • putObject

      public void putObject(String name, Object obj)
      Description copied from interface: ScopeContainer
      Puts a bean of given name into the container.
      Specified by:
      putObject in interface ScopeContainer
      Parameters:
      name - the bean name to put.
      obj - the bean instance to put.
    • removeObject

      public Object removeObject(String name)
      Description copied from interface: ScopeContainer
      Removes the bean of given name from the container.
      Specified by:
      removeObject in interface ScopeContainer
      Parameters:
      name - the name of the bean to remove.
      Returns:
      the removed bean, or null if it was not contained.
    • addDestructionCallback

      public void addDestructionCallback(String name, Runnable callback)
      Description copied from interface: ScopeContainer
      Adds a detruction callback for the bean of given name. All added callbacks will be run upon bean removal from the container.
      Specified by:
      addDestructionCallback in interface ScopeContainer
      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: ScopeContainer
      Clears the container destroying all contained beans.
      Specified by:
      clear in interface ScopeContainer