Interface GenericFactory
- All Known Implementing Classes:
DefaultGenericFactory,TestGenericFactory
public interface GenericFactory
Factory object in order to create spring bean instances.
-
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
AfindAnnotationOnBean(String beanName, 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> TReturn an instance for the class to the given type.<T> TReturn an instance for the class with the given alias.Return an instance for the class with the given alias and constructor arguments.String[]getBeanNamesForType(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(String beanName) Removes bean from current scope.
-
Method Details
-
getBean
Return an instance for the class with the given alias.- Type Parameters:
T- type of the bean- Parameters:
name- logical name used in the configuration file.- Returns:
- instance of the class.
-
getBean
Return an instance for the class to the given type.- Type Parameters:
T- type of the bean- Parameters:
type- interface type.- Returns:
- instance of the class.
-
getBean
Return an instance for the class with the given alias and constructor arguments.- Parameters:
name- logical name used in the configuration file.args- Constructor arguments- Returns:
- instance of the class.
-
removeBean
Removes bean from current scope.- Parameters:
beanName- id or alias of the bean
-
getBeanNamesForType
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.- 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
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.- 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
-