Package rocket.generator.rebind.visitor

Examples of rocket.generator.rebind.visitor.TypeConstructorsVisitor


    context.branch();
    context.debug("Matching constructors.");

    final List<Constructor> matchingConstructors = new ArrayList<Constructor>();
    final TypeConstructorsVisitor visitor = new TypeConstructorsVisitor() {

      protected boolean visit(final Constructor constructor) {
        boolean match = false;

        // skip non public constructors
        if (constructor.getVisibility() == Visibility.PUBLIC) {
          final List<ConstructorParameter> constructorParameters = constructor.getParameters();

          // skip the given constructor with different numbers of
          // parameters.
          if (constructorParameters.size() == arguments.size()) {

            match = true;
            final Iterator<Value> valuesIterator = arguments.iterator();
            final Iterator<ConstructorParameter> parametersIterator = constructorParameters.iterator();

            while (valuesIterator.hasNext()) {
              final ConstructorParameter parameter = parametersIterator.next();
              final Value value0 = valuesIterator.next();
              if (false == value0.isCompatibleWith(parameter.getType())) {
                match = false;
              }
            }
          }
        }

        if (match) {
          matchingConstructors.add(constructor);
          context.debug("" + constructor);
        }
        return false;
      }
    };

    final Type beanType = bean.getType();
    visitor.start(beanType);

    if (matchingConstructors.size() == 0) {
      this.throwUnableToFindConstructor(bean);
    }
    if (matchingConstructors.size() > 1) {
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.visitor.TypeConstructorsVisitor

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.