@ SuppressWarnings ( "unused" ) @ Internal protected final void injectBeanField ( BeanResolutionContext resolutionContext , DefaultBeanContext context , int index , Object bean ) { FieldInjectionPoint fieldInjectionPoint = fieldInjectionPoints . get ( index ) ; boolean isInject = fieldInjectionPoint . getAnnotationMetadata ( ) . hasDeclaredAnnotation ( Inject . class ) ; try { Object value ; if ( isInject ) { value = getBeanForField ( resolutionContext , context , fieldInjectionPoint ) ; } else { value = getValueForField ( resolutionContext , context , index ) ; } if ( value != null ) { //noinspection unchecked fieldInjectionPoint . set ( bean , value ) ; } } catch ( Throwable e ) { if ( e instanceof BeanContextException ) { throw ( BeanContextException ) e ; } else { throw new DependencyInjectionException ( resolutionContext , fieldInjectionPoint , "Error setting field value: " + e . getMessage ( ) , e ) ; } } }
Injects the value of a field of a bean that requires reflection .