Search in sources :

Example 16 with AnnotatedType

use of jakarta.enterprise.inject.spi.AnnotatedType in project myfaces by apache.

the class CDIInjectionProviderImpl method postConstruct.

@Override
public void postConstruct(Object instance, Object creationMetaData) throws InjectionProviderException {
    AnnotatedType annoType = beanManager.createAnnotatedType(instance.getClass());
    InjectionTarget target = beanManager.createInjectionTarget(annoType);
    target.postConstruct(instance);
}
Also used : AnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType) InjectionTarget(jakarta.enterprise.inject.spi.InjectionTarget)

Example 17 with AnnotatedType

use of jakarta.enterprise.inject.spi.AnnotatedType in project myfaces by apache.

the class PushContextCDIExtension method beforeBeanDiscovery.

void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery event, BeanManager beanManager) {
    // Register PushContextFactoryBean as a bean with CDI annotations, so the system
    // can take it into account, and use it later when necessary.
    AnnotatedType wcbean = beanManager.createAnnotatedType(WebsocketChannelTokenBuilderBean.class);
    event.addAnnotatedType(wcbean, wcbean.getJavaClass().getName());
    AnnotatedType sessionhandlerbean = beanManager.createAnnotatedType(WebsocketSessionBean.class);
    event.addAnnotatedType(sessionhandlerbean, sessionhandlerbean.getJavaClass().getName());
    AnnotatedType viewTokenBean = beanManager.createAnnotatedType(WebsocketViewBean.class);
    event.addAnnotatedType(viewTokenBean, viewTokenBean.getJavaClass().getName());
    AnnotatedType apphandlerbean = beanManager.createAnnotatedType(WebsocketApplicationBean.class);
    event.addAnnotatedType(apphandlerbean, apphandlerbean.getJavaClass().getName());
}
Also used : AnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType)

Example 18 with AnnotatedType

use of jakarta.enterprise.inject.spi.AnnotatedType in project core by weld.

the class WeldClassTest method testMemberClassWithGenericTypes.

/*
    * description = "WELD-216"
    */
@Test
public void testMemberClassWithGenericTypes() {
    final AnnotatedType<?> at = transformer.getEnhancedAnnotatedType(new Kangaroo().procreate().getClass(), AnnotatedTypeIdentifier.NULL_BDA_ID);
    transformer.getEnhancedAnnotatedType(new ForwardingAnnotatedType() {

        @Override
        public AnnotatedType delegate() {
            return at;
        }
    }, AnnotatedTypeIdentifier.NULL_BDA_ID);
}
Also used : ForwardingAnnotatedType(org.jboss.weld.util.annotated.ForwardingAnnotatedType) AnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType) EnhancedAnnotatedType(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType) ForwardingAnnotatedType(org.jboss.weld.util.annotated.ForwardingAnnotatedType) Test(org.junit.Test)

Example 19 with AnnotatedType

use of jakarta.enterprise.inject.spi.AnnotatedType in project core by weld.

the class WeldClassTest method testLocalClassWithGenericTypes.

/*
    * description = "WELD-216"
    */
@Test
public /*
    *  Not isolated, depends on someone else initializing Containers.
    *
    *  getUnproxyableClassException() catch(NoSuchMethodException)
    *           InstantiatorFactory.useInstantiators() <-- Needs Containers
    */
void testLocalClassWithGenericTypes() {
    final AnnotatedType<?> at = transformer.getEnhancedAnnotatedType(new Koala().procreate().getClass(), AnnotatedTypeIdentifier.NULL_BDA_ID);
    transformer.getEnhancedAnnotatedType(new ForwardingAnnotatedType() {

        @Override
        public AnnotatedType delegate() {
            return at;
        }
    }, AnnotatedTypeIdentifier.NULL_BDA_ID);
}
Also used : ForwardingAnnotatedType(org.jboss.weld.util.annotated.ForwardingAnnotatedType) AnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType) EnhancedAnnotatedType(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType) ForwardingAnnotatedType(org.jboss.weld.util.annotated.ForwardingAnnotatedType) Test(org.junit.Test)

Example 20 with AnnotatedType

use of jakarta.enterprise.inject.spi.AnnotatedType in project core by weld.

the class WeldClassTest method testAnonymousClassWithGenericTypes.

/*
    * description = "WELD-216"
    */
@Test
public /*
    *  Not isolated, depends on someone else initializing Containers.
    *
    *  getUnproxyableClassException() catch(NoSuchMethodException)
    *           InstantiatorFactory.useInstantiators() <-- Needs Containers
    */
void testAnonymousClassWithGenericTypes() {
    final AnnotatedType<?> at = transformer.getEnhancedAnnotatedType(new Possum().procreate().getClass(), AnnotatedTypeIdentifier.NULL_BDA_ID);
    transformer.getEnhancedAnnotatedType(new ForwardingAnnotatedType() {

        @Override
        public AnnotatedType delegate() {
            return at;
        }
    }, AnnotatedTypeIdentifier.NULL_BDA_ID);
}
Also used : ForwardingAnnotatedType(org.jboss.weld.util.annotated.ForwardingAnnotatedType) AnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType) EnhancedAnnotatedType(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType) ForwardingAnnotatedType(org.jboss.weld.util.annotated.ForwardingAnnotatedType) Test(org.junit.Test)

Aggregations

AnnotatedType (jakarta.enterprise.inject.spi.AnnotatedType)28 AnnotatedMethod (jakarta.enterprise.inject.spi.AnnotatedMethod)8 CreationalContext (jakarta.enterprise.context.spi.CreationalContext)5 Annotated (jakarta.enterprise.inject.spi.Annotated)5 Annotation (java.lang.annotation.Annotation)5 Type (java.lang.reflect.Type)5 InjectionTarget (jakarta.enterprise.inject.spi.InjectionTarget)4 Method (java.lang.reflect.Method)4 AbstractTest (org.jboss.cdi.tck.AbstractTest)4 SpecAssertions (org.jboss.test.audit.annotations.SpecAssertions)4 Test (org.junit.Test)4 Test (org.testng.annotations.Test)4 InjectionPoint (jakarta.enterprise.inject.spi.InjectionPoint)3 HashSet (java.util.HashSet)3 Set (java.util.Set)3 EnhancedAnnotatedType (org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType)3 ForwardingAnnotatedType (org.jboss.weld.util.annotated.ForwardingAnnotatedType)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ForwardingInjectionPoint (org.jboss.cdi.tck.util.ForwardingInjectionPoint)2 InProcessGrpcChannel (io.helidon.microprofile.grpc.core.InProcessGrpcChannel)1