Java 类javax.enterprise.inject.spi.ProcessAnnotatedType 实例源码

项目:maven-cdi-plugin-utils    文件:AbstractCDIMojo.java   
@SuppressWarnings("unused")
// will be called automatically by the CDI container for all annotated types
private void skipUnusedStepsFromBeanDiscovery(@Observes ProcessAnnotatedType<?> event, BeanManager beanManager)
    throws MojoExecutionException, MojoFailureException {
  // https://github.com/shillner/maven-cdi-plugin-utils/issues/14
  Class<?> type = event.getAnnotatedType().getJavaClass();
  ProcessingStep annotation = type.getAnnotation(ProcessingStep.class);
  if (annotation != null) {
    // adding the step to the list of all available processing steps
    String id = annotation.id();
    Preconditions.checkState(!this.allAvailableProcessingSteps.containsKey(id),
        "The processing step id '" + id + "' is not unique!");
    this.allAvailableProcessingSteps.put(id, annotation);

    // vetoing the bean discovery of a step that is not part of the current workflow
    // this prevents the issue that data shall be injected that isn't produced anywhere!
    ProcessingWorkflow workflow = getWorkflow();
    if (!workflow.containsStep(annotation.id())) {
      event.veto();
    }
  }
}
项目:opendata-common    文件:SchedulerExtension.java   
<T> void findJobs( @Observes @WithAnnotations({Cron.class}) ProcessAnnotatedType<T> pat, BeanManager beanManager )
{
    // Ensure we are named otherwise job won't fire as we can't locate it
    AnnotatedType<?> type = pat.getAnnotatedType();
    Class<?> clazz = type.getJavaClass();
    CDIUtils.addTypeAnnotation( pat, Named.class, () -> new NamedImpl( "Schedule_" + (id++) ) );

    if( type.isAnnotationPresent( Cron.class ) ) {
        if( Job.class.isAssignableFrom( clazz ) ) {
            jobClasses.add( clazz );
        }
        else {
            throw new UnsupportedOperationException( "@Cron on type must implement Job" );
        }
    }
    else {
        for( AnnotatedMethod<?> meth: type.getMethods() ) {
            if( meth.isAnnotationPresent( Cron.class ) ) {
                jobClasses.add( clazz );
            }
        }
    }
}
项目:opendata-common    文件:CDIUtils.java   
/**
 * Ensure we have an annotation present
 * <p>
 * @param <T>
 * @param pat
 * @param clazz
 * @param s
 *              <p>
 * @return
 */
public static <T> AnnotatedType<T> addTypeAnnotation( ProcessAnnotatedType<T> pat, Class<? extends Annotation> clazz, Supplier<Annotation> s )
{
    AnnotatedType<T> t = pat.getAnnotatedType();
    if( !t.isAnnotationPresent( clazz ) ) {
        MutableAnnotatedType<T> mat;
        if( t instanceof MutableAnnotatedType ) {
            mat = (MutableAnnotatedType<T>) t;
        }
        else {
            mat = new MutableAnnotatedType<>( t );
            pat.setAnnotatedType( mat );
        }
        mat.add( s.get() );
        return mat;
    }
    return t;
}
项目:Camel    文件:CdiCamelExtension.java   
private void processAnnotatedType(@Observes ProcessAnnotatedType<?> pat) {
    if (pat.getAnnotatedType().isAnnotationPresent(Vetoed.class)) {
        pat.veto();
    }
    if (hasAnnotation(pat.getAnnotatedType(), Converter.class)) {
        converters.add(pat.getAnnotatedType().getJavaClass());
    }
    if (hasAnnotation(pat.getAnnotatedType(), BeanInject.class, Consume.class, EndpointInject.class, Produce.class, PropertyInject.class)) {
        camelBeans.add(pat.getAnnotatedType());
    }
    if (hasAnnotation(pat.getAnnotatedType(), Consume.class)) {
        eagerBeans.add(pat.getAnnotatedType());
    }
    if (hasAnnotation(pat.getAnnotatedType(), ImportResource.class)) {
        resources.add(pat.getAnnotatedType().getAnnotation(ImportResource.class));
    }
}
项目:Camel    文件:CdiCamelExtension.java   
private void camelFactoryProducers(@Observes ProcessAnnotatedType<CdiCamelFactory> pat, BeanManager manager) {
    pat.setAnnotatedType(
        new AnnotatedTypeDelegate<>(
            pat.getAnnotatedType(), pat.getAnnotatedType().getMethods().stream()
            .filter(am -> am.isAnnotationPresent(Produces.class))
            .filter(am -> am.getTypeClosure().stream().noneMatch(isEqual(TypeConverter.class)))
            .peek(am -> producerQualifiers.put(am.getJavaMember(), getQualifiers(am, manager)))
            .map(am -> new AnnotatedMethodDelegate<>(am, am.getAnnotations().stream()
                .filter(annotation -> !manager.isQualifier(annotation.annotationType()))
                .collect(collectingAndThen(toSet(), annotations -> {
                    annotations.add(EXCLUDED); return annotations;
                }))))
            .collect(toSet())));
}
项目:Camel    文件:CamelCdiTestExtension.java   
/**
 * Activates the alternatives declared with {@code @Beans} globally for the
 * application.
 * <p/>
 * For every types and every methods of every types declared with
 * {@link Beans#alternatives()}, the {@code Priority} annotation is added
 * so that the corresponding alternatives are selected globally for the
 * entire application.
 *
 * @see Beans
 */
