Package ch.softappeal.yass.core.remote

Examples of ch.softappeal.yass.core.remote.MethodMapper$Mapping


  private void generateInterface(final Class<?> type) {
    checkType(type);
    final Method[] methods = getMethods(type);
    tabs("%s = {", jsType(type));
    inc();
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    boolean firstMethod = true;
    for (final Method method : methods) {
      if (firstMethod) {
        firstMethod = false;
      } else {
        print(",");
      }
      println();
      tabs("%s: function (", method.getName());
      int param = 0; // $todo: use Parameter.getName() in Java 8
      for (final Class<?> paramType : method.getParameterTypes()) {
        if (param != 0) {
          print(", ");
        }
        print("param%s", param++);
      }
      print(") {}");
      if (methodMapper.mapMethod(method).oneWay) {
        print(" // OneWay");
      }
    }
    println();
    dec();
    tabsln("};");
    println();
    tabs("%s_MAPPER = yass.methodMapper(", jsType(type));
    inc();
    boolean first = true;
    for (final Method method : getMethods(type)) {
      if (!first) {
        print(",");
      }
      first = false;
      println();
      final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
      tabs("yass.methodMapping(\"%s\", %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
    }
    println();
    dec();
    tabsln(");");
View Full Code Here


  }

  private void generateInterface(final Class<?> type) {
    checkType(type);
    final Method[] methods = getMethods(type);
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    generateType(type, new TypeGenerator() {
      void generateInterface(final String name, final boolean proxy) {
        tabsln("export interface %s {", name + (proxy ? "_PROXY" : ""));
        inc();
        for (final Method method : methods) {
          tabs("%s(", method.getName());
          boolean first = true;
          for (final Parameter parameter : method.getParameters()) {
            if (!first) {
              print(", ");
            }
            first = false;
            print("%s: %s", parameter.getName(), type(parameter.getParameterizedType()));
          }
          print("): ");
          if (methodMapper.mapMethod(method).oneWay) {
            print("void");
          } else {
            final String type = type(method.getGenericReturnType());
            if (proxy) {
              print("yass.Promise<%s>", type);
            } else {
              print(type);
            }
          }
          println(";");
        }
        dec();
        tabsln("}");
      }
      @Override public void generateType(final String name) {
        generateInterface(name, false);
        generateInterface(name, true);
        tabs("export var %s_MAPPER = new yass.MethodMapper<%s>(", name, name);
        inc();
        boolean first = true;
        for (final Method method : methods) {
          if (!first) {
            print(",");
          }
          first = false;
          println();
          final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
          tabs("new yass.MethodMapping('%s', %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
        }
        println();
        dec();
        tabsln(");");
View Full Code Here

  }

  private void generateInterface(final Class<?> type) {
    checkType(type);
    final Method[] methods = getMethods(type);
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    generateType(type, new TypeGenerator() {
      void generateInterface(final String name, final boolean proxy) {
        tabsln("export interface %s {", name + (proxy ? "_PROXY" : ""));
        inc();
        for (final Method method : methods) {
          tabs("%s(", method.getName());
          boolean first = true;
          for (final Parameter parameter : method.getParameters()) {
            if (!first) {
              print(", ");
            }
            first = false;
            print("%s: %s", parameter.getName(), type(parameter.getParameterizedType()));
          }
          print("): ");
          if (methodMapper.mapMethod(method).oneWay) {
            print("void");
          } else {
            final String type = type(method.getGenericReturnType());
            if (proxy) {
              print("yass.Promise<%s>", type);
            } else {
              print(type);
            }
          }
          println(";");
        }
        dec();
        tabsln("}");
      }
      @Override public void generateType(final String name) {
        generateInterface(name, false);
        generateInterface(name, true);
        tabs("export var %s_MAPPER = new yass.MethodMapper<%s>(", name, name);
        inc();
        boolean first = true;
        for (final Method method : methods) {
          if (!first) {
            print(",");
          }
          first = false;
          println();
          final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
          tabs("new yass.MethodMapping('%s', %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
        }
        println();
        dec();
        tabsln(");");
View Full Code Here

  }

  private void generateInterface(final Class<?> type) {
    checkType(type);
    final Method[] methods = getMethods(type);
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    generateType(type, new TypeGenerator() {
      void generateInterface(final String name, final boolean proxy) {
        tabsln("export interface %s {", name + (proxy ? "_PROXY" : ""));
        inc();
        for (final Method method : methods) {
          tabs("%s(", method.getName());
          boolean first = true;
          for (final Parameter parameter : method.getParameters()) {
            if (!first) {
              print(", ");
            }
            first = false;
            print("%s: %s", parameter.getName(), type(parameter.getParameterizedType()));
          }
          print("): ");
          if (methodMapper.mapMethod(method).oneWay) {
            print("void");
          } else {
            final String type = type(method.getGenericReturnType());
            if (proxy) {
              print("yass.Promise<%s>", type);
            } else {
              print(type);
            }
          }
          println(";");
        }
        dec();
        tabsln("}");
      }
      @Override public void generateType(final String name) {
        generateInterface(name, false);
        generateInterface(name, true);
        tabs("export var %s_MAPPER = new yass.MethodMapper<%s>(", name, name);
        inc();
        boolean first = true;
        for (final Method method : methods) {
          if (!first) {
            print(",");
          }
          first = false;
          println();
          final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
          tabs("new yass.MethodMapping('%s', %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
        }
        println();
        dec();
        tabsln(");");
View Full Code Here

  }

  private void generateInterface(final Class<?> type) {
    checkType(type);
    final Method[] methods = getMethods(type);
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    generateType(type, new TypeGenerator() {
      void generateInterface(final String name, final boolean proxy) {
        tabsln("export interface %s {", name + (proxy ? "_PROXY" : ""));
        inc();
        for (final Method method : methods) {
          tabs("%s(", method.getName());
          boolean first = true;
          for (final Parameter parameter : method.getParameters()) {
            if (!first) {
              print(", ");
            }
            first = false;
            print("%s: %s", parameter.getName(), type(parameter.getParameterizedType()));
          }
          print("): ");
          if (methodMapper.mapMethod(method).oneWay) {
            print("void");
          } else {
            final String type = type(method.getGenericReturnType());
            if (proxy) {
              print("yass.Promise<%s>", type);
            } else {
              print(type);
            }
          }
          println(";");
        }
        dec();
        tabsln("}");
      }
      @Override public void generateType(final String name) {
        generateInterface(name, false);
        generateInterface(name, true);
        tabs("export var %s_MAPPER = new yass.MethodMapper<%s>(", name, name);
        inc();
        boolean first = true;
        for (final Method method : methods) {
          if (!first) {
            print(",");
          }
          first = false;
          println();
          final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
          tabs("new yass.MethodMapping('%s', %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
        }
        println();
        dec();
        tabsln(");");
View Full Code Here

  }

  private void generateInterface(final Class<?> type) {
    checkType(type);
    final Method[] methods = getMethods(type);
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    generateType(type, new TypeGenerator() {
      void generateInterface(final String name, final boolean proxy) {
        tabsln("export interface %s {", name + (proxy ? "_PROXY" : ""));
        inc();
        for (final Method method : methods) {
          tabs("%s(", method.getName());
          boolean first = true;
          for (final Parameter parameter : method.getParameters()) {
            if (!first) {
              print(", ");
            }
            first = false;
            print("%s: %s", parameter.getName(), type(parameter.getParameterizedType()));
          }
          print("): ");
          if (methodMapper.mapMethod(method).oneWay) {
            print("void");
          } else {
            final String type = type(method.getGenericReturnType());
            if (proxy) {
              print("yass.Promise<%s>", type);
            } else {
              print(type);
            }
          }
          println(";");
        }
        dec();
        tabsln("}");
      }
      @Override public void generateType(final String name) {
        generateInterface(name, false);
        generateInterface(name, true);
        tabs("export var %s_MAPPER = new yass.MethodMapper<%s>(", name, name);
        inc();
        boolean first = true;
        for (final Method method : methods) {
          if (!first) {
            print(",");
          }
          first = false;
          println();
          final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
          tabs("new yass.MethodMapping('%s', %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
        }
        println();
        dec();
        tabsln(");");
View Full Code Here

  }

  private void generateInterface(final Class<?> type) {
    checkType(type);
    final Method[] methods = getMethods(type);
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    generateType(type, new TypeGenerator() {
      void generateInterface(final String name, final boolean proxy) {
        tabsln("export interface %s {", name + (proxy ? "_PROXY" : ""));
        inc();
        for (final Method method : methods) {
          tabs("%s(", method.getName());
          int param = 0; // $todo: use Parameter.getName() in Java 8
          for (final Type paramType : method.getGenericParameterTypes()) {
            if (param != 0) {
              print(", ");
            }
            print("param%s: %s", param++, type(paramType));
          }
          print("): ");
          if (methodMapper.mapMethod(method).oneWay) {
            print("void");
          } else {
            final String type = type(method.getGenericReturnType());
            if (proxy) {
              print("yass.Promise<%s>", type);
            } else {
              print(type);
            }
          }
          println(";");
        }
        dec();
        tabsln("}");
      }
      @Override public void generateType(final String name) {
        generateInterface(name, false);
        generateInterface(name, true);
        tabs("export var %s_MAPPER = new yass.MethodMapper<%s>(", name, name);
        inc();
        boolean first = true;
        for (final Method method : methods) {
          if (!first) {
            print(",");
          }
          first = false;
          println();
          final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
          tabs("new yass.MethodMapping('%s', %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
        }
        println();
        dec();
        tabsln(");");
View Full Code Here

    return methods;
  }

  private void generateInterface(final Class<?> type) {
    checkType(type);
    final MethodMapper methodMapper = methodMapperFactory.create(type);
    tabs("%s = yass.methodMapper(", jsType(type));
    inc();
    boolean first = true;
    for (final Method method : getMethods(type)) {
      if (!first) {
        print(",");
      }
      first = false;
      println();
      final MethodMapper.Mapping mapping = methodMapper.mapMethod(method);
      tabs("yass.methodMapping(\"%s\", %s, %s)", mapping.method.getName(), mapping.id, mapping.oneWay);
    }
    println();
    dec();
    tabsln(");");
View Full Code Here

TOP

Related Classes of ch.softappeal.yass.core.remote.MethodMapper$Mapping

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.