Interface BeanRegistry

  • All Known Implementing Classes:
    ContextualBeanRegistry

    public interface BeanRegistry
    The Interface BeanRegistry.
    Since:
    2012. 11. 9.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean containsBean​(java.lang.Class<?> type)
      Return whether a bean with the specified object type is present.
      boolean containsBean​(java.lang.Class<?> type, java.lang.String id)  
      boolean containsBean​(java.lang.String id)
      Return whether a bean with the specified id is present.
      void destroySingleton​(java.lang.Object bean)  
      java.util.Collection<java.lang.Class<?>> findConfigBeanClassesWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)  
      <T> T getBean​(java.lang.Class<T> type)
      Returns the bean instance that uniquely matches the given object type.
      <T> T getBean​(java.lang.Class<T> type, java.lang.String id)
      Returns an instance of the bean that matches the given object type.
      <T> T getBean​(java.lang.String id)
      Returns an instance of the bean that matches the given id.
      <T> T[] getBeansOfType​(java.lang.Class<T> type)  
      <T> T getPrototypeScopeBean​(BeanRule beanRule)  
      boolean hasSingleton​(java.lang.Class<?> type)  
      boolean hasSingleton​(java.lang.Class<?> type, java.lang.String id)  
      boolean hasSingleton​(java.lang.Object bean)  
    • Method Detail

      • getBean

        <T> T getBean​(java.lang.String id)
        Returns an instance of the bean that matches the given id.
        Type Parameters:
        T - the generic type
        Parameters:
        id - the id of the bean to retrieve
        Returns:
        an instance of the bean
      • getBean

        <T> T getBean​(java.lang.Class<T> type)
        Returns the bean instance that uniquely matches the given object type.
        Type Parameters:
        T - the generic type
        Parameters:
        type - the type the bean must match; can be an interface or superclass
        Returns:
        an instance of the bean
        Since:
        1.3.1
      • getBean

        <T> T getBean​(java.lang.Class<T> type,
                      java.lang.String id)
        Returns an instance of the bean that matches the given object type. If more than one matching bean is found, we pick a bean that matches the given id.
        Type Parameters:
        T - the generic type
        Parameters:
        type - type the bean must match; can be an interface or superclass
        id - the id of the bean to retrieve
        Returns:
        an instance of the bean
        Since:
        2.0.0
      • getBeansOfType

        <T> T[] getBeansOfType​(java.lang.Class<T> type)
      • getPrototypeScopeBean

        <T> T getPrototypeScopeBean​(BeanRule beanRule)
      • containsBean

        boolean containsBean​(java.lang.String id)
        Return whether a bean with the specified id is present.
        Parameters:
        id - the id of the bean to query
        Returns:
        whether a bean with the specified id is present
      • containsBean

        boolean containsBean​(java.lang.Class<?> type)
        Return whether a bean with the specified object type is present.
        Parameters:
        type - the object type of the bean to query
        Returns:
        whether a bean with the specified type is present
      • containsBean

        boolean containsBean​(java.lang.Class<?> type,
                             java.lang.String id)
      • findConfigBeanClassesWithAnnotation

        java.util.Collection<java.lang.Class<?>> findConfigBeanClassesWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      • hasSingleton

        boolean hasSingleton​(java.lang.Object bean)
      • hasSingleton

        boolean hasSingleton​(@NonNull
                             java.lang.Class<?> type)
      • hasSingleton

        boolean hasSingleton​(java.lang.Class<?> type,
                             java.lang.String id)
      • destroySingleton

        void destroySingleton​(java.lang.Object bean)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception