Extracts a set of interceptor bindings from a collection of annotations.
@param beanManager
@param annotations
@return
184312
public static Set<Annotation> filterInterceptorBindings(BeanManagerImpl beanManager, Collection<Annotation> annotations) {
        Set<Annotation> interceptorBindings = new InterceptorBindingSet(beanManager);
        for (Annotation annotation : annotations) {
            if (beanManager.isInterceptorBinding(annotation.annotationType())) {
                interceptorBindings.add(annotation);
            }
        }
        return interceptorBindings;
    }
952184
protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(Iterable<Annotation> annotations) {
        Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
        for (Annotation annotation : annotations) {
            annotationMap.put(annotation.annotationType(), annotation);
        }
        return annotationMap;
    }
344361
public <X> List<ParameterInjectionPoint<?, X>> getParameterInjectionPoints(EnhancedAnnotatedCallable<?, X, ?> callable,
            Bean<?> declaringBean, Class<?> declaringComponentClass, BeanManagerImpl manager, boolean observerOrDisposer) {
        List<ParameterInjectionPoint<?, X>> parameters = new ArrayList<ParameterInjectionPoint<?, X>>();

        /*
         * bean that the injection point belongs to this is null for observer and disposer methods
         */
        Bean<?> bean = null;
        if (!observerOrDisposer) {
            bean = declaringBean;
        }

        for (EnhancedAnnotatedParameter<?, X> parameter : callable.getEnhancedParameters()) {
            if (isSpecialParameter(parameter)) {
                parameters.add(SpecialParameterInjectionPoint.of(parameter, bean, declaringBean.getBeanClass(), manager));
            } else {
                parameters.add(createParameterInjectionPoint(parameter, bean, declaringComponentClass, manager));
            }
        }
        return ImmutableList.copyOf(parameters);
    }
626385
public static <T extends Bean<?>> Set<T> removeDisabledBeans(Set<T> beans, final BeanManagerImpl beanManager) {
        if (beans.isEmpty()) {
            return beans;
        } else {
            for (Iterator<T> iterator = beans.iterator(); iterator.hasNext();) {
                if (!isBeanEnabled(iterator.next(), beanManager.getEnabled())) {
                    iterator.remove();
                }
            }
            return beans;
        }
    }
1353466
private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Bean<?> bean)
    {
        //noinspection unchecked
        return getContextualReference(type, beanManager, new HashSet<Bean<?>>((Collection) Arrays.asList(bean)));
    }
1118676
protected List<Class<? extends Annotation>> createAnnotationTypeList(Class<?>... annotations) {
        final List<Class<? extends Annotation>> annotationList = new ArrayList<Class<? extends Annotation>>();
        for (Class<?> annoType : annotations) {
            @SuppressWarnings("unchecked")
            final Class<? extends Annotation> castType = (Class<? extends Annotation>) annoType;
            annotationList.add(castType);
        }
        return annotationList;
    }
360957
private Map<String, Set<String>> scanForAnnotatedClasses(Set<URL> urls) throws IOException {
        AnnotationDB db = new AnnotationDB();
        db.setScanClassAnnotations(true);
        db.setScanFieldAnnotations(false);
        db.setScanMethodAnnotations(false);
        db.setScanParameterAnnotations(false);
      
        db.scanArchives(urls.toArray(new URL[urls.size()]));
        return db.getAnnotationIndex();
        
    }
849035
public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) {

        if (decoratedTypes == null) {
            decoratedTypes = new HashSet<Type>(type.getInterfaceClosure());
            decoratedTypes.remove(Serializable.class);
        }

        Set<MethodSignature> signatures = new HashSet<MethodSignature>();

        for (Type decoratedType : decoratedTypes) {
            for (EnhancedAnnotatedMethod<?, ?> method : ClassTransformer.instance(beanManager)
                    .getEnhancedAnnotatedType(Reflections.getRawType(decoratedType), beanManager.getId()).getEnhancedMethods()) {
                signatures.add(method.getSignature());
            }
        }

        for (EnhancedAnnotatedMethod<?, ?> method : type.getEnhancedMethods()) {
            if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember())) {
                MethodSignature methodSignature = method.getSignature();
                if (!signatures.contains(methodSignature)) {
                    throw BeanLogger.LOG.abstractMethodMustMatchDecoratedType(method, Formats.formatAsStackTraceElement(method.getJavaMember()));
                }
            }
        }
    }
