Ejemplo n.º 1
0
    public String getReturnTypeName() {
      if ("stop".equals(node.getType())) {
        return null;
      }
      if (node.isFlowPart()) {
        return getCachedClassName(
            getFactoryName() + "." + StringUtil.getSimpleName(getClassName()));
      }

      String type = getMethodName();
      String className = getCachedClassName(getFactoryName() + "." + StringUtil.toFirstUpper(type));

      String nodeType = node.getType();
      if ("restructure".equals(nodeType)
          || "extend".equals(nodeType)
          || "project".equals(nodeType)
          || "checkpoint".equals(nodeType)) {
        OpePort port = node.getOutputPort();
        String modelClass = getCachedClassName(getModelClassName(port));
        return className + "<" + modelClass + ">";
      }
      if ("empty".equals(nodeType) || "confluent".equals(nodeType)) {
        String modelClass = findModelClass(node);
        modelClass = getCachedClassName(modelClass);
        return className + "<" + modelClass + ">";
      }

      return className;
    }
Ejemplo n.º 2
0
    public void appendArgsTo(StringBuilder sb) {
      List<String> args = new ArrayList<String>();
      for (OpePort port : node.getInputPorts()) {
        NodeElement cnode = port.getConnectedNode();
        GenNode gen = nodeMap.get(cnode);
        String varName = (gen != null) ? gen.getUseVariableName() : "null";
        args.add(varName);
      }
      for (Connection c : node.getIncomings()) {
        NodeElement cnode = c.getOpposite(node);
        GenNode gen = nodeMap.get(cnode);
        String varName = (gen != null) ? gen.getUseVariableName() : "null";
        args.add(varName);
      }
      for (OpeParameter param : node.getParameterList()) {
        args.add(getQualifiedValue(param.getClassName(), param.getValue()));
      }
      String nodeType = node.getType();
      if ("restructure".equals(nodeType)
          || "extend".equals(nodeType)
          || "project".equals(nodeType)) {
        OpePort port = node.getOutputPort();
        String modelClass = getModelClassName(port);
        args.add(getQualifiedValue("java.lang.Class", modelClass));
      } else if ("empty".equals(nodeType)) {
        String modelClass = findModelClass(node);
        args.add(getQualifiedValue("java.lang.Class", modelClass));
      }

      if ("confluent".equals(nodeType)) {
        switch (args.size()) {
          case 2:
          case 3:
          case 4:
            break;
          default:
            sb.append(getCachedClassName("java.util.Arrays"));
            sb.append(".asList(");
            StringUtil.mkString(sb, args);
            sb.append(")");
            return;
        }
      }
      StringUtil.mkString(sb, args);
    }