Utility to get {@link Configuration} annotation from the
injection point with minimal effort

@param injectionPoint the injection point that was used
to call the producer for satisfaction

@return configuration annotation
515946
protected ConfigurationWrapper getConfigurationWrapper(InjectionPoint injectionPoint) {
		Configuration configuration = injectionPoint.getAnnotated().getAnnotation(Configuration.class);
		return WrapperFactory.wrap(configuration);
	}
1091874
private <A extends Annotation, AS extends Annotation> void addOrMergeInjectionBinding(int processorIndex,
                                                                                          InjectionProcessor<A, AS> processor,
                                                                                          Class<?> klass,
                                                                                          Member member,
                                                                                          A ann)
                    throws InjectionException
    {
        // Lazily create override processors as needed.
        if (ivOverrideIndices != null)
        {
            int overrideIndex = ivOverrideIndices[processorIndex];
            if (overrideIndex != -1)
            {
                // Create and set the override processor only once.
                ivOverrideIndices[processorIndex] = -1;

                InjectionProcessor<?, ?> overrideProcessor = getProcessor(overrideIndex, ivProviders.get(overrideIndex));
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "adding override processor " + overrideProcessor + " to " + processor);
                InjectionProcessorContextImpl.setOverrideProcessor(processor, overrideProcessor);
            }
        }

        InjectionProcessorContextImpl.addOrMergeInjectionBinding(processor, klass, member, ann);
    }
130512
@RequestMapping(value = "configurations/{name}", method = RequestMethod.GET)
    public JenkinsConfiguration getConfiguration(@PathVariable String name) {
        return jenkinsService.getConfiguration(name);
    }
737805
public I_CmsXmlConfiguration getConfiguration(Class<?> clazz) {

        for (int i = 0; i < m_configurations.size(); i++) {
            I_CmsXmlConfiguration configuration = m_configurations.get(i);
            if (clazz.equals(configuration.getClass())) {
                return configuration;
            }
        }
        return null;
    }
534827
public InjectableStepsFactory buildStepsFactory(Configuration configuration) {
        List<Object> stepsInstances = new ArrayList<>();
        InjectableStepsFactory factory = null;
        if (finder.isAnnotationPresent(UsingSteps.class)) {
            List<Class<Object>> stepsClasses = finder.getAnnotatedClasses(
                    UsingSteps.class, Object.class, "instances");
            if (!stepsClasses.isEmpty()) {
                for (Class<Object> stepsClass : stepsClasses) {
                    stepsInstances.add(instanceOf(Object.class, stepsClass));
                }
                factory = new InstanceStepsFactory(configuration,
                        stepsInstances);
            }
            List<String> packages = finder.getAnnotatedValues(UsingSteps.class,
                    String.class, "packages");
            if (!packages.isEmpty()) {
                String matchingNames = finder.getAnnotatedValue(UsingSteps.class,
                        String.class, "matchingNames");
                String notMatchingNames = finder.getAnnotatedValue(UsingSteps.class,
                        String.class, "notMatchingNames");
                factory = new ScanningStepsFactory(configuration,
                        packages.toArray(new String[packages.size()]))
                        .matchingNames(matchingNames).notMatchingNames(notMatchingNames);
            }
        } else {
            annotationMonitor.annotationNotFound(UsingSteps.class, annotatedClass);
        }

        if (factory == null) {
            factory = new InstanceStepsFactory(configuration);
        }
        return factory;
    }
832837
protected Object resolveProviderConfig(String exp, Map<String, ? extends Object> contextMap, LaContainer container,
            Class<?> resultType) {
        if (exp.startsWith(PROVIDER_GET) && exp.endsWith(METHOD_MARK) && exp.contains(".") && !exp.contains("\"")) {
            final String[] tokens = exp.split("\\.");
            if (tokens.length > 1) {
                Object component = null;
                BeanDesc beanDesc = null;
                for (String prop : tokens) {
                    if (prop.endsWith(METHOD_MARK)) { // method
                        if (component == null) { // e.g. getJdbcUrl() only
                            break;
                        }
                        final String methodName = prop.substring(0, prop.length() - METHOD_MARK.length());
                        component = beanDesc.invoke(component, methodName, (Object[]) null);
                        beanDesc = BeanDescFactory.getBeanDesc(component.getClass());
                    } else { // component or property
                        if (beanDesc == null) { // first element
                            if (container.hasComponentDef(prop)) { // component
                                component = container.getComponent(prop);
                                beanDesc = BeanDescFactory.getBeanDesc(component.getClass());
                            } else {
                                break;
                            }
                        } else { // next elements, property
                            final PropertyDesc propertyDesc = beanDesc.getPropertyDesc(prop);
                            if (propertyDesc != null) {
                                component = propertyDesc.getValue(component);
                                beanDesc = BeanDescFactory.getBeanDesc(component.getClass());
                            } else {
                                break;
                            }
                        }
                    }
                }
                if (component != null) {
                    return component;
                }
            }
        }
        return null;
    }