78985
public static void bind(FeatureManager featureManager) {
        Object old = managerMap.putIfAbsent(contextClassLoader(), featureManager);
        if (old != null) {
            throw new IllegalStateException(
                "There is already a FeatureManager associated with the context ClassLoader of the current thread!");
        }
    }
1325978
public static <T> BeanAttributes<T> createBeanAttributes(EnhancedAnnotatedType<T> annotated, InternalEjbDescriptor<?> descriptor, BeanManagerImpl manager) {
        final Set<Type> types = SharedObjectCache.instance(manager).getSharedSet(getSessionBeanTypes(annotated, Reflections.<InternalEjbDescriptor<T>> cast(descriptor)));
        return new BeanAttributesBuilder<T>(annotated, types, manager).build();
    }
885175
@SuppressWarnings({"rawtypes", "unchecked"})
	private static void loadAnnotationHandlers(HandlerLibrary lib, Trees trees) throws IOException {
		//No, that seemingly superfluous reference to JavacAnnotationHandler's classloader is not in fact superfluous!
		for (JavacAnnotationHandler handler : SpiLoadUtil.findServices(JavacAnnotationHandler.class, JavacAnnotationHandler.class.getClassLoader())) {
			handler.setTrees(trees);
			Class<? extends Annotation> annotationClass = handler.getAnnotationHandledByThisHandler();
			AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass);
			String annotationClassName = container.annotationClass.getName().replace("$", ".");
			List<AnnotationHandlerContainer<?>> list = lib.annotationHandlers.get(annotationClassName);
			if (list == null) lib.annotationHandlers.put(annotationClassName, list = new ArrayList<AnnotationHandlerContainer<?>>(1));
			list.add(container);
			lib.typeLibrary.addType(container.annotationClass.getName());
		}
	}
196422
@SuppressWarnings("static-method")
	protected void translateAnnotationsTo(List<JvmAnnotationReference> annotations, JvmAnnotationTarget target,
			Class<?>... exceptions) {
		final Set<String> excepts = new HashSet<>();
		for (final Class<?> type : exceptions) {
			excepts.add(type.getName());
		}
		final List<JvmAnnotationReference> addition = new ArrayList<>();
		for (final JvmAnnotationReference annotation : Iterables.filter(annotations, an -> {
			if (!ANNOTATION_TRANSLATION_FILTER.apply(an)) {
				return false;
			}
			return !excepts.contains(an.getAnnotation().getIdentifier());
		})) {
			addition.add(annotation);
		}
		target.getAnnotations().addAll(addition);
	}
1000329
private void populateAnnotations(Collection<Annotation> annotations) {
        for (Annotation each : annotations) {
            this.annotations.put(each.annotationType(), each);
        }
    }
66995
public static <T> BeanAttributes<T> forBean(EnhancedAnnotated<T, ?> annotated, BeanManagerImpl manager) {
        return new BeanAttributesBuilder<T>(annotated, manager).build();
    }
70805
@Internal
    public static Interceptor[] resolveAroundInterceptors(BeanContext beanContext, ExecutableMethod<?, ?> method, Interceptor... interceptors) {
        instrumentAnnotationMetadata(beanContext, method);
        return resolveInterceptorsInternal(method, Around.class, interceptors);
    }
523993
public Set<Constructor> getConstructorsAnnotatedWith(final Class<? extends Annotation> annotation) {
        Iterable<String> methods = store.get(index(MethodAnnotationsScanner.class), annotation.getName());
        return getConstructorsFromDescriptors(methods, loaders());
    }
283223
public static List<Method> getAnnotatedMethods(final Class<?> cls, final Class<? extends Annotation> annotationClass) {
        final List<Method> methodList = new ArrayList<>();

        // Retrieve annotation even when they are wrapped into OnWaves
        for (final Method m : cls.getDeclaredMethods()) {
            if (m.getAnnotationsByType(annotationClass).length > 0) {
                methodList.add(m);
            }
        }

        // Add implemented interfaces methods
        for (final Class<?> i : cls.getInterfaces()) {
            methodList.addAll(getAnnotatedMethods(i, annotationClass));
        }

        // Add super class methods
        if (cls.getSuperclass() != null) {
            methodList.addAll(getAnnotatedMethods(cls.getSuperclass(), annotationClass));
        }

        return methodList;
    }