private <T> void alternatives(@Observes @WithAnnotations(Alternative.class) ProcessAnnotatedType<T> pat) {
    AnnotatedType<T> type = pat.getAnnotatedType();

    if (!Arrays.asList(beans.alternatives()).contains(type.getJavaClass())) {
        // Only select globally the alternatives that are declared with @Beans
        return;
    }

    Set<AnnotatedMethod<? super T>> methods = new HashSet<>();
    for (AnnotatedMethod<? super T> method : type.getMethods()) {
        if (method.isAnnotationPresent(Alternative.class) && !method.isAnnotationPresent(Priority.class)) {
            methods.add(new AnnotatedMethodDecorator<>(method, PriorityLiteral.of(APPLICATION)));
        }
    }

    if (type.isAnnotationPresent(Alternative.class) && !type.isAnnotationPresent(Priority.class)) {
        pat.setAnnotatedType(new AnnotatedTypeDecorator<>(type, PriorityLiteral.of(APPLICATION), methods));
    } else if (!methods.isEmpty()) {
        pat.setAnnotatedType(new AnnotatedTypeDecorator<>(type, methods));
    }
}
项目:SimplePersistence    文件:HibernateFilterExtension.java   
public <T> void processPackageAnnotatedType(@Observes final ProcessAnnotatedType<T> event) {
    final Package pkg = event.getAnnotatedType().getJavaClass().getPackage();

    if (pkg == null) {
        return;
    }

    final String packageName = pkg.getName();
    if (processedPackages.contains(packageName)) {
        return; // already processed a class from this package
    }

    processedPackages.add(packageName);
    if (pkg.isAnnotationPresent(FilterParameters.class)) {
        addFilterParameters(pkg.getAnnotation(FilterParameters.class));
    }

    if (pkg.isAnnotationPresent(FilterParameter.class)) {
        // TODO addFilterParameter(pkg.getAnnotation(FilterParameter.class));
    }
}
项目:deltaspike    文件:MappedJsf2ScopeExtension.java   
protected void convertJsf2Scopes(@Observes ProcessAnnotatedType processAnnotatedType)
{
    if (!isActivated)
    {
        return;
    }

    //TODO
    //CodiStartupBroadcaster.broadcastStartup();

    Class<? extends Annotation> jsf2ScopeAnnotation = getJsf2ScopeAnnotation(processAnnotatedType);

    if (jsf2ScopeAnnotation != null && !isBeanWithManagedBeanAnnotation(processAnnotatedType))
    {
        processAnnotatedType.setAnnotatedType(
                convertBean(processAnnotatedType.getAnnotatedType(), jsf2ScopeAnnotation));
    }
}
项目:deltaspike    文件:ViewConfigExtension.java   
@SuppressWarnings("UnusedDeclaration")
protected void buildViewConfigMetaDataTree(@Observes final ProcessAnnotatedType pat)
{
    if (!isActivated)
    {
        return;
    }

    buildViewConfigMetaDataTreeFor(
        pat.getAnnotatedType().getJavaClass(), pat.getAnnotatedType().getAnnotations(), new VetoCallback() {
                @Override
                public void veto()
                {
                    pat.veto();
                }
            });
}
项目:deltaspike    文件:NamingConventionAwareMetadataFilter.java   
public void ensureNamingConvention(@Observes ProcessAnnotatedType processAnnotatedType)
{
    Class<?> beanClass = processAnnotatedType.getAnnotatedType().getJavaClass();

    Named namedAnnotation = beanClass.getAnnotation(Named.class);
    if (namedAnnotation != null &&
            namedAnnotation.value().length() > 0 &&
            Character.isUpperCase(namedAnnotation.value().charAt(0)))
    {
        AnnotatedTypeBuilder builder = new AnnotatedTypeBuilder();
        builder.readFromType(beanClass);

        String beanName = namedAnnotation.value();
        String newBeanName = beanName.substring(0, 1).toLowerCase() + beanName.substring(1);

        builder.removeFromClass(Named.class)
                .addToClass(new NamedLiteral(newBeanName));

        processAnnotatedType.setAnnotatedType(builder.create());
    }
}
项目:deltaspike    文件:MessageBundleExtension.java   
@SuppressWarnings("UnusedDeclaration")
protected void detectInterfaces(@Observes ProcessAnnotatedType processAnnotatedType)
{
    if (!isActivated)
    {
        return;
    }

    AnnotatedType<?> type = processAnnotatedType.getAnnotatedType();

    if (type.isAnnotationPresent(MessageBundle.class))
    {
        if (validateMessageBundle(type.getJavaClass()))
        {
            messageBundleTypes.add(type);
        }
    }
}
项目:deltaspike    文件:ExcludeExtension.java   
private boolean evalExcludeInProjectStage(ProcessAnnotatedType processAnnotatedType, Exclude exclude,
    ProjectStage currentlyConfiguredProjectStage)
{
    Class<? extends ProjectStage>[] activatedIn = exclude.ifProjectStage();

    if (activatedIn.length == 0)
    {
        return true;
    }

    if (isInProjectStage(activatedIn, currentlyConfiguredProjectStage))
    {
        veto(processAnnotatedType, "IfProjectState");
        return false;
    }
    return true;
}
项目:deltaspike    文件:ExcludeExtension.java   
private boolean evalExcludeNotInProjectStage(ProcessAnnotatedType processAnnotatedType, Exclude exclude,
    ProjectStage currentlyConfiguredProjectStage)
{
    Class<? extends ProjectStage>[] notIn = exclude.exceptIfProjectStage();

    if (notIn.length == 0)
    {
        return true;
    }

    if (!isInProjectStage(notIn, currentlyConfiguredProjectStage))
    {
        veto(processAnnotatedType, "ExceptIfProjectState");
        return false;
    }
    return true;
}
项目:testee.fi    文件:JmsExtension.java   
public <X> void beans(
        final @Observes ProcessAnnotatedType<X> processBean
) {
    final MessageDriven annotation = processBean.getAnnotatedType().getAnnotation(MessageDriven.class);
    if (annotation != null) {
        final Class<X> javaClass = processBean.getAnnotatedType().getJavaClass();
        if (!MessageListener.class.isAssignableFrom(javaClass)) {
            throw new TestEEfiException("The @MessageDriven bean " + javaClass.getName()
                    + " does not implement MessageListener"
            );
        }
        registry.register(annotation, (Class<? extends MessageListener>) javaClass);
    }
}
项目:testee.fi    文件:MockingExtension.java   
public <X> void beans(
        final @Observes ProcessAnnotatedType<X> processBean
) {
    if (!processBean.getAnnotatedType().isAnnotationPresent(Interceptor.class)) {
        return;
    }
    final FilteringAnnotatedTypeWrapper<X> filtered = new FilteringAnnotatedTypeWrapper<>(
            processBean.getAnnotatedType(),
            it -> it != Priority.class
    );
    processBean.setAnnotatedType(filtered);
}
项目:aries-jpa    文件:JpaExtension.java   
public <T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> event, BeanManager manager) {
    boolean hasPersistenceField = false;
    for (AnnotatedField<? super T> field : event.getAnnotatedType().getFields()) {
        if (field.isAnnotationPresent(PersistenceContext.class)
                || field.isAnnotationPresent(PersistenceUnit.class)) {
            hasPersistenceField = true;
            break;
        }
    }
    if (hasPersistenceField) {
        PersistenceAnnotatedType<T> pat = new PersistenceAnnotatedType<T>(manager, event.getAnnotatedType());
        beans.addAll(pat.getProducers());
        event.setAnnotatedType(pat);
    }
}
项目:wildfly-microprofile-health    文件:CDIExtension.java   
/**
 * Discover all classes that implements HealthCheckProcedure
 */