1037595
private static IAnnotationBinding getAnnotationBinding(
            IAnnotationBinding[] annotations, Class<?> annotationClass) {
        if (annotationClass == null) {
            throw new NullPointerException();
        }
        return getAnnotationBinding(annotations, annotationClass.getCanonicalName());
    }
1265984
public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager) {
        validateInjectionPointForDefinitionErrors(ij, ij.getBean(), beanManager);
        validateMetadataInjectionPoint(ij, ij.getBean(), ValidatorLogger.INJECTION_INTO_NON_BEAN);
        validateEventMetadataInjectionPoint(ij);
        validateInjectionPointForDeploymentProblems(ij, ij.getBean(), beanManager);
    }
472530
private <A extends Annotation, AS extends Annotation> void processClassAnnotations(int processorIndex,
                                                                                       InjectionProcessorProvider<A, AS> provider,
                                                                                       Class<?> klass)
                    throws InjectionException
    {
        Class<A> annClass = provider.getAnnotationClass();
        if (annClass != null)
        {
            A ann = klass.getAnnotation(annClass);
            if (ann != null)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "found class annotation " + toStringSecure(ann));

                InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider);
                addOrMergeInjectionBinding(processorIndex, processor, klass, null, ann);
            }

            Class<AS> pluralAnnClass = provider.getAnnotationsClass();
            if (pluralAnnClass != null)
            {
                AS pluralAnn = klass.getAnnotation(pluralAnnClass);
                if (pluralAnn != null)
                {
                    InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider);

                    A[] singleAnns = processor.getAnnotations(pluralAnn);
                    if (singleAnns != null)
                    {
                        for (A singleAnn : singleAnns)
                        {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                Tr.debug(tc, "found plural class annotation " + toStringSecure(singleAnn));
                            addOrMergeInjectionBinding(processorIndex, processor, klass, null, singleAnn);
                        }
                    }
                }
            }
        }
    }
490906
public <T, X> FieldInjectionPoint<T, X> createFieldInjectionPoint(EnhancedAnnotatedField<T, X> field,
            Bean<?> declaringBean, Class<?> declaringComponentClass, BeanManagerImpl manager) {
        FieldInjectionPointAttributes<T, X> attributes = InferringFieldInjectionPointAttributes.of(field, declaringBean,
            declaringComponentClass, manager);
        attributes = processInjectionPoint(attributes, declaringComponentClass, manager);
        return new FieldInjectionPoint<T, X>(attributes);
    }
1191158
@SuppressWarnings("static-method")
	@Provides
	@Singleton
	public SarlConfig getSarlcConfig(ConfigurationFactory configFactory, Injector injector) {
		final SarlConfig config = SarlConfig.getConfiguration(configFactory);
		injector.injectMembers(config);
		return config;
	}
1324227
public static String getCacheAnnotation(PackageImportAdder packageImportAdder, CacheConfigGetter... cacheConfigGetters) {
        if (cacheConfigGetters == null) {
            return "";
        }

        for (CacheConfigGetter cacheConfigGetter : cacheConfigGetters) {
            if (cacheConfigGetter != null) {
                CacheConfig cacheConfig = cacheConfigGetter.getCacheConfig();

                if (cacheConfig != null) {
                    if (cacheConfig.getUsage().isNone()) {
                        return ""; // cleaner than disabling the cache using @Cache (usage = NONE)
                    } else {
                        packageImportAdder.addImport("org.hibernate.annotations.Cache");
                        packageImportAdder.addImport("static org.hibernate.annotations.CacheConcurrencyStrategy." + cacheConfig.getUsage().name());

                        AttributeBuilder attr = new AttributeBuilder();
                        attr.add("usage = " + cacheConfig.getUsage().name());

                        if (cacheConfig.hasInclude()) {
                            attr.addString("include", cacheConfig.getInclude());
                        }

                        if (cacheConfig.hasRegion()) {
                            attr.addString("region", cacheConfig.getInclude());
                        }

                        return attr.bindAttributesTo("@Cache");
                    }
                }
            }
        }

        return "";
    }
