Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.Annotated


    @SuppressWarnings("rawtypes")
    @Test
    @SpecAssertion(section=INJECTION_POINT, id="dab")
    public void testInjectionPointGetAnnotated() {

        Annotated fooFieldAnnotated = bar.getFoo().getInjectionPoint().getAnnotated();
        assertTrue(fooFieldAnnotated instanceof AnnotatedField);
        assertEquals(((AnnotatedField) fooFieldAnnotated).getJavaMember().getName(), "fooInstance");
        assertTrue(fooFieldAnnotated.isAnnotationPresent(Any.class));

        Annotated fooInitializerAnnnotated = bar.getInitializerFoo().getInjectionPoint().getAnnotated();
        assertTrue(fooInitializerAnnnotated instanceof AnnotatedParameter);
        assertEquals(((AnnotatedParameter) fooInitializerAnnnotated).getPosition(), 0);

        Annotated fooConstructorAnnnotated = bar.getConstructorInjectionFoo().getInjectionPoint().getAnnotated();
        assertTrue(fooConstructorAnnnotated instanceof AnnotatedParameter);
        assertEquals(((AnnotatedParameter) fooConstructorAnnnotated).getPosition(), 0);
    }
View Full Code Here


    @SuppressWarnings("rawtypes")
    @Test
    @SpecAssertions({ @SpecAssertion(section = INJECTION_POINT, id = "daa"), @SpecAssertion(section = EVENT_METADATA, id = "b") })
    public void testGetAnnotatedType() {

        Annotated lastAnnotated = null;

        notifier.fireInfoEvent();
        lastAnnotated = infoObserver.getLastAnnotated();
        assertTrue(lastAnnotated instanceof AnnotatedField);
        assertEquals(((AnnotatedField) lastAnnotated).getJavaMember().getName(), "infoEvent");
        assertTrue(lastAnnotated.isAnnotationPresent(Inject.class));

        notifier.fireInitializerInfoEvent();
        lastAnnotated = infoObserver.getLastAnnotated();
        assertTrue(lastAnnotated instanceof AnnotatedParameter);
        assertEquals(((AnnotatedParameter) lastAnnotated).getPosition(), 0);

        notifier.fireConstructorInfoEvent();
        lastAnnotated = infoObserver.getLastAnnotated();
        assertTrue(lastAnnotated instanceof AnnotatedParameter);
        assertEquals(((AnnotatedParameter) lastAnnotated).getPosition(), 0);
        assertTrue(lastAnnotated.isAnnotationPresent(Nice.class));
    }
View Full Code Here

    @SuppressWarnings("rawtypes")
    @Test
    public void testInjectionPointGetAnnotated() {

        Annotated fooFieldAnnotated = bar.getFoo().getInjectionPoint().getAnnotated();
        assertTrue(fooFieldAnnotated instanceof AnnotatedField);
        assertEquals(((AnnotatedField) fooFieldAnnotated).getJavaMember().getName(), "fooInstance");

        Annotated fooInitializerAnnnotated = bar.getInitializerFoo().getInjectionPoint().getAnnotated();
        assertTrue(fooInitializerAnnnotated instanceof AnnotatedParameter);
        assertEquals(((AnnotatedParameter) fooInitializerAnnnotated).getPosition(), 0);

        Annotated fooConstructorAnnnotated = bar.getConstructorInjectionFoo().getInjectionPoint().getAnnotated();
        assertTrue(fooConstructorAnnnotated instanceof AnnotatedParameter);
        assertEquals(((AnnotatedParameter) fooConstructorAnnnotated).getPosition(), 0);
    }