public void observeResources(@Observes @WithAnnotations({Health.class})  ProcessAnnotatedType<? extends HealthCheck> event) {
   AnnotatedType<? extends HealthCheck> annotatedType = event.getAnnotatedType();
   Class<? extends HealthCheck> javaClass = annotatedType.getJavaClass();
   MicroProfileHealthLogger.ROOT_LOGGER.debugf("Discovered health check procedure %s", javaClass);
   delegates.add(annotatedType);
}
项目:snoopee    文件:SnoopEEScannerExtension.java   
<T> void processAnnotatedType(@Observes @WithAnnotations(EnableSnoopEEClient.class) ProcessAnnotatedType<T> pat) {

        // workaround for WELD bug revealed by JDK8u60
        final ProcessAnnotatedType<T> snoopAnnotated = pat;

        LOGGER.config(() -> "Found @EnableSnoopEEClient annotated class: " + snoopAnnotated.getAnnotatedType().getJavaClass().getName());
        snoopEnabled = true;
        serviceName = snoopAnnotated.getAnnotatedType().getAnnotation(EnableSnoopEEClient.class).serviceName();
        LOGGER.config(() -> "SnoopEE Service name is: " + serviceName);
    }
项目:snoopee    文件:SnoopEEScannerExtension.java   
<T> void processAnnotatedType(@Observes @WithAnnotations(EnableSnoopEEClient.class) ProcessAnnotatedType<T> pat) {

        // workaround for WELD bug revealed by JDK8u60
        final ProcessAnnotatedType<T> snoopAnnotated = pat;

        LOGGER.config(() -> "Found @EnableSnoopEEClient annotated class: " + snoopAnnotated.getAnnotatedType().getJavaClass().getName());
        snoopEnabled = true;
        serviceName = snoopAnnotated.getAnnotatedType().getAnnotation(EnableSnoopEEClient.class).serviceName();
        LOGGER.config(() -> "SnoopEE Service name is: " + serviceName);
    }
