Get a bean provider.

@param resolutionContext The bean resolution context
@param beanType          The bean type
@param qualifier         The qualifier
@param <T>               The bean type parameter
@return The bean provider
330455
protected @Nonnull <T> Provider<T> getBeanProvider(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) {
        ArgumentUtils.requireNonNull("beanType", beanType);
        @SuppressWarnings("unchecked") BeanRegistration<T> beanRegistration = singletonObjects.get(new BeanKey(beanType, qualifier));
        if (beanRegistration != null) {
            return new ResolvedProvider<>(beanRegistration.bean);
        }

        Optional<BeanDefinition<T>> concreteCandidate = findConcreteCandidate(beanType, qualifier, true, false);
        if (concreteCandidate.isPresent()) {
            return new UnresolvedProvider<>(beanType, qualifier, this);
        } else {
            throw new NoSuchBeanException(beanType);
        }
    }
1197751
public byte[] columnQualifier() {
    if (display_name == null || display_name.isEmpty()) {
      throw new IllegalArgumentException("Missing display name");
    }
    
    final byte[] qualifier = new byte[LEAF_PREFIX.length + 4];
    System.arraycopy(LEAF_PREFIX, 0, qualifier, 0, LEAF_PREFIX.length);
    System.arraycopy(Bytes.fromInt(hashCode()), 0, qualifier, 
        LEAF_PREFIX.length, 4);
    return qualifier;
  }
1320376
private Set<QualifierInstance> getRequiredQualifiers(EnhancedAnnotatedParameter<?, ? super X> enhancedDisposedParameter) {
        Set<Annotation> disposedParameterQualifiers = enhancedDisposedParameter.getMetaAnnotations(Qualifier.class);
        if (disposedParameterQualifiers.isEmpty()) {
            disposedParameterQualifiers = Collections.<Annotation> singleton(Default.Literal.INSTANCE);
        }
        return beanManager.getServices().get(MetaAnnotationStore.class).getQualifierInstances(disposedParameterQualifiers);
    }
864292
public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType)
    {
        String id = implementationType.getSimpleName();

        RuleMetadata metadata = Annotations.getAnnotation(implementationType, RuleMetadata.class);
        if (metadata != null && !metadata.id().isEmpty())
            id = metadata.id();

        return forProvider(implementationType, id);
    }
169714
protected @Nonnull <T> Collection<BeanDefinition> findBeanCandidatesForInstance(@Nonnull T instance) {
        ArgumentUtils.requireNonNull("instance", instance);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Finding candidate beans for instance: {}", instance);
        }
        Collection<BeanDefinitionReference> beanDefinitionsClasses = this.beanDefinitionsClasses;
        return beanCandidateCache.computeIfAbsent(instance.getClass(), aClass -> {
            // first traverse component definition classes and load candidates

            if (!beanDefinitionsClasses.isEmpty()) {

                List<BeanDefinition> candidates = beanDefinitionsClasses
                        .stream()
                        .filter(reference -> {
                            if (reference.isEnabled(this)) {
                                Class<?> candidateType = reference.getBeanType();

                                return candidateType != null && candidateType.isInstance(instance);
                            } else {
                                return false;
                            }
                        })
                        .map(ref -> ref.load(this))
                        .filter(candidate -> candidate.isEnabled(this))
                        .collect(Collectors.toList());

                if (candidates.size() > 1) {
                    // try narrow to exact type
                    candidates = candidates
                            .stream()
                            .filter(candidate ->
                                    !(candidate instanceof NoInjectionBeanDefinition) &&
                                            candidate.getBeanType() == instance.getClass()
                            )
                            .collect(Collectors.toList());
                    return candidates;
                }
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Resolved bean candidates {} for instance: {}", candidates, instance);
                }
                return candidates;
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("No bean candidates found for instance: {}", instance);
                }
                return Collections.emptySet();
            }
        });

    }
884257
public <T extends Annotation> QualifierModel<T> getBindingTypeModel(final Class<T> bindingType) {
        return qualifiers.getCastValue(bindingType);
    }
115615
protected <T> Stream<T> streamOfType(BeanResolutionContext resolutionContext, Class<T> beanType, Qualifier<T> qualifier) {
        return getBeansOfTypeInternal(resolutionContext, beanType, qualifier).stream();
    }
