Class DefaultGenericFactory

java.lang.Object
de.hybris.platform.sap.core.common.util.DefaultGenericFactory
All Implemented Interfaces:
GenericFactory
Direct Known Subclasses:
TestGenericFactory

public class DefaultGenericFactory extends Object implements GenericFactory
Default implementation of the GenericFactory.
  • Constructor Details

    • DefaultGenericFactory

      public DefaultGenericFactory()
  • Method Details

    • getBean

      public <T> T getBean(String name)
      Description copied from interface: GenericFactory
      Return an instance for the class with the given alias.
      Specified by:
      getBean in interface GenericFactory
      Type Parameters:
      T - type of the bean
      Parameters:
      name - logical name used in the configuration file.
      Returns:
      instance of the class.
    • getBean

      public <T> T getBean(Class<T> type)
      Description copied from interface: GenericFactory
      Return an instance for the class to the given type.
      Specified by:
      getBean in interface GenericFactory
      Type Parameters:
      T - type of the bean
      Parameters:
      type - interface type.
      Returns:
      instance of the class.
    • getBean

      public Object getBean(String name, Object... args)
      Description copied from interface: GenericFactory
      Return an instance for the class with the given alias and constructor arguments.
      Specified by:
      getBean in interface GenericFactory
      Parameters:
      name - logical name used in the configuration file.
      args - Constructor arguments
      Returns:
      instance of the class.
    • removeBean

      public void removeBean(String beanName)
      Description copied from interface: GenericFactory
      Removes bean from current scope.
      Specified by:
      removeBean in interface GenericFactory
      Parameters:
      beanName - id or alias of the bean
    • getBeanNamesForType

      public String[] getBeanNamesForType(Class<?> type)
      Description copied from interface: GenericFactory
      Return the names of beans matching the given type (including subclasses), judging from either bean definitions or the value of getObjectType in the case of FactoryBeans.
      Specified by:
      getBeanNamesForType in interface GenericFactory
      Parameters:
      type - type of the requested beans
      Returns:
      the names of beans (or objects created by FactoryBeans) matching the given object type (including subclasses), or an empty array if none
    • findAnnotationOnBean

      public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
      Description copied from interface: GenericFactory
      Find a Annotation of annotationType on the specified bean, traversing its interfaces and super classes if no annotation can be found on the given class itself.
      Specified by:
      findAnnotationOnBean in interface GenericFactory
      Type Parameters:
      A - annotation
      Parameters:
      beanName - id or alias of the bean
      annotationType - requested annotation type
      Returns:
      the annotation of the given type found, or null