@SuppressWarnings("WeakerAccess")
    @Internal
    @UsedByGeneratedCode
    protected final Object getBeanForField(BeanResolutionContext resolutionContext, BeanContext context, FieldInjectionPoint injectionPoint) {
        Class beanType = injectionPoint.getType();
        if (beanType.isArray()) {
            Collection beansOfType = getBeansOfTypeForField(resolutionContext, context, injectionPoint);
            return beansOfType.toArray((Object[]) Array.newInstance(beanType.getComponentType(), beansOfType.size()));
        } else if (Collection.class.isAssignableFrom(beanType)) {
            Collection beansOfType = getBeansOfTypeForField(resolutionContext, context, injectionPoint);
            if (beanType.isInstance(beansOfType)) {
                return beansOfType;
            } else {
                //noinspection unchecked
                return CollectionUtils.convertCollection(beanType, beansOfType).orElse(null);
            }
        } else if (Stream.class.isAssignableFrom(beanType)) {
            return getStreamOfTypeForField(resolutionContext, context, injectionPoint);
        } else if (Provider.class.isAssignableFrom(beanType)) {
            return getBeanProviderForField(resolutionContext, context, injectionPoint);
        } else if (Optional.class.isAssignableFrom(beanType)) {
            return findBeanForField(resolutionContext, context, injectionPoint);
        } else {
            BeanResolutionContext.Path path = resolutionContext.getPath();
            path.pushFieldResolve(this, injectionPoint);

            try {
                Qualifier qualifier = resolveQualifier(resolutionContext, injectionPoint.asArgument());
                @SuppressWarnings("unchecked") Object bean = ((DefaultBeanContext) context).getBean(resolutionContext, beanType, qualifier);
                path.pop();
                return bean;
            } catch (NoSuchBeanException e) {
                if (injectionPoint.isDeclaredAnnotationPresent(Nullable.class)) {
                    path.pop();
                    return null;
                }
                throw new DependencyInjectionException(resolutionContext, injectionPoint, e);
            }
        }
    }
@ SuppressWarnings ( "WeakerAccess" ) @ Internal @ UsedByGeneratedCode protected final Object getBeanForField ( BeanResolutionContext resolutionContext , BeanContext context , FieldInjectionPoint injectionPoint ) { Class beanType = injectionPoint . getType ( ) ; if ( beanType . isArray ( ) ) { Collection beansOfType = getBeansOfTypeForField ( resolutionContext , context , injectionPoint ) ; return beansOfType . toArray ( ( Object [ ] ) Array . newInstance ( beanType . getComponentType ( ) , beansOfType . size ( ) ) ) ; } else if ( Collection . class . isAssignableFrom ( beanType ) ) { Collection beansOfType = getBeansOfTypeForField ( resolutionContext , context , injectionPoint ) ; if ( beanType . isInstance ( beansOfType ) ) { return beansOfType ; } else { return CollectionUtils . convertCollection ( beanType , beansOfType ) . orElse ( null ) ; } } else if ( Stream . class . isAssignableFrom ( beanType ) ) { return getStreamOfTypeForField ( resolutionContext , context , injectionPoint ) ; } else if ( Provider . class . isAssignableFrom ( beanType ) ) { return getBeanProviderForField ( resolutionContext , context , injectionPoint ) ; } else if ( Optional . class . isAssignableFrom ( beanType ) ) { return findBeanForField ( resolutionContext , context , injectionPoint ) ; } else { BeanResolutionContext . Path path = resolutionContext . getPath ( ) ; path . pushFieldResolve ( this , injectionPoint ) ; try { Qualifier qualifier = resolveQualifier ( resolutionContext , injectionPoint . asArgument ( ) ) ; @ SuppressWarnings ( "unchecked" ) Object bean = ( ( DefaultBeanContext ) context ) . getBean ( resolutionContext , beanType , qualifier ) ; path . pop ( ) ; return bean ; } catch ( NoSuchBeanException e ) { if ( injectionPoint . isDeclaredAnnotationPresent ( Nullable . class ) ) { path . pop ( ) ; return null ; } throw new DependencyInjectionException ( resolutionContext , injectionPoint , e ) ; } } }
Resolves a bean for the given {@link FieldInjectionPoint}.

@param resolutionContext The {@link BeanResolutionContext}
@param context           The {@link BeanContext}
@param injectionPoint    The {@link FieldInjectionPoint}
@return The resolved bean
@throws DependencyInjectionException If the bean cannot be resolved