Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.beans.factory
Class GenericBeanFactoryAccessor

    java.lang.Object
      org.codehaus.groovy.grails.beans.factory.GenericBeanFactoryAccessor

    public class GenericBeanFactoryAccessor

extends Object

This class is a fork of the Spring 2.5.6 GenericBeanFactoryAccess class that was removed from Spring 3.0

Since:
  2.0
Author:
  Rob Harrop, Juergen Hoeller

Constructor Summary
`GenericBeanFactoryAccessor(ListableBeanFactory beanFactory)` Constructs a `GenericBeanFactoryAccessor` that wraps the supplied `ListableBeanFactory`.

Method Summary
`
`<A extends Annotation> A`
` | `findAnnotationOnBean(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, as well as checking its raw bean class if not found on the exposed bean reference (e.g. in case of a proxy).
`
`<T> T`
` | `getBean(String name)`
`
`<T> T`
` | `getBean(String name, Class<T> requiredType)`
`ListableBeanFactory` | `getBeanFactory()` Return the wrapped `ListableBeanFactory`.
`
`<T> Map<String,T>`
` | `getBeansOfType(Class<T> type)`
`
`<T> Map<String,T>`
` | `getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)`
`Map<String,Object>` | `getBeansWithAnnotation(Class<? extends Annotation> annotationType)` Find all beans whose `Class` has the supplied `Annotation` type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GenericBeanFactoryAccessor

    public GenericBeanFactoryAccessor(ListableBeanFactory beanFactory)

  Constructs a `GenericBeanFactoryAccessor` that wraps the supplied `ListableBeanFactory`.

Method Detail

### getBeanFactory

    public final ListableBeanFactory getBeanFactory()

  Return the wrapped `ListableBeanFactory`.

### getBean

    public <T> T getBean(String name)
              throws BeansException

  Throws:
    `BeansException`
  See Also:
    `BeanFactory.getBean(String)`

### getBean

    public <T> T getBean(String name,
                         Class<T> requiredType)
              throws BeansException

  Throws:
    `BeansException`
  See Also:
    `BeanFactory.getBean(String, Class)`

### getBeansOfType

    public <T> Map<String,T> getBeansOfType(Class<T> type)
                                 throws BeansException

  Throws:
    `BeansException`
  See Also:
    `ListableBeanFactory.getBeansOfType(Class)`

### getBeansOfType

    public <T> Map<String,T> getBeansOfType(Class<T> type,
                                            boolean includeNonSingletons,
                                            boolean allowEagerInit)
                                 throws BeansException

  Throws:
    `BeansException`
  See Also:
    `ListableBeanFactory.getBeansOfType(Class, boolean, boolean)`

### getBeansWithAnnotation

    public Map<String,Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)

  Find all beans whose `Class` has the supplied `Annotation` type.

  Parameters:
    `annotationType` - the type of annotation to look for
  Returns:
    a Map with the matching beans, containing the bean names as keys and the corresponding bean instances as values

### findAnnotationOnBean

    public <A extends Annotation> A findAnnotationOnBean(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, as well as checking its raw bean class if not found on the exposed bean reference (e.g. in case of a proxy).

  Parameters:
    `beanName` - the name of the bean to look for annotations on
    `annotationType` - the annotation class to look for
  Returns:
    the annotation of the given type found, or `null`
  See Also:
    `AnnotationUtils.findAnnotation(Class, Class)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2009 The Grails project