Package org.jboss.errai.codegen.meta

Examples of org.jboss.errai.codegen.meta.MetaConstructor


      if (constructorInjectionPoints.size() > 1) {
        throw new InjectionFailure("more than one constructor in "
                + type.getFullyQualifiedName() + " is marked as the injection point!");
      }

      final MetaConstructor constructor = constructorInjectionPoints.get(0);

      return new ConstructionStrategy() {
        @Override
        public void generateConstructor(ConstructionStatusCallback callback) {
          Statement[] parameterStatements
                  = resolveInjectionDependencies(constructor.getParameters(), ctx, constructor);

          if (injector.isSingleton() && injector.isCreated()) return;

          IOCProcessingContext processingContext = ctx.getProcessingContext();
View Full Code Here


    if (constructors.length == 0) {
      return null;
    }

    MetaParameter[] parmTypes;
    MetaConstructor bestCandidate = null;
    int bestScore = 0;
    int score;
    boolean retry = false;

    do {
View Full Code Here

      if (constructorInjectionPoints.size() > 1) {
        throw new InjectionFailure("more than one constructor in "
                + type.getFullyQualifiedName() + " is marked as the injection point!");
      }

      final MetaConstructor constructor = constructorInjectionPoints.get(0);

      return new ConstructionStrategy() {
        @Override
        public void generateConstructor(ConstructionStatusCallback callback) {
          Statement[] parameterStatements
                  = resolveInjectionDependencies(constructor.getParameters(), ctx, constructor);

          if (injector.isSingleton() && injector.isCreated()) return;

          IOCProcessingContext processingContext = ctx.getProcessingContext();
View Full Code Here

      if (constructorInjectionPoints.size() > 1) {
        throw new InjectionFailure("more than one constructor in "
            + type.getFullyQualifiedName() + " is marked as the injection point!");
      }

      final MetaConstructor constructor = constructorInjectionPoints.get(0);

      return new ConstructionStrategy() {
        @Override
        public void generateConstructor(final ConstructionStatusCallback callback) {
          final Statement[] parameterStatements
              = resolveInjectionDependencies(constructor.getParameters(), ctx, constructor);

          if (injector.isSingleton() && injector.isCreated()) return;

          final IOCProcessingContext processingContext = ctx.getProcessingContext();
View Full Code Here

      if (constructorInjectionPoints.size() > 1) {
        throw new InjectionFailure("more than one constructor in "
            + type.getFullyQualifiedName() + " is marked as the injection point!");
      }

      final MetaConstructor constructor = constructorInjectionPoints.get(0);

      return new ConstructionStrategy() {
        @Override
        public void generateConstructor(final ConstructionStatusCallback callback) {
          final Statement[] parameterStatements
              = resolveInjectionDependencies(constructor.getParameters(), ctx, constructor);

          if (injector.isSingleton() && injector.isCreated()) return;

          final IOCProcessingContext processingContext = ctx.getProcessingContext();
View Full Code Here

        return null;
      }

      @Override
      public Collection<MetaParameter> getInjectorConstructorParameters() {
        final MetaConstructor constructor = getInjectorConstructor();
        if (constructor != null) {
          return Arrays.asList(constructor.getParameters());
        }
        else {
          return Collections.emptyList();
        }
      }
View Full Code Here

    final BeanMetric beanMetric = analyzeBean(context, clazz);

    return new AbstractBeanMetric() {
      @Override
      public MetaConstructor getInjectorConstructor() {
        final MetaConstructor injectionConstructor = beanMetric.getInjectorConstructor();
        if (injectionConstructor != null) {
          if (!injectionConstructor.getParametersAnnotatedWith(annotatedWith).isEmpty()) {
            return injectionConstructor;
          }
        }
        return null;
      }

      @Override
      public Collection<MetaField> getFieldInjectors() {
        final List<MetaField> fieldList = new ArrayList<MetaField>();
        for (final MetaField metaField : beanMetric.getFieldInjectors()) {
          if (metaField.isAnnotationPresent(annotatedWith)) {
            fieldList.add(metaField);
          }
        }

        return fieldList;
      }

      @Override
      public Collection<MetaMethod> getMethodInjectors() {
        final List<MetaMethod> metaMethodList = new ArrayList<MetaMethod>();
        for (final MetaMethod metaMethod : beanMetric.getMethodInjectors()) {
          if (!metaMethod.getParametersAnnotatedWith(annotatedWith).isEmpty()) {
            metaMethodList.add(metaMethod);
          }
        }

        return metaMethodList;
      }

      @Override
      public Collection<MetaParameter> getInjectorConstructorParameters() {
        final MetaConstructor metaConstructor = getInjectorConstructor();
        if (metaConstructor != null) {
          return metaConstructor.getParametersAnnotatedWith(annotatedWith);
        }

        return Collections.emptyList();
      }
View Full Code Here

    @Override
    public Collection<Object> getAllInjectors() {
      final List<Object> allInjectors = new ArrayList<Object>(getFieldInjectors());
      allInjectors.addAll(getMethodInjectors());
      final MetaConstructor injectorConstructor = getInjectorConstructor();
      if (injectorConstructor != null) {
        allInjectors.add(injectorConstructor);
      }

      return allInjectors;
View Full Code Here

    return candidate;
  }

  protected static MetaConstructor _getConstructor(final MetaConstructor[] constructors, final MetaClass... parmTypes) {
    MetaConstructor candidate = null;
    int bestScore = 0;
    int score;

    for (final MetaConstructor constructor : constructors) {
      score = 0;
View Full Code Here

  @Override
  public boolean isDefaultInstantiable() {
    if (isInterface() || isAbstract()) {
      return false;
    }
    final MetaConstructor c = getConstructor(new MetaClass[0]);
    return c != null && c.isPublic();
  }
View Full Code Here

TOP

Related Classes of org.jboss.errai.codegen.meta.MetaConstructor

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.