166359
public static InjectionPoint wrapIfNecessary(InjectionPoint ip) {
        if (ip.getBean() instanceof SessionBean<?>) {
            if (!CONTEXTUAL_SESSION_BEANS.get().contains(ip.getBean().getBeanClass())) {
                return new NonContextualSessionBeanInjectionPoint(ip);
            }
        }
        return ip;
    }
1154740
@SuppressWarnings("checkstyle:npathcomplexity")
	public static void defineConfig(Map<String, Object> content, ConfigMetadataNode config, Injector injector) {
		assert content != null;
		assert config != null;
		final Class<?> type = (Class<?>) config.getType();
		final String sectionName = config.getName();
		final Pattern setPattern = Pattern.compile("^set([A-Z])([a-zA-Z0-9]+)$"); //$NON-NLS-1$
		Object theConfig = null;
		for (final Method setterMethod : type.getMethods()) {
			final Matcher matcher = setPattern.matcher(setterMethod.getName());
			if (matcher.matches()) {
				final String firstLetter = matcher.group(1);
				final String rest = matcher.group(2);
				final String getterName = "get" + firstLetter + rest; //$NON-NLS-1$
				Method getterMethod = null;
				try {
					getterMethod = type.getMethod(getterName);
				} catch (Throwable exception) {
					//
				}
				if (getterMethod != null && Modifier.isPublic(getterMethod.getModifiers())
						&& !Modifier.isAbstract(getterMethod.getModifiers())
						&& !Modifier.isStatic(getterMethod.getModifiers())) {
					try {
						if (theConfig == null) {
							theConfig = injector.getInstance(type);
						}
						if (theConfig != null) {
							final Object value = filterValue(getterMethod.getReturnType(), getterMethod.invoke(theConfig));
							final String id = sectionName + "." + firstLetter.toLowerCase() + rest; //$NON-NLS-1$
							defineScalar(content, id, value);
						}
					} catch (Throwable exception) {
						//
					}
				}
			}
		}
	}
325512
protected List<ISource> locate(ConfigurationWrapper configuration) {
				
		if(configuration == null) {
			throw new IllegalArgumentException("A non-null Configuration annotation must be provided");
		}
		
		// create resolver from configuration annotation's resolver element
		ResolverWrapper resolverWrapper = configuration.resolver();
		PropertyResolver resolver = this.resolverFactory.createPropertyResolver(resolverWrapper);
		Map<Object,Object> bootstrapMap = this.resolverFactory.getBootstrapProperties(resolverWrapper);
		Map<Object,Object> defaultMap = this.resolverFactory.getDefaultProperties(resolverWrapper);
		
		// found sources
		List<ISource> foundSources = new ArrayList<ISource>(0);
		
		// create sources
		List<Source> sources = new ArrayList<Source>(Arrays.asList(configuration.sources()));
		
		// resolve sources as normal
		for(Source source : sources) {
			ISource found = this.resloveSource(source, resolver, bootstrapMap, defaultMap);
			if(found != null) {
				foundSources.add(found);
			}
		}
		
		// fix no sources found, a source SHOULD always be returned
		if(foundSources.isEmpty()) {
			foundSources.add(new UnfoundSource());
		}
		
		return foundSources;
	}
514621
public static final <E> InjectionPoint<E> of(Class<E> cls) {
        return new SimpleInjectionPoint<E>(cls);
    }
501859
protected <T, X> FieldInjectionPointAttributes<T, X> processInjectionPoint(
            FieldInjectionPointAttributes<T, X> injectionPointAttributes, Class<?> declaringComponentClass,
            BeanManagerImpl manager) {
        return manager.getContainerLifecycleEvents().fireProcessInjectionPoint(injectionPointAttributes,
                declaringComponentClass, manager);
    }