View Full Code Here

     * to AfterDeploymentValidation. see https://issues.jboss.org/browse/CDI-274
     * Kept around to do simple deployment validation of ProviderRelated qualifier.
     */
    private void CommonsProcessOAuthTier(ProcessBean<? extends ProviderConfigOauth> pb) {

        Annotated annotated = pb.getAnnotated();
        Set<Annotation> qualifiers = getAnnotationsWithMeta(annotated, ProviderRelated.class);
        if (qualifiers.size() != 1)
            throw new AgoravaException("A RemoteService bean should have one and only one service related Qualifier : " + pb
                    .getAnnotated().toString());

View Full Code Here

        CommonsProcessOAuthTier(pb);
    }


    private void captureOauthSessionProducer(@Observes ProcessProducerMethod<OAuthSession, ?> pb) {
        Annotated at = pb.getAnnotated();

        Bean<?> bean = pb.getBean();

        if (bean.getQualifiers().contains(CurrentLiteral.INSTANCE)) {
            Set<Annotation> providerRelatedAnnotations = getAnnotationsWithMeta(bean.getQualifiers(), ProviderRelated.class);
View Full Code Here

    }

    @Test
    @SpecAssertions({ @SpecAssertion(section = PBA, id = "baa") })
    public void testManagedBeanAnnotated() {
        Annotated alphaAnnotated = extension.getAnnotatedMap().get(Alpha.class);
        assertNotNull(alphaAnnotated);
        assertTrue(alphaAnnotated instanceof AnnotatedType);
        @SuppressWarnings("unchecked")
        AnnotatedType<Alpha> alphaAnnotatedType = (AnnotatedType<Alpha>) alphaAnnotated;
        assertEquals(alphaAnnotatedType.getJavaClass(), Alpha.class);
View Full Code Here

    }

    @Test
    @SpecAssertions({ @SpecAssertion(section = PBA, id = "bab") })
    public void testSessionBeanAnnotated() {
        Annotated deltaAnnotated = extension.getAnnotatedMap().get(Delta.class);
        assertNotNull(deltaAnnotated);
        assertTrue(deltaAnnotated instanceof AnnotatedType);
        @SuppressWarnings("unchecked")
        AnnotatedType<Delta> deltaAnnotatedType = (AnnotatedType<Delta>) deltaAnnotated;
        assertEquals(deltaAnnotatedType.getJavaClass(), Delta.class);
View Full Code Here

    }

    @Test
    @SpecAssertions({ @SpecAssertion(section = PBA, id = "bac") })
    public void testProducerMethodAnnotated() {
        Annotated bravoAnnotated = extension.getAnnotatedMap().get(Bravo.class);
        assertNotNull(bravoAnnotated);
        assertTrue(bravoAnnotated instanceof AnnotatedMethod);
        @SuppressWarnings("unchecked")
        AnnotatedMethod<Bravo> bravoAnnotatedMethod = (AnnotatedMethod<Bravo>) bravoAnnotated;
        assertEquals(bravoAnnotatedMethod.getJavaMember().getName(), "createBravo");
View Full Code Here

    }

    @Test
    @SpecAssertions({ @SpecAssertion(section = PBA, id = "bad") })
    public void testProducerFieldAnnotated() {
        Annotated charlieAnnotated = extension.getAnnotatedMap().get(Charlie.class);
        assertNotNull(charlieAnnotated);
        assertTrue(charlieAnnotated instanceof AnnotatedField);
        @SuppressWarnings("unchecked")
        AnnotatedField<Charlie> charlieAnnotatedField = (AnnotatedField<Charlie>) charlieAnnotated;
        assertEquals(charlieAnnotatedField.getJavaMember().getName(), "charlie");
View Full Code Here

    /**
     * Lets detect all producer methods createing instances of {@link RouteBuilder} which are annotated with {@link org.apache.camel.cdi.ContextName}
     * so they can be auto-registered
     */
    public void detectProducerRoutes(@Observes ProcessProducerMethod<?, ?> event) {
        Annotated annotated = event.getAnnotated();
        ContextName annotation = annotated.getAnnotation(ContextName.class);
        Class<?> returnType = event.getAnnotatedProducerMethod().getJavaMember().getReturnType();
        if (isRoutesBean(returnType)) {
            addRouteBuilderBean(event.getBean(), annotation);
        }
    }
View Full Code Here

TOP

Related Classes of javax.enterprise.inject.spi.Annotated

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.