1292510
public <T> T getClientProxy(final Bean<T> bean, Type requestedType) {
        // let's first try to use the proxy that implements all the bean types
        T proxy = beanTypeClosureProxyPool.getCastValue(bean);
        if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
            /*
             *  the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable
             *  type is not in the type closure of the requested type
             *  https://issues.jboss.org/browse/WELD-1052
             */
            proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean));
            if (proxy == BEAN_NOT_PROXYABLE_MARKER) {
                throw Proxies.getUnproxyableTypeException(requestedType, services());
            }
        }
        BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean);
        return proxy;
    }
272017
private void beanToBean(Object providerBean, Object destBean) {
		valueProviderToBean(new BeanValueProvider(providerBean, this.copyOptions.ignoreCase, this.copyOptions.ignoreError), destBean);
	}
1290799
public static Builder builder(String qualifier) {
    requireNonNull(qualifier);
    Preconditions.checkArgument(qualifier.length() <= 10, "Qualifier is limited to 10 characters");
    return new Builder(qualifier);
  }
466523
public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType, String providerId)
    {
        Assert.notNull(implementationType, "Rule provider Implementation type must not be null.");
        Assert.notNull(providerId, "Rule provider ID must not be null.");

        MetadataBuilder builder = new MetadataBuilder(implementationType, providerId)
                    .setOrigin(implementationType.getName() + " loaded from " + implementationType.getClassLoader().toString());

        RuleMetadata metadata = Annotations.getAnnotation(implementationType, RuleMetadata.class);
        if (metadata == null)
            return builder;

        builder.setOverrideProvider(metadata.overrideProvider());

        if (StringUtils.isNotBlank(metadata.description()))
            builder.setDescription(metadata.description());

        Class<? extends RuleProvider>[] after = metadata.after();
        if (after.length > 0)
            builder.setExecuteAfter(Arrays.asList(after));

        String[] afterIDs = metadata.afterIDs();
        if (afterIDs.length > 0)
            builder.setExecuteAfterIDs(Arrays.asList(afterIDs));

        Class<? extends RuleProvider>[] before = metadata.before();
        if (before.length > 0)
            builder.setExecuteBefore(Arrays.asList(before));

        String[] beforeIDs = metadata.beforeIDs();
        if (beforeIDs.length > 0)
            builder.setExecuteBeforeIDs(Arrays.asList(beforeIDs));

        builder.setPhase(metadata.phase());

        String[] tags = metadata.tags();
        if (tags.length > 0)
            builder.setTags(Arrays.asList(tags));

        Technology[] sourceTechnologies = metadata.sourceTechnologies();
        if (sourceTechnologies.length > 0)
        {
            for (Technology technology : sourceTechnologies)
            {
                builder.addSourceTechnology(new TechnologyReference(
                            technology.id(),
                            "".equals(technology.versionRange().trim())
                                    ? new EmptyVersionRange()
                                    : Versions.parseVersionRange(technology.versionRange())));
            }
        }

        Technology[] targetTechnologies = metadata.targetTechnologies();
        if (targetTechnologies.length > 0)
        {
            for (Technology technology : targetTechnologies)
            {
                builder.addTargetTechnology(new TechnologyReference(
                            technology.id(),
                            "".equals(technology.versionRange().trim())
                                    ? new EmptyVersionRange()
                                    : Versions.parseVersionRange(technology.versionRange())));
            }
        }

        builder.haltOnException = metadata.haltOnException();
        builder.disabled = metadata.disabled();
        if (builder.disabled)
            LOG.info("Disabled provider: " + providerId);

        return builder;
    }
