Package rocket.generator.rebind.constructor

Examples of rocket.generator.rebind.constructor.Constructor


    if (matchingConstructors.size() > 1) {
      this.throwTooManyConstructors(bean, matchingConstructors);
    }
    context.unbranch();

    final Constructor constructor = (Constructor) matchingConstructors.get(0);
    body.setBean(constructor);

    final Iterator<ConstructorParameter> constructorParameters = constructor.getParameters().iterator();
    final Iterator<Value> valuesIterator = arguments.iterator();
    while (constructorParameters.hasNext()) {
      final ConstructorParameter constructorParameter = constructorParameters.next();
      final Value value = valuesIterator.next();
      value.setPropertyType(constructorParameter.getType());

      this.prepareValue(value);
    }

    if (context.isDebugEnabled()) {
      context.debug(constructor.toString());
    }
  }
View Full Code Here


    // add a new constructor...
    final MethodParameter targetBeanParameter = (MethodParameter) newMethod.getParameters().get(0);

    final Type proxy = bean.getProxy();
    final Constructor constructor = proxy.getConstructor(Collections.<Type>emptyList());

    final CreateProxyTemplatedFile body = new CreateProxyTemplatedFile();
    body.setProxyConstructor(constructor);
    body.setTargetBeanParameter(targetBeanParameter);
    body.setTargetBeanType(bean.getType());
View Full Code Here

    final Method method = reader.getMostDerivedMethod(SerializationConstants.CLIENT_OBJECT_READER_IMPL_NEW_INSTANCE_METHOD,
        parameters);
    final NewMethod newMethod = method.copy(reader);
    newMethod.setAbstract(false);

    final Constructor constructor = type.getConstructor(Collections.EMPTY_LIST);
    final NewInstanceTemplatedFile newInstanceStatement = new NewInstanceTemplatedFile();
    newInstanceStatement.setConstructor(constructor);

    final CodeBlock returnStatement = new CodeBlock() {
      public boolean isEmpty() {
View Full Code Here

    Checker.notNull("parameter:type", type);

    final NewField singleton = type.newField();

    final NewInstanceTemplatedFile body = new NewInstanceTemplatedFile();
    final Constructor constructor = type.getConstructor(Collections.<Type>emptyList());
    body.setConstructor(constructor);

    singleton.setValue(body);

    singleton.setFinal(true);
View Full Code Here

   * @return The matching constructor or null if none was found.
   */
  public Constructor findConstructor(final List<Type> parameterTypes) {
    Checker.notNull("parameter:parameterTypes", parameterTypes);

    Constructor found = null;

    final Iterator<Constructor> constructors = this.getConstructors().iterator();

    while (constructors.hasNext()) {
      final Constructor constructor = constructors.next();

      final List<ConstructorParameter> constructorParameters = constructor.getParameters();
      if (constructorParameters.size() != parameterTypes.size()) {
        continue;
      }

      found = constructor;
View Full Code Here

    }
    return found;
  }

  public Constructor getConstructor(final List<Type> parameterTypes) {
    Constructor constructor = this.findConstructor(parameterTypes);
    if (null == constructor) {
      this.throwConstructorNotFoundException(parameterTypes);
    }
    return constructor;
  }
View Full Code Here

  public void start(final Type type) {
    Checker.notNull("constructor:type", type);

    final Iterator<Constructor> constructors = type.getConstructors().iterator();
    while (constructors.hasNext()) {
      final Constructor constructor = constructors.next();
      if (this.visit(constructor)) {
        break;
      }
    }
  }
View Full Code Here

      final String loggerTypeName = config.getTypeName(name);
      final LoggingLevel loggingLevel = config.getLoggingLevel(name);

      context.debug(name + "=" + loggerTypeName + " (" + loggingLevel + ")");

      final Constructor loggingLevelLogger = this.getConstructorForLoggingLevel(loggingLevel);
      final Constructor logger = this.getTargetLoggerConstructor(loggerTypeName);

      template.register(name, loggingLevelLogger, logger);
    }

    // rename parameter to a known name which matches the variable named
View Full Code Here

      throwTargetLoggerIsAbstract(type);
    }

    // find a constructor with a string parameter.
    final List stringParameter = Collections.nCopies(1, context.getString());
    final Constructor constructor = type.getConstructor(stringParameter);
    if (constructor.getVisibility() != Visibility.PUBLIC) {
      throwTargetLoggerConstructorIsNotPublic(constructor);
    }

    context.debug("Found " + constructor);
    context.unbranch();
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.constructor.Constructor

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.