Package rocket.generator.rebind.method

Examples of rocket.generator.rebind.method.Method


    // locate the writeFields method that will be overridden.
    final List<Type> parameterTypes = new ArrayList<Type>();
    parameterTypes.add(context.getObject());
    parameterTypes.add(this.getObjectOutputStream());

    final Method method = writer
        .getMostDerivedMethod(SerializationConstants.CLIENT_OBJECT_WRITER_IMPL_WRITE0_METHOD, parameterTypes);
    final NewMethod newMethod = method.copy(writer);
    newMethod.setAbstract(false);

    // rename parameters to the same names used in templates...
    final List<MethodParameter> newMethodParameters = newMethod.getParameters();
    final NewMethodParameter object = (NewMethodParameter) newMethodParameters.get(0);
View Full Code Here


    context.branch();

    while (fields.hasNext()) {
      final Field field = (Field) fields.next();
      final Method getter = this.createFieldGetter(writer, field);
      body.addFieldGetter(getter);

      fieldCount++;
    }
View Full Code Here

    final GeneratorContext context = this.getGeneratorContext();
    context.branch();
    context.debug("Overriding \"" + SerializationConstants.SERIALIZATION_FACTORY_GET_OBJECT_READER
        + "\" to register needed ObjectReaders.");

    final Method method = serializationFactory.getMostDerivedMethod(SerializationConstants.SERIALIZATION_FACTORY_GET_OBJECT_READER,
        Collections.nCopies(1, context.getString()));
    final NewMethod newMethod = method.copy(serializationFactory);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);
    newMethod.setNative(true);

    final SwitchTemplatedFile body = new SwitchTemplatedFile();
View Full Code Here

    final GeneratorContext context = this.getGeneratorContext();
    context.branch();
    context.debug("Overriding \"" + SerializationConstants.SERIALIZATION_FACTORY_GET_OBJECT_WRITER
        + "\" to register needed ObjectWriters.");

    final Method method = serializationFactory.getMostDerivedMethod(SerializationConstants.SERIALIZATION_FACTORY_GET_OBJECT_WRITER,
        Collections.nCopies(1, context.getString()));
    final NewMethod newMethod = method.copy(serializationFactory);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);
    newMethod.setNative(true);

    final SwitchTemplatedFile body = new SwitchTemplatedFile();
View Full Code Here

   */
  public Method findMethod(final String methodName, final List<Type> parameterTypes) {
    GeneratorHelper.checkJavaMethodName("parameter:methodName", methodName);
    Checker.notNull("parameter:parameterTypes", parameterTypes);

    Method found = null;

    final Iterator<Method> methods = this.getMethods().iterator();

    while (methods.hasNext()) {
      final Method method = methods.next();
      if (false == method.getName().equals(methodName)) {
        continue;
      }

      final List<MethodParameter> methodParameters = method.getParameters();
      if (methodParameters.size() != parameterTypes.size()) {
        continue;
      }

      found = method;
View Full Code Here

    }
    return found;
  }

  public Method getMethod(final String methodName, final List<Type> parameterTypes) {
    final Method method = this.findMethod(methodName, parameterTypes);
    if (null == method) {
      this.throwMethodNotFoundException(methodName, parameterTypes);
    }
    return method;
  }
View Full Code Here

   *            name of the method to search for.
   * @param The
   *            parameter types to search for
   */
  public Method getMostDerivedMethod(final String methodName, final List<Type> parameterTypes) {
    final Method method = this.findMostDerivedMethod(methodName, parameterTypes);
    if (null == method) {
      this.throwMethodNotFoundException(methodName, parameterTypes);
    }
    return method;
  }
View Full Code Here

     */
    @Override
    protected boolean visit(final Type type) {
      Checker.notNull("parameter:type", type);

      final Method method = type.findMethod(this.getMethodName(), this.getParameterTypes());
      final boolean skipRemaining = method != null;
      if (skipRemaining) {
        this.setFound(method);
      }
      return skipRemaining;
View Full Code Here

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

    final Iterator<Method> methods = type.getMethods().iterator();
    while (methods.hasNext()) {
      final Method method = methods.next();
      if (this.visit(method)) {
        break;
      }
    }
  }
View Full Code Here

    final GeneratorContext context = this.getGeneratorContext();
    context.branch();
    context.info("Overriding " + Constants.FIND_LOGGER_METHOD);

    final List<Type> findLoggerMethodArguments = Collections.nCopies(1, context.getString());
    final Method method = loggerFactory.findMostDerivedMethod(Constants.FIND_LOGGER_METHOD, findLoggerMethodArguments);

    final NewMethod newMethod = method.copy(loggerFactory);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);
    newMethod.setNative(false);

    final FindLoggerTemplatedFile template = new FindLoggerTemplatedFile();
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.method.Method

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.