项目:weld-vertx    文件:ServiceProxyExtension.java   
void findServiceInterfaces(@Observes @WithAnnotations(ProxyGen.class) ProcessAnnotatedType<?> event, BeanManager beanManager) {
    AnnotatedType<?> annotatedType = event.getAnnotatedType();
    if (annotatedType.isAnnotationPresent(ProxyGen.class) && annotatedType.getJavaClass().isInterface()) {
        LOGGER.debug("Service interface {0} discovered", annotatedType.getJavaClass());
        serviceInterfaces.add(annotatedType.getJavaClass());
    }
}
项目:opendata-common    文件:CDIUtils.java   
/**
 * Pass an AnnotatedType to a consumer if an annotation is present
 *
 * @param <T>
 * @param pat
 * @param annotationType
 * @param c
 */
public static <T> void forEachType( ProcessAnnotatedType<T> pat, Class<? extends Annotation> annotationType,
                                    Consumer<? super AnnotatedType<? extends Object>> c )
{
    AnnotatedType<?> type = pat.getAnnotatedType();
    if( type.isAnnotationPresent( annotationType ) ) {
        c.accept( type );
    }
}
项目:opendata-common    文件:CDIUtils.java   
/**
 * For each method in a type that has a specific annotation pass the class and method to a consumer
 *
 * @param <T>
 * @param pat
 * @param annotationType
 * @param c
 */
