Examples of AnnotatedTypeBuilder


Examples of org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder

        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());
        }
    }
View Full Code Here

Examples of org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder

 
  @SuppressWarnings("rawtypes")
  private void register(Class<?> component) {     
    try{
      if(ComponentFactory.class.isAssignableFrom(component)){     
        AnnotatedTypeBuilder builder = new ComponentFactoryAnnotatedTypeBuilderCreator().create(component);
        discovery.addAnnotatedType(builder.create());
      }
      else{
        discovery.addAnnotatedType(bm.createAnnotatedType(component));
      }
    }
View Full Code Here

Examples of org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder

  public ComponentFactoryAnnotatedTypeBuilderCreator(AnnotatedTypeBuilder builder) {
    this.builder = builder;
  }
 
  public ComponentFactoryAnnotatedTypeBuilderCreator(){
    this(new AnnotatedTypeBuilder());
  }
View Full Code Here

Examples of org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder

public class ModifyComponentExtension implements Extension {

  @SuppressWarnings("unchecked")
  public void processAnnotatedType(@Observes final ProcessAnnotatedType pat) {
    if(accept(pat)){
      AnnotatedTypeBuilder builder = new AnnotatedTypeBuilder();   
      builder.readFromType(pat.getAnnotatedType());
      AddInjectToConstructorExtension addInjectToConstructorExtension = new AddInjectToConstructorExtension(builder);
      ComponentExtension componentExtension = new ComponentExtension(builder);
      ComponentFactoryExtension componentFactoryExtension = new ComponentFactoryExtension(builder);
      addInjectToConstructorExtension.processAnnotatedType(pat);
      componentExtension.processAnnotatedType(pat);
      componentFactoryExtension.addProducesToComponentFactory(pat);
      pat.setAnnotatedType(builder.create());
    }
  }
View Full Code Here

Examples of org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder

     */
    protected void contextAwareness(@Observes ProcessAnnotatedType<? extends CamelContextAware> process) throws Exception {
        AnnotatedType at = process.getAnnotatedType();

        Method method = at.getJavaClass().getMethod("setCamelContext", CamelContext.class);
        AnnotatedTypeBuilder builder = new AnnotatedTypeBuilder<CamelContextAware>()
                .readFromType(at)
                .addToMethod(method, new InjectLiteral());
        process.setAnnotatedType(builder.create());

    }
View Full Code Here

Examples of org.jboss.seam.solder.reflection.annotated.AnnotatedTypeBuilder

        final Class<? extends Annotation> cdiScope = getCdiScopeFor(jsfScope);

        AnnotationInstanceProvider provider = new AnnotationInstanceProvider();
        final Annotation cdiScopeAnnotation = provider.get(cdiScope, Collections.EMPTY_MAP);

        AnnotatedTypeBuilder builder;
        builder = new AnnotatedTypeBuilder()
                .readFromType(type)
                .removeFromClass(jsfScope)
                .addToClass(cdiScopeAnnotation);
        return builder.create();
    }
View Full Code Here

Examples of org.jboss.seam.solder.reflection.annotated.AnnotatedTypeBuilder

         // producer fields
         if (field.isAnnotationPresent(ExtensionManaged.class) && (field.isAnnotationPresent(PersistenceUnit.class) || field.isAnnotationPresent(Resource.class)) && field.isAnnotationPresent(Produces.class) && EntityManagerFactory.class.isAssignableFrom(field.getJavaMember().getType()))
         {
            if (modifiedType == null)
            {
               modifiedType = new AnnotatedTypeBuilder().readFromType(event.getAnnotatedType());
            }
            Set<Annotation> qualifiers = new HashSet<Annotation>();
            Class<? extends Annotation> scope = Dependent.class;
            // get the qualifier and scope for the new bean
            for (Annotation annotation : field.getAnnotations())
            {
               if (manager.isQualifier(annotation.annotationType()))
               {
                  qualifiers.add(annotation);
               }
               else if (manager.isScope(annotation.annotationType()))
               {
                  scope = annotation.annotationType();
               }
            }
            if (qualifiers.isEmpty())
            {
               qualifiers.add(new DefaultLiteral());
            }
            qualifiers.add(AnyLiteral.INSTANCE);
            // we need to remove the scope, they are not nessesarily supported
            // on producer fields
            if (scope != Dependent.class)
            {
               modifiedType.removeFromField(field.getJavaMember(), scope);
            }
            if (bootstrapped)
            {
               modifiedType.removeFromField(field.getJavaMember(), Produces.class);
            }
            registerManagedPersistenceContext(qualifiers, scope, field.isAnnotationPresent(Alternative.class), manager, event.getAnnotatedType().getJavaClass().getClassLoader(), field, event.getAnnotatedType().getJavaClass());
            log.info("Configuring Seam Managed Persistence Context from producer field " + event.getAnnotatedType().getJavaClass().getName() + "." + field.getJavaMember().getName() + " with qualifiers " + qualifiers);
         }
         // now look for producer methods that produce an EntityManagerFactory.
         // This allows the user to manually configure an EntityManagerFactory
         // and return it from a producer method
      }
      // now look for SMPC's that are configured programatically via a producer
      // method. This looks for both EMF's and SessionFactories
      // The producer method has its scope changes to application scoped
      // this allows for programatic config of the SMPC
      for (AnnotatedMethod<? super T> method : event.getAnnotatedType().getMethods())
      {
         if (method.isAnnotationPresent(ExtensionManaged.class) && method.isAnnotationPresent(Produces.class) && EntityManagerFactory.class.isAssignableFrom(method.getJavaMember().getReturnType()))
         {
            if (modifiedType == null)
            {
               modifiedType = new AnnotatedTypeBuilder().readFromType(event.getAnnotatedType());
            }
            Set<Annotation> qualifiers = new HashSet<Annotation>();
            Class<? extends Annotation> scope = Dependent.class;
            // get the qualifier and scope for the new bean
            for (Annotation annotation : method.getAnnotations())
View Full Code Here

Examples of org.jboss.seam.solder.reflection.annotated.AnnotatedTypeBuilder

      {
         additionalInterfaces.addAll(i.getAdditionalEntityManagerInterfaces());
      }
      // create the new bean to be registered later
      ManagedPersistenceContextBeanLifecycle lifecycle = new ManagedPersistenceContextBeanLifecycle(qualifiers, loader, manager, additionalInterfaces, persistenceProviders);
      AnnotatedTypeBuilder<EntityManager> typeBuilder = new AnnotatedTypeBuilder().setJavaClass(EntityManager.class);
      BeanBuilder<EntityManager> builder = new BeanBuilder<EntityManager>(manager).readFromType(typeBuilder.create());
      builder.qualifiers(qualifiers);
      builder.scope(scope);
      builder.beanClass(member.getDeclaringType().getJavaClass());
      builder.getTypes().add(ManagedPersistenceContext.class);
View Full Code Here

Examples of org.jboss.seam.solder.reflection.annotated.AnnotatedTypeBuilder

         }
         else
         {
            // it is ok for this code to run twice, so we don't really need to
            // lock
            AnnotatedTypeBuilder<?> builder = new AnnotatedTypeBuilder().readFromType(entity.getClass());
            InjectionTarget<?> injectionTarget = getBeanManager().createInjectionTarget(builder.create());
            injectionTargets.put(entity.getClass(), injectionTarget);
            log.infov("Enabling injection into entity {}", entity.getClass());
         }
      }
View Full Code Here

Examples of org.jboss.seam.solder.reflection.annotated.AnnotatedTypeBuilder

      {
         if (method.isAnnotationPresent(ExtensionManaged.class) && method.isAnnotationPresent(Produces.class) && SessionFactory.class.isAssignableFrom(method.getJavaMember().getReturnType()))
         {
            if (modifiedType == null)
            {
               modifiedType = new AnnotatedTypeBuilder().readFromType(event.getAnnotatedType());
            }
            Set<Annotation> qualifiers = new HashSet<Annotation>();
            Class<? extends Annotation> scope = Dependent.class;
            // get the qualifier and scope for the new bean
            for (Annotation annotation : method.getAnnotations())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.