Package rocket.generator.rebind.method

Examples of rocket.generator.rebind.method.NewMethod


    final String methodName = ImageFactoryConstants.GET_PRELOAD_URLS;
    context.branch();
    context.info("Overriding " + methodName + " to preload.");

    final Method method = newType.findMostDerivedMethod(methodName, Collections.<Type>emptyList());
    final NewMethod newMethod = method.copy(newType);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);

    final CodeBlock commaSeparatedList = new CodeBlock() {
      public boolean isEmpty() {
        return false;
      }

      public void write(final SourceWriter writer) {
        writer.print("return ");

        final StringBuffer commaSeparated = new StringBuffer();

        final Iterator<String> i = preFetchUrls.iterator();
        while (i.hasNext()) {
          final String url = i.next();
          commaSeparated.append(url);
          if (i.hasNext()) {
            commaSeparated.append(',');
          }
        }

        new StringLiteral(commaSeparated.toString()).write(writer);
        writer.println(";");
      }
    };
    newMethod.setBody(commaSeparatedList);

    final Iterator<String> i = preFetchUrls.iterator();
    while (i.hasNext()) {
      final String url = i.next();
      context.debug(url);
View Full Code Here


    serviceInterface.setNestedName(Constants.RPC_SERVICE_INTERFACE);
    serviceInterface.setStatic(true);
    serviceInterface.setSuperType(this.getRemoteService());
    serviceInterface.setVisibility(Visibility.PUBLIC);

    final NewMethod newMethod = serviceInterface.newMethod();
    newMethod.setAbstract(true);
    newMethod.setFinal(false);
    newMethod.setName(Constants.PAYLOAD_DECLARATION_METHOD);
    newMethod.setNative(false);

    final Type payloadType = this.getPayloadType(newType.getSuperType());
    newMethod.setReturnType(payloadType);

    newMethod.setStatic(false);
    newMethod.setVisibility(Visibility.PUBLIC);

    context.debug(newMethod.toString());
    context.unbranch();

    return serviceInterface;
  }
View Full Code Here

    final NewNestedInterfaceType asyncServiceInterface = newType.newNestedInterfaceType();
    asyncServiceInterface.setNestedName(Constants.RPC_ASYNC_SERVICE_INTERFACE);
    asyncServiceInterface.setStatic(true);
    asyncServiceInterface.setVisibility(Visibility.PUBLIC);

    final NewMethod newMethod = asyncServiceInterface.newMethod();
    newMethod.setAbstract(true);
    newMethod.setFinal(false);
    newMethod.setName(Constants.PAYLOAD_DECLARATION_METHOD);
    newMethod.setNative(false);
    newMethod.setReturnType(context.getVoid());
    newMethod.setStatic(false);
    newMethod.setVisibility(Visibility.PUBLIC);

    final NewMethodParameter callback = newMethod.newParameter();
    callback.setFinal(true);
    callback.setName(Constants.ASYNC_CALLBACK_PARAMETER_NAME);
    callback.setType(this.getAsyncCallback());

    context.debug(newMethod.toString());
    context.unbranch();
  }
View Full Code Here

   *            The service interface recently created to trigger GWT to
   *            create a deserializer.
   */
  protected void implementCreateGwtRpcProxy(final NewConcreteType newType, final Type serviceInterface) {
    final Method method = newType.getMostDerivedMethod(Constants.CREATE_GWT_RPC_PROXY_METHOD, Collections.<Type>emptyList());
    final NewMethod newMethod = method.copy(newType);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);

    final GwtCreateTemplatedFile template = new GwtCreateTemplatedFile();
    template.setType(serviceInterface);
    newMethod.setBody(template);
  }