public static <T> void forEachMethod( ProcessAnnotatedType<T> pat, Class<? extends Annotation> annotationType,
                                      BiConsumer<Class<?>, ? super AnnotatedMethod<? extends Object>> c )
{
    AnnotatedType<?> type = pat.getAnnotatedType();
    Class<?> clazz = type.getJavaClass();
    type.getMethods()
            .stream().
            filter( meth -> meth.isAnnotationPresent( annotationType ) ).
            forEach( m -> c.accept( clazz, m ) );
}
项目:wildfly-swarm    文件:HealthExtension.java   
public <T> void observeResources(@Observes @WithAnnotations({Health.class}) ProcessAnnotatedType<T> event) {

        AnnotatedType<T> annotatedType = event.getAnnotatedType();
        Class<T> javaClass = annotatedType.getJavaClass();
        for (Class<?> intf : javaClass.getInterfaces()) {
            if (intf.getName().equals(HealthCheck.class.getName())) {
                log.info(">> Discovered health check procedure " + javaClass);
                delegates.add(annotatedType);
            }
        }
    }
项目:snoop    文件:SnoopScannerExtension.java   
<T> void processAnnotatedType(@Observes @WithAnnotations(EnableSnoopClient.class) ProcessAnnotatedType<T> pat) {

        // workaround for WELD bug revealed by JDK8u60
        final ProcessAnnotatedType<T> snoopAnnotated = pat;

        LOGGER.config(() -> "Found @EnableSnoopClient annotated class: " + snoopAnnotated.getAnnotatedType().getJavaClass().getName());
        snoopEnabled = true;
        serviceName = snoopAnnotated.getAnnotatedType().getAnnotation(EnableSnoopClient.class).serviceName();
        LOGGER.config(() -> "Snoop Service name is: " + serviceName);
    }
