Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.AnnotatedType


        // First get BeanDeploymentArchive for this ejb
        BeanDeploymentArchive bda = weldDeployer.getBeanDeploymentArchiveForBundle(topLevelBundleDesc);
        //BeanDeploymentArchive bda = getBDAForBeanClass(topLevelBundleDesc, managedObject.getClass().getName());
        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());
        BeanManager beanManager = bootstrap.getManager(bda);
        AnnotatedType annotatedType = beanManager.createAnnotatedType(managedObject.getClass());
        InjectionTarget it = beanManager.createInjectionTarget(annotatedType);
        CreationalContext cc = beanManager.createCreationalContext(null);
        it.inject(managedObject, cc);
    }
View Full Code Here


        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());

        BeanManager beanManager = bootstrap.getManager(bda);

        AnnotatedType annotatedType = beanManager.createAnnotatedType(managedClass);
        if (!invokePostConstruct) {
            annotatedType = new NoPostConstructPreDestroyAnnotatedType(annotatedType);
        }

        InjectionTarget it = ((BeanDeploymentArchiveImpl)bda).getInjectionTarget(annotatedType);
View Full Code Here

        return interceptorFound;
    }

    private void checkAroundInvokeConditions(AnnotatedMethod method)
    {
        AnnotatedType annotatedType = method.getDeclaringType();

        List<AnnotatedParameter<T>> parameters = method.getParameters();
        List<Class<?>> clazzParameters = new ArrayList<Class<?>>();
        for(AnnotatedParameter<T> parameter : parameters)
        {
            clazzParameters.add(ClassUtil.getClazz(parameter.getBaseType()));
        }

        Class<?>[] params = clazzParameters.toArray(new Class<?>[clazzParameters.size()]);

        if (params.length != 1 || !params[0].equals(InvocationContext.class))
        {
            throw new WebBeansConfigurationException("@AroundInvoke annotated method : "
                    + method.getJavaMember().getName() + " in class : " + annotatedType.getJavaClass().getName()
                    + " can not take any formal arguments other than InvocationContext");
        }

        if (!method.getJavaMember().getReturnType().equals(Object.class))
        {
            throw new WebBeansConfigurationException("@AroundInvoke annotated method : "
                    + method.getJavaMember().getName()+ " in class : " + annotatedType.getJavaClass().getName()
                    + " must return Object type");
        }

        if (Modifier.isStatic(method.getJavaMember().getModifiers()) ||
                Modifier.isFinal(method.getJavaMember().getModifiers()))
        {
            throw new WebBeansConfigurationException("@AroundInvoke annotated method : "
                    + method.getJavaMember().getName( )+ " in class : " + annotatedType.getJavaClass().getName()
                    + " can not be static or final");
        }
    }
View Full Code Here

        // First get BeanDeploymentArchive for this ejb
        BeanDeploymentArchive bda = weldDeployer.getBeanDeploymentArchiveForBundle(topLevelBundleDesc);
        //BeanDeploymentArchive bda = getBDAForBeanClass(topLevelBundleDesc, managedObject.getClass().getName());
        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());
        BeanManager beanManager = bootstrap.getManager(bda);
        AnnotatedType annotatedType = beanManager.createAnnotatedType(managedObject.getClass());
        InjectionTarget it = beanManager.createInjectionTarget(annotatedType);
        CreationalContext cc = beanManager.createCreationalContext(null);
        it.inject(managedObject, cc);
    }
View Full Code Here

        BeanDeploymentArchive bda = weldDeployer.getBeanDeploymentArchiveForBundle(topLevelBundleDesc);
        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());
        BeanManager beanManager = bootstrap.getManager(bda);
        CreationalContext cc = beanManager.createCreationalContext(null);

        AnnotatedType annotatedType = beanManager.createAnnotatedType(interceptorClass);
        InjectionTarget it =
            ((WeldManager) beanManager).getInjectionTargetFactory(annotatedType).createInterceptorInjectionTarget();
        T interceptorInstance = (T) it.produce(cc);
        it.inject(interceptorInstance, cc);
View Full Code Here

        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());

        BeanManager beanManager = bootstrap.getManager(bda);

        AnnotatedType annotatedType = beanManager.createAnnotatedType(managedClass);
        if (!invokePostConstruct) {
            annotatedType = new NoPostConstructPreDestroyAnnotatedType(annotatedType);
        }

        InjectionTarget it = ((BeanDeploymentArchiveImpl)bda).getInjectionTarget(annotatedType);
View Full Code Here

*/
public class MessageBusBean implements Bean {
  final MessageBus delegate;

  public MessageBusBean(BeanManager bm, MessageBus delegate) {
    AnnotatedType at = new AnnotatedType() {
      public Class getJavaClass() {
        return ServerMessageBusImpl.class;
      }

      public Set getConstructors() {
View Full Code Here

    }

    //todo: needs to be rewritten to support @SessionScoped
    for (final Class<?> rpcIntf : managedTypes.getRpcEndpoints().keySet()) {
      final AnnotatedType type = managedTypes.getRpcEndpoints().get(rpcIntf);
      final Class beanClass = type.getJavaClass();

      log.info("Register RPC Endpoint: " + type + "(" + rpcIntf + ")");

      // TODO: Copied from errai internals, refactor at some point
      createRPCScaffolding(rpcIntf, beanClass, bus, beanManager);
View Full Code Here

        it.inject(instance, cc);
    }

    public void destroy(Object instance) {
        if (instance != null) {
            AnnotatedType type = manager.createAnnotatedType(instance.getClass());
            InjectionTarget it = manager.createInjectionTarget(type);
            it.dispose(instance);
        }
    }
View Full Code Here

    }

    public <T> void defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator, ProcessInjectionTarget<T> injectionTargetEvent)
    {
        Class<?> clazz = injectionTargetEvent.getAnnotatedType().getJavaClass();
        AnnotatedType annotatedType = injectionTargetEvent.getAnnotatedType();

        if (webBeansContext.getInterceptorsManager().isInterceptorEnabled(clazz))
        {
            ManagedBean<T> component;

            webBeansContext.getInterceptorUtil().checkInterceptorConditions(annotatedType);
            component = defineManagedBean(managedBeanCreator, injectionTargetEvent, false);

            if (component != null)
            {
                Annotation[] anns = annotatedType.getAnnotations().toArray(new Annotation[annotatedType.getAnnotations().size()]);
                webBeansContext.getWebBeansInterceptorConfig().configureInterceptorClass(component,
                        webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(anns));
            }
            else
            {
View Full Code Here

TOP

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

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.