View Full Code Here

    final GeneratorContext context = this.getGeneratorContext();
    context.info("Implementing " + method);
    context.branch();

    final NewMethod newMethod = this.createCorrespondingAsyncServiceInterfaceMethod(method, asyncServiceInterface, client);

    final ServiceMethodInvokerTemplatedFile body = new ServiceMethodInvokerTemplatedFile();
    newMethod.setBody(body);
    body.setMethod(newMethod);
    body.setParameters(newMethod.getParameters());
    body.setServiceInterface(serviceInterface);

    final Type serializationFactoryComposer = this.createSerializationFactoryComposer(method, client, serviceInterface);
    body.setSerializationFactoryComposer(serializationFactoryComposer);
View Full Code Here

    final GeneratorContext context = this.getGeneratorContext();
    context.branch();
    context.info("Implementing " + method.getName());

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

    CodeBlock body = null;
    while (true) {
      final Type widgetType = method.getReturnType();

      if (widgetType.equals(this.getTextBox())) {
        body = buildTextBoxGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getTextArea())) {
        body = buildTextAreaGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getRadioButton())) {
        body = buildRadioButtonGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getCheckBox())) {
        body = buildCheckBoxGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getListBox())) {
        body = buildListBoxGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getLabel())) {
        body = buildLabelGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getButton())) {
        body = buildButtonGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getImage())) {
        body = buildImageGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getHyperlink())) {
        body = buildHyperlinkGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getHtml())) {
        body = buildHtmlGetterMethodBody(method);
        break;
      }
      if (widgetType.equals(this.getFormPanel())) {
        body = buildFormPanelGetterMethodBody(method);
        break;
      }

      this.throwUnsupportedWidgetType(method);
      break;
    }
    newMethod.setBody(body);

    context.unbranch();
  }
View Full Code Here

    serviceInterface.setNestedName(Constants.RPC_SERVICE_INTERFACE);
    serviceInterface.setStatic(true);
    serviceInterface.setSuperType(this.getRemoteService());
    serviceInterface.setVisibility(Visibility.PUBLIC);

    final NewMethod newMethod = serviceInterface.newMethod();
    newMethod.setAbstract(true);
    newMethod.setFinal(false);
    newMethod.setName(Constants.PAYLOAD_DECLARATION_METHOD);
    newMethod.setNative(false);

    final Type payloadType = this.getPayloadType(newType.getSuperType());
    newMethod.setReturnType(payloadType);

    newMethod.setStatic(false);
    newMethod.setVisibility(Visibility.PUBLIC);

    context.debug(newMethod.toString());
    context.unbranch();

    return serviceInterface;
  }
View Full Code Here

    final NewNestedInterfaceType asyncServiceInterface = newType.newNestedInterfaceType();
    asyncServiceInterface.setNestedName(Constants.RPC_ASYNC_SERVICE_INTERFACE);
    asyncServiceInterface.setStatic(true);
    asyncServiceInterface.setVisibility(Visibility.PUBLIC);

    final NewMethod newMethod = asyncServiceInterface.newMethod();
    newMethod.setAbstract(true);
    newMethod.setFinal(false);
    newMethod.setName(Constants.PAYLOAD_DECLARATION_METHOD);
    newMethod.setNative(false);
    newMethod.setReturnType(context.getVoid());
    newMethod.setStatic(false);
    newMethod.setVisibility(Visibility.PUBLIC);

    final NewMethodParameter callback = newMethod.newParameter();
    callback.setFinal(true);
    callback.setName(Constants.ASYNC_CALLBACK_PARAMETER_NAME);
    callback.setType(this.getAsyncCallback());

    context.unbranch();
View Full Code Here

   *            The service interface recently created to trigger GWT to
   *            create a deserializer.
   */
  protected void implementCreateGwtRpcProxy(final NewConcreteType newType, final Type serviceInterface) {
    final Method method = newType.getMostDerivedMethod(Constants.CREATE_GWT_RPC_PROXY_METHOD, Collections.<Type>emptyList());
    final NewMethod newMethod = method.copy(newType);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);

    final GwtCreateTemplatedFile template = new GwtCreateTemplatedFile();
    template.setType(serviceInterface);
    newMethod.setBody(template);
  }
View Full Code Here

TOP

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

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.