项目:snoop    文件:SnoopEurekaScannerExtension.java   
<T> void processAnnotatedType(@Observes @WithAnnotations({EnableEurekaClient.class}) ProcessAnnotatedType<T> pat) {

   LOGGER.config(() -> "Found @EnableEurekaClient annotated class: " + pat.getAnnotatedType().getJavaClass().getName());
   eurekaEnabled = true;
   applicationName = pat.getAnnotatedType().getAnnotation(EnableEurekaClient.class).name();
   LOGGER.config(() -> "Eureka application name is: " + applicationName);
}
项目:ocelot    文件:CDIExtension.java   
<T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> pat) {
    if (pat.getAnnotatedType().isAnnotationPresent(Configuration.class)) {
        final AnnotatedType<T> type = pat.getAnnotatedType();
        AnnotatedType<T> wrapped = new SpringConfigurationWrapper<>(type);
        pat.setAnnotatedType(wrapped);
        logger.debug("Configuration is added as CDIBean with Annotation: {} : {}", OcelotSpringConfiguration.class, wrapped);
    }
}
项目:axon-cdi    文件:AxonCdiExtension.java   
<X> void processAggregateRootAnnotatedType(
        @Observes final ProcessAnnotatedType<X> pat, final BeanManager beanManager) {
    AnnotatedType<X> at = pat.getAnnotatedType();
    boolean isAggregateRoot = AxonUtils.isAnnotatedAggregateRoot(at.getJavaClass());
    if (isAggregateRoot) {
        configuration.add(AggregateRootInfo.of(beanManager, at));
        pat.veto();
    }

}
项目:axon-cdi    文件:AxonCdiExtension.java   
<X> void processSagaAnnotatedType(
        @Observes final ProcessAnnotatedType<X> pat, final BeanManager beanManager) {
    AnnotatedType<X> at = pat.getAnnotatedType();
    if (AxonUtils.isAnnotatedSaga(at.getJavaClass())) {
        configuration.add(SagaInfo.of(beanManager, at));
        // pat.veto(); // don't veto this bean. Because we need it to discover EventScheduler injected beans
    }
}
项目:axon-cdi    文件:AxonCdiExtension.java   
<X> void processCommandsAndEventsHandlerTypes(
        @Observes final ProcessAnnotatedType<X> pat, final BeanManager beanManager) {
    AnnotatedType<X> at = pat.getAnnotatedType();
    boolean isCommandHandler = AxonUtils.isCommandHandler(at.getJavaClass());
    boolean isEventHandler = AxonUtils.isEventHandler(at.getJavaClass());
    Preconditions.checkArgument(!isEventHandler || !isCommandHandler,
            "Provided type cannot be both event and command handler: %s", at);
    if (isCommandHandler) {
        configuration.add(HandlerInfo.commandHandler(beanManager, at));
    } else if (isEventHandler) {
        configuration.add(HandlerInfo.eventHandler(beanManager, at));
    }
}
项目:SimplePersistence    文件:HibernateFilterExtension.java   
public <T> void processAnnotatedType(
        @Observes @WithAnnotations({ FilterParameters.class, FilterParameter.class }) final ProcessAnnotatedType<T> event) {
    final AnnotatedType<T> annotatedType = event.getAnnotatedType();
    if (annotatedType.isAnnotationPresent(FilterParameters.class)) {
        final FilterParameters annotation = annotatedType.getAnnotation(FilterParameters.class);
        addFilterParameters(annotation);
    }
    if (annotatedType.isAnnotationPresent(FilterParameter.class)) {
        // TODO deal with single parameters
    }
}
项目:spearal-jpa2    文件:SpearalExtension.java   
public <X> void processInjectedPersistenceResources(@Observes ProcessAnnotatedType<X> event) {
    for (AnnotatedMethod<? super X> method : event.getAnnotatedType().getMethods())
        handleAnnotatedMember(method);

    for (AnnotatedField<? super X> field : event.getAnnotatedType().getFields())
        handleAnnotatedMember(field);
}
项目:javaee-nosql    文件:MongoExtension.java   
/**
 * Looks for {@link MongoClientDefinition} annotation to capture it.
 * Also Checks if the application contains more than one of these definition
 */
void detectMongoClientDefinition(
        @Observes @WithAnnotations(MongoClientDefinition.class) ProcessAnnotatedType<?> pat) {
    AnnotatedType at = pat.getAnnotatedType();

    MongoClientDefinition md = at.getAnnotation(MongoClientDefinition.class);
    String name = md.name();

    if (mongoDef != null) {
        moreThanOne = true;
    } else {
        mongoDef = md;
    }
}
项目:JavaIncrementalParser    文件:MyExtension.java   
<T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> pat) {
    Logger.getAnonymousLogger().log(Level.INFO,
            "CDI Extension Processing Annotation -> {0}",
            pat.
            getAnnotatedType().
            getJavaClass().
            getName());
}
项目:javaee_projects    文件:ControllerAnnotator.java   
@SuppressWarnings({ "unchecked", "rawtypes" })
public void annotates(@Observes ProcessAnnotatedType pat) {
    AnnotatedType annotatedType = pat.getAnnotatedType();
    Class type = annotatedType.getJavaClass();

    // verify if it has Controller in its name
    if(type.getSimpleName().endsWith("Controller")) {
        pat.setAnnotatedType(new AnnotatedTypeControllerWrapper(annotatedType));
        System.out.println("[CDI Extension] Controller found: " + type.getSimpleName());
    }
}
项目:BeanTest    文件:BeanTestExtension.java   
/**
 * Adds {@link Transactional} and {@link RequestScoped} to the given annotated type and converts
 * its EJB injection points into CDI injection points (i.e. it adds the {@link Inject})
 * @param <X> the type of the annotated type
 * @param pat the process annotated type.
 */
