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 java.lang.Object implements GenericFactory
Default implementation of the GenericFactory.
-
-
Constructor Summary
Constructors Constructor Description DefaultGenericFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A extends java.lang.annotation.Annotation>
AfindAnnotationOnBean(java.lang.String beanName, java.lang.Class<A> annotationType)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.<T> TgetBean(java.lang.Class<T> type)Return an instance for the class to the given type.<T> TgetBean(java.lang.String name)Return an instance for the class with the given alias.java.lang.ObjectgetBean(java.lang.String name, java.lang.Object... args)Return an instance for the class with the given alias and constructor arguments.java.lang.String[]getBeanNamesForType(java.lang.Class<?> type)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.voidremoveBean(java.lang.String beanName)Removes bean from current scope.
-
-
-
Method Detail
-
getBean
public <T> T getBean(java.lang.String name)
Description copied from interface:GenericFactoryReturn an instance for the class with the given alias.- Specified by:
getBeanin interfaceGenericFactory- 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(java.lang.Class<T> type)
Description copied from interface:GenericFactoryReturn an instance for the class to the given type.- Specified by:
getBeanin interfaceGenericFactory- Type Parameters:
T- type of the bean- Parameters:
type- interface type.- Returns:
- instance of the class.
-
getBean
public java.lang.Object getBean(java.lang.String name, java.lang.Object... args)Description copied from interface:GenericFactoryReturn an instance for the class with the given alias and constructor arguments.- Specified by:
getBeanin interfaceGenericFactory- Parameters:
name- logical name used in the configuration file.args- Constructor arguments- Returns:
- instance of the class.
-
removeBean
public void removeBean(java.lang.String beanName)
Description copied from interface:GenericFactoryRemoves bean from current scope.- Specified by:
removeBeanin interfaceGenericFactory- Parameters:
beanName- id or alias of the bean
-
getBeanNamesForType
public java.lang.String[] getBeanNamesForType(java.lang.Class<?> type)
Description copied from interface:GenericFactoryReturn 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:
getBeanNamesForTypein interfaceGenericFactory- 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 java.lang.annotation.Annotation> A findAnnotationOnBean(java.lang.String beanName, java.lang.Class<A> annotationType)Description copied from interface:GenericFactoryFind 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:
findAnnotationOnBeanin interfaceGenericFactory- Type Parameters:
A- annotation- Parameters:
beanName- id or alias of the beanannotationType- requested annotation type- Returns:
- the annotation of the given type found, or null
-
-