Package br.com.caelum.vraptor.ioc

Examples of br.com.caelum.vraptor.ioc.ComponentFactoryIntrospector


            if (type.isAnnotationPresent(ApplicationScoped.class) && initialized) {
                if (initialized) {
                    logger.warn("VRaptor was already initialized, the contexts were created but you are registering a component."
                            + "This is nasty. The original component might already be in use."
                            + "Avoid doing it: " + requiredType.getName());
                    Class<?> targetType = new ComponentFactoryIntrospector().targetTypeForComponentFactory(type);
                    this.appContainer.addAdapter(new PicoComponentAdapter(targetType, (Class<? extends ComponentFactory<?>>) type));
                }
            }
        }
    }
View Full Code Here


                + "This is nasty. The original component might already be in use."
                + "Avoid doing it: " + requiredType.getName());
        this.appContainer.addComponent(requiredType, type);

        if (isComponentFactory(requiredType, type)) {
          Class<?> targetType = new ComponentFactoryIntrospector().targetTypeForComponentFactory(type);
          this.appContainer.addAdapter(new PicoComponentAdapter(targetType, (Class<? extends ComponentFactory<?>>) type));
        }
    }
  }
View Full Code Here

    return binder.bind(requiredType).toConstructor(constructor);
  }

  private void registerFactory(Class componentType) {
    if (ComponentFactory.class.isAssignableFrom(componentType)) {
      final Class<?> target = new ComponentFactoryIntrospector().targetTypeForComponentFactory(componentType);
      Type adapterType = Types.newParameterizedType(ComponentFactoryProviderAdapter.class, target);
      Type factoryType = Types.newParameterizedType(ComponentFactory.class, target);
//      binder.bind(TypeLiteral.get(adapterType));
      binder.bind(TypeLiteral.get(factoryType)).to(componentType);
      binder.bind(target).toProvider((TypeLiteral) TypeLiteral.get(adapterType));
View Full Code Here

            if (type.isAnnotationPresent(ApplicationScoped.class) && initialized) {
                if (initialized) {
                    logger.warn("VRaptor was already initialized, the contexts were created but you are registering a component."
                            + "This is nasty. The original component might already be in use."
                            + "Avoid doing it: " + requiredType.getName());
                    Class<?> targetType = new ComponentFactoryIntrospector().targetTypeForComponentFactory(type);
                    this.appContainer.addAdapter(new PicoComponentAdapter(targetType, (Class<? extends ComponentFactory<?>>) type));
                }
            }
        }
    }
View Full Code Here

                + "This is nasty. The original component might already be in use."
                + "Avoid doing it: " + requiredType.getName());
        this.appContainer.addComponent(requiredType, type);

        if (isComponentFactory(requiredType, type)) {
          Class<?> targetType = new ComponentFactoryIntrospector().targetTypeForComponentFactory(type);
          this.appContainer.addAdapter(new PicoComponentAdapter(targetType, (Class<? extends ComponentFactory<?>>) type));
        }
    }
  }
View Full Code Here

    return Iterables.getFirst(filteredConstructor, constructors[0]);
  }

  private void registerFactory(Class componentType) {
    if (ComponentFactory.class.isAssignableFrom(componentType)) {
      final Class<?> target = new ComponentFactoryIntrospector().targetTypeForComponentFactory(componentType);
      Type adapterType = Types.newParameterizedType(ComponentFactoryProviderAdapter.class, target);
      Type factoryType = Types.newParameterizedType(ComponentFactory.class, target);
//      binder.bind(TypeLiteral.get(adapterType));
      binder.bind(TypeLiteral.get(factoryType)).to(componentType);
      binder.bind(target).toProvider((TypeLiteral) TypeLiteral.get(adapterType));
View Full Code Here

    return Iterables.getFirst(filteredConstructor, constructors[0]);
  }

  private void registerFactory(Class componentType) {
    if (ComponentFactory.class.isAssignableFrom(componentType)) {
      final Class<?> target = new ComponentFactoryIntrospector().targetTypeForComponentFactory(componentType);
      Type adapterType = Types.newParameterizedType(ComponentFactoryProviderAdapter.class, target);
      Type factoryType = Types.newParameterizedType(ComponentFactory.class, target);
//      binder.bind(TypeLiteral.get(adapterType));
      binder.bind(TypeLiteral.get(factoryType)).to(componentType);
      binder.bind(target).toProvider((TypeLiteral) TypeLiteral.get(adapterType));
View Full Code Here

    return Iterables.getFirst(filteredConstructor, constructors[0]);
  }

  private void registerFactory(Class componentType) {
    if (ComponentFactory.class.isAssignableFrom(componentType)) {
      final Class<?> target = new ComponentFactoryIntrospector().targetTypeForComponentFactory(componentType);
      Type adapterType = Types.newParameterizedType(ComponentFactoryProviderAdapter.class, target);
      Type factoryType = Types.newParameterizedType(ComponentFactory.class, target);
//      binder.bind(TypeLiteral.get(adapterType));
      binder.bind(TypeLiteral.get(factoryType)).to(componentType);
      binder.bind(target).toProvider((TypeLiteral) TypeLiteral.get(adapterType));
View Full Code Here

  private Class<?> targetType;

  public ComponentFactoryBean(Container container, Class<T> factoryType) {
  this.container = container;
  this.factoryType = factoryType;
  this.targetType = new ComponentFactoryIntrospector().targetTypeForComponentFactory(factoryType);
  }
View Full Code Here

        + "This is nasty. The original component might already be in use."
        + "Avoid doing it: " + requiredType.getName());
      this.appContainer.addComponent(requiredType, type);

      if (isComponentFactory(requiredType, type)) {
        Class<?> targetType = new ComponentFactoryIntrospector().targetTypeForComponentFactory(type);
        this.appContainer.addAdapter(new PicoComponentAdapter(targetType, (Class<? extends ComponentFactory<?>>) type));
      }
    }
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.ioc.ComponentFactoryIntrospector

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.