Class FieldBeansCollector


  • public class FieldBeansCollector
    extends java.lang.Object
    Convenience class to extract information about the type and generics of a field to inject. The field is a List, a Map or a Set and the generic type of its elements is extracted as well
    Author:
    Tobias Soloschenko, Andrea Del Bene
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldBeansCollector​(org.springframework.core.ResolvableType fieldResolvableType)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBean​(java.lang.String beanName, java.lang.Object bean)
      Adds compatible bean to the field.
      java.lang.Object getBeansToInject()
      Returns an instance containing all the beans collected for the field and compatible with the type of the field.
      FieldBeansCollector.FieldType getFieldType()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FieldBeansCollector

        public FieldBeansCollector​(org.springframework.core.ResolvableType fieldResolvableType)
    • Method Detail

      • getBeansToInject

        public java.lang.Object getBeansToInject()
        Returns an instance containing all the beans collected for the field and compatible with the type of the field.
        Returns:
        the instance to inject into the field.
      • addBean

        public void addBean​(java.lang.String beanName,
                            java.lang.Object bean)
        Adds compatible bean to the field. This means that the field type is Map, a List or a Set and that the given bean is compatible with its elements type.
        Parameters:
        beanName - the name of the bean to inject
        bean - the bean to inject