863751
protected List<ProviderInfo<? extends Object>> prepareProviders(boolean custom,
                                                                    boolean busGlobal,
                                                                    Object[] providers,
                                                                    ProviderInfo<Application> application) {
        List<ProviderInfo<? extends Object>> theProviders =
            new ArrayList<ProviderInfo<? extends Object>>(providers.length);
        @SuppressWarnings("unchecked")
        Map<String, Object> beanCustomizerContexts = (Map<String, Object>) getBus().getProperty(JaxRsConstants.ENDPOINT_BEANCUSTOMIZER_CONTEXTOBJ);

        for (Object o : providers) {
            if (o == null) {
                continue;
            }

            /**
             * using POJO object to create ProviderInfo to get info of @Context
             */
            ProviderInfo<? extends Object> pi = null;

            if (o instanceof Constructor) {
                Map<Class<?>, Object> values = CastUtils.cast(application == null ? null : Collections.singletonMap(Application.class, application.getProvider()));
                pi = createProviderFromConstructor((Constructor<?>) o, values, getBus(), true, custom);

            } else if (o instanceof ProviderInfo) {
                pi = (ProviderInfo<?>) o;
            } else {
                pi = new ProviderInfo<Object>(o, getBus(), custom);
                pi.setBusGlobal(busGlobal);
            }

            /**
             * then using EJB proxy to help CXF classify provider type
             */
            JaxRsFactoryBeanCustomizer beanCustomizer = InjectionRuntimeContextHelper.findBeanCustomizer(o.getClass(), getBus());
            if (beanCustomizer != null) {
                Object proxyObject = beanCustomizer.onSetupProviderProxy(o, beanCustomizerContexts.get(createCustomizerKey(beanCustomizer)));

                if (proxyObject != null && (proxyObject != o || !proxyObject.equals(o))) {
                    pi.setProvider(proxyObject);
                }
            }

            if (beanCustomizer != null && DynamicFeature.class.isAssignableFrom(pi.getProvider().getClass())) {
                Object newProviderInstance = beanCustomizer.onSingletonProviderInit(pi.getProvider(), beanCustomizerContexts.get(Integer.toString(beanCustomizer.hashCode())),
                                                                                    null);
                if (newProviderInstance != null) {
                    pi.setProvider(newProviderInstance);
                }

            }

            theProviders.add(pi);
        }

        return theProviders;
    }
407008
public Version with(Qualifier qualifier, int qualifierNumber) {
    this.qualifier = defaultIfNull(qualifier, Qualifier.UNDEFINED);
    this.qualifierNumber = Math.max(qualifierNumber, 0);
    return this;
  }
466481
@ConditionalOnClass({Pcap.class, Inet4Address.class, Context.class})
    //@ConditionalOnBean({Pcap.Builder.class, Inet4Address.class})
    @Bean(CONTEXT_BEAN_NAME)
    public Context context(@Qualifier(PCAP_BUILDER_BEAN_NAME) Pcap.Builder builder,
                           @Qualifier(NETMASK_BEAN_NAME) Inet4Address netmask) {

        switch (properties.getPcapType()) {
            case DEAD:
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Opening pcap dead handler : {}", builder);
                }
                builder.pcapType(Pcap.PcapType.DEAD);
                break;
            case OFFLINE:
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Opening pcap offline hadler : {}", builder);
                }
                builder.pcapType(Pcap.PcapType.OFFLINE);
                break;
            default:
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Opening pcap live hadler : {}", builder);
                }
                builder.pcapType(Pcap.PcapType.LIVE);
                break;
        }
        Application.run(applicationName, applicationDisplayName, applicationVersion, builder);
        Context context =  Application.getApplicationContext();
        if (properties.getFilter() != null) {
            if (context.pcapCompile(properties.getFilter(),
                    properties.getBpfCompileMode(),
                    netmask.toInt()) == PcapCode.PCAP_OK) {
                if (context.pcapSetFilter() != PcapCode.PCAP_OK) {
                    if (LOGGER.isWarnEnabled()) {
                        LOGGER.warn(context.pcapGetErr());
                    }
                } else {
                    LOGGER.debug("Filter \'{}\' has been applied.", this.properties.getFilter());
                }
            } else {
                if (LOGGER.isWarnEnabled()) {
                    LOGGER.warn(context.pcapGetErr());
                }
            }
        } else {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("No filter has been applied.");
            }
        }
        return context;
    }
567525
public static DependencyIdentifier getDependencyIdentifierForClass(Field field, SortedSet<String> qualifiers) {
        List<Type> typeList = new ArrayList<Type>();
        addTypeToList(field.getGenericType(), typeList);
        return new DependencyIdentifier(typeList, qualifiers);
    }
1203779
public BeanBuilder<T> addQualifiers(Annotation... qualifiers) {
        this.qualifiers.addAll(Arrays2.asSet(qualifiers));
        return this;
    }
331382
protected TypeReference<?> getBeanPropertyType(Class<?> clazz,
			String propertyName, TypeReference<?> originalType) {
		TypeReference<?> propertyDestinationType = null;
		if (beanDestinationPropertyTypeProvider != null) {
			propertyDestinationType = beanDestinationPropertyTypeProvider
					.getPropertyType(clazz, propertyName, originalType);
		}
		if (propertyDestinationType == null) {
			propertyDestinationType = originalType;
		}
		return propertyDestinationType;
	}