private <X> void modifiyAnnotatedTypeMetadata(ProcessAnnotatedType<X> pat) {
    AnnotatedType at = pat.getAnnotatedType();

    AnnotatedTypeBuilder<X> builder = new AnnotatedTypeBuilder<X>().readFromType(at);
    builder.addToClass(AnnotationInstances.TRANSACTIONAL).addToClass(AnnotationInstances.REQUEST_SCOPED);

    InjectionHelper.addInjectAnnotation(at, builder);
    //Set the wrapper instead the actual annotated type
    pat.setAnnotatedType(builder.create());

}
项目:oxCore    文件:SecurityExtension.java   
public <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> pat) {
    // Wrap this to override the annotations of the class
    final AnnotatedType<X> at = pat.getAnnotatedType();
    final AnnotatedTypeConfigurator<X> cat = pat.configureAnnotatedType();

    // Collect Secure annotation from the type
    List<Secure> typeSecureAnnotations = new ArrayList<Secure>();
    for (Annotation annotation : pat.getAnnotatedType().getAnnotations()) {
        collectAnnotations(Secure.class, annotation, typeSecureAnnotations);
    }

    // Collect the Secure annotations from the methods
    for (AnnotatedMethodConfigurator<? super X> methodConfiguration : cat.methods()) {
        AnnotatedMethod<?> method = methodConfiguration.getAnnotated();
        final List<Secure> methodAnnotations = new ArrayList<Secure>(typeSecureAnnotations);

        collectAnnotations(Secure.class, method, methodAnnotations);

        // Store in the map if we find Secure annotations
        if (methodAnnotations.size() > 0) {
            InterceptSecure is = new InterceptSecureImpl(methodAnnotations.toArray(new Secure[methodAnnotations.size()]));

            // Add InterceptSecure annotation
            methodConfiguration.add(is);

            interceptSecureForMethods.put(method.getJavaMember(), is);
        }
    }
}
项目:hammock    文件:JerseyCdiExtension.java   
public <T> void observeResources(@WithAnnotations({ Path.class }) @Observes ProcessAnnotatedType<T> event) {
    AnnotatedType<T> annotatedType = event.getAnnotatedType();

    if (!annotatedType.getJavaClass().isInterface()) {
        this.resources.add(annotatedType.getJavaClass());
    }
}
项目:hammock    文件:JerseyCdiExtension.java   
public <T> void observeProviders(@WithAnnotations({ Provider.class }) @Observes ProcessAnnotatedType<T> event) {
    AnnotatedType<T> annotatedType = event.getAnnotatedType();

    if (!annotatedType.getJavaClass().isInterface()) {
        this.providers.add(annotatedType.getJavaClass());
    }
}
项目:cdi-test    文件:ActivatableAlternativeBuilder.java   
public ActivatableAlternativeBuilder(ProcessAnnotatedType<X> pat) {
    this.pat = pat;
    type = pat.getAnnotatedType();
    javaClass = type.getJavaClass();
    builder = new AnnotatedTypeBuilder<>();
    builder.readFromType(type);
}
项目:cdi-test    文件:TestScopeExtension.java   
public <X> void processAnnotatedTypes(@Observes ProcessAnnotatedType<X> pat) {
    AnnotatedType<X> type = pat.getAnnotatedType();
    final Class<X> javaClass = type.getJavaClass();
    if (javaClass.isAnnotationPresent(ActivatableTestImplementation.class)) {
        new ActivatableAlternativeBuilder<X>(pat).invoke();
    } else if (ReflectionsUtils.isTestClass(javaClass)) {
        AnnotationUtils.addClassAnnotation(pat, new AnnotationLiteral<TestSuiteScoped>() {
        });
    } else if (ReflectionsUtils.shouldProxyCdiType(javaClass)) {
        AnnotationUtils.addClassAnnotation(pat, new AnnotationLiteral<Replaceable>() {
        });
    }
    updateDecoratedTypes(pat);
}