Class AbstractBeanRegistry

    • Method Detail

      • getBean

        public <T> T getBean​(java.lang.String id)
        Description copied from interface: BeanRegistry
        Return an instance of the bean that matches the given id.
        Specified by:
        getBean in interface BeanRegistry
        Type Parameters:
        T - the generic type
        Parameters:
        id - the id of the bean to retrieve
        Returns:
        an instance of the bean
      • getBean

        public <T> T getBean​(java.lang.Class<T> requiredType)
        Description copied from interface: BeanRegistry
        Return an instance of the bean that matches the given object type.
        Specified by:
        getBean in interface BeanRegistry
        Type Parameters:
        T - the generic type
        Parameters:
        requiredType - the type the bean must match; can be an interface or superclass. null is disallowed.
        Returns:
        an instance of the bean
      • getBean

        public <T> T getBean​(java.lang.String id,
                             java.lang.Class<T> requiredType)
        Description copied from interface: BeanRegistry
        Return an instance of the bean that matches the given id. If the bean is not of the required type then throw a BeanNotOfRequiredTypeException.
        Specified by:
        getBean in interface BeanRegistry
        Type Parameters:
        T - the generic type
        Parameters:
        id - the id of the bean to retrieve
        requiredType - type the bean must match; can be an interface or superclass. null is disallowed.
        Returns:
        an instance of the bean
      • getBean

        public <T> T getBean​(java.lang.Class<T> requiredType,
                             java.lang.String id)
        Description copied from interface: BeanRegistry
        Return an instance of the bean that matches the given object type. If the bean is not exists ,retrieve the bean with the specified id.
        Specified by:
        getBean in interface BeanRegistry
        Type Parameters:
        T - the generic type
        Parameters:
        requiredType - type the bean must match; can be an interface or superclass. null is allowed.
        id - the id of the bean to retrieve; if requiredType is null.
        Returns:
        an instance of the bean
      • getConfigBean

        public <T> T getConfigBean​(java.lang.Class<T> requiredType)
        Description copied from interface: BeanRegistry
        Return the bean instance that matches the specified object type. If the bean is not of the required type then throw a BeanNotOfRequiredTypeException.
        Specified by:
        getConfigBean in interface BeanRegistry
        Type Parameters:
        T - the generic type
        Parameters:
        requiredType - type the bean must match; can be an interface or superclass. null is disallowed.
        Returns:
        an instance of the bean
      • containsBean

        public boolean containsBean​(java.lang.String id)
        Description copied from interface: BeanRegistry
        Return whether a bean with the specified id is present.
        Specified by:
        containsBean in interface BeanRegistry
        Parameters:
        id - the id of the bean to query
        Returns:
        whether a bean with the specified id is present
      • containsBean

        public boolean containsBean​(java.lang.Class<?> requiredType)
        Description copied from interface: BeanRegistry
        Return whether a bean with the specified object type is present.
        Specified by:
        containsBean in interface BeanRegistry
        Parameters:
        requiredType - the object type of the bean to query
        Returns:
        whether a bean with the specified type is present
      • getBean

        protected abstract <T> T getBean​(BeanRule beanRule)