Class ContextFacade

java.lang.Object
org.openehealth.ipf.commons.core.config.ContextFacade

public class ContextFacade extends Object
Facade to an active registry, providing static access to their registered beans.

The ContextFacade is supposed to be used by Groovy Extension Modules that require a global piece of configuration or context. As Extension Modules are stateless, they have to obtain this information at runtime by means of statically access, i.e. calling the getBean methods of this class. Before this can be done, the registry must be set by calling setRegistry(Registry).

Since:
2.5
  • Constructor Details

    • ContextFacade

      public ContextFacade()
  • Method Details

    • setRegistry

      public static void setRegistry(Registry registry)
    • getBean

      public static <B> B getBean(Class<B> requiredType)
      Parameters:
      requiredType - required bean type
      Returns:
      bean of the required type
      Since:
      2.5
    • getBeans

      public static <B> Collection<B> getBeans(Class<B> requiredType)
      Parameters:
      requiredType - required bean type
      Returns:
      bean of the required type
      Since:
      3.5
    • getBean

      public static <B> B getBean(String beanName)
      Parameters:
      beanName - name
      Returns:
      bean of the required type
      Since:
      2.5
    • clearRegistry

      public static void clearRegistry()
      Empties the registry