当前位置: 首页>>代码示例>>Java>>正文


Java LambdaExpressionTree.BodyKind方法代码示例

本文整理汇总了Java中com.sun.source.tree.LambdaExpressionTree.BodyKind方法的典型用法代码示例。如果您正苦于以下问题:Java LambdaExpressionTree.BodyKind方法的具体用法?Java LambdaExpressionTree.BodyKind怎么用?Java LambdaExpressionTree.BodyKind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.source.tree.LambdaExpressionTree的用法示例。


在下文中一共展示了LambdaExpressionTree.BodyKind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderBlock

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
/**
 * Renders a ruby block with curly brace syntax.
 */
private void renderBlock(LambdaExpressionTree.BodyKind bodyKind, List<TypeInfo> parameterTypes, List<String> parameterNames, CodeModel body, CodeWriter writer) {
  append("{");
  if (parameterNames.size() > 0) {
    append(" |");
    for (int i = 0; i < parameterNames.size(); i++) {
      if (i > 0) {
        append(",");
      }
      append(parameterNames.get(i));
    }
    append("|");
  }
  append("\n");
  indent();
  body.render(this);
  if (bodyKind == LambdaExpressionTree.BodyKind.EXPRESSION) {
    append("\n");
  }
  unindent();
  append("}");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:25,代码来源:RubyWriter.java

示例2: renderLambda

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderLambda(LambdaExpressionTree.BodyKind bodyKind, List<TypeInfo> parameterTypes, List<String> parameterNames, CodeModel body){
  append("(");
  IntStream.range(0, parameterNames.size()).forEach(i -> {
    if(i > 0) append(", ");
    append(parameterNames.get(i));
    append(": ");
    append(parameterTypes.get(i).translateName("scala"));
  });
  append(") => {\n");
  indent();
  body.render(this);
  if (bodyKind == LambdaExpressionTree.BodyKind.EXPRESSION) append("\n");
  unindent();
  append("}");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:17,代码来源:ScalaCodeWriter.java

示例3: renderLambda

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderLambda(LambdaExpressionTree.BodyKind bodyKind, List<TypeInfo> parameterTypes, List<String> parameterNames, CodeModel body) {
  append("{");
  for (int i = 0; i < parameterNames.size(); i++) {
    if (i == 0) {
      append(" ");
    } else {
      append(", ");
    }
    append(parameterNames.get(i));
  }
  append(" ->\n");
  indent();
  body.render(this);
  if (bodyKind == LambdaExpressionTree.BodyKind.EXPRESSION) {
    append("\n");
  }
  unindent();
  append("}");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:21,代码来源:GroovyWriter.java

示例4: renderLambda

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderLambda(LambdaExpressionTree.BodyKind bodyKind, List<TypeInfo> parameterTypes, List<String> parameterNames, CodeModel body) {
  append("function (");
  for (int i = 0; i < parameterNames.size(); i++) {
    if (i > 0) {
      append(", ");
    }
    append(parameterNames.get(i));
  }
  append(") {\n");
  indent();
  body.render(this);
  if (bodyKind == LambdaExpressionTree.BodyKind.EXPRESSION) {
    append(";\n");
  }
  unindent();
  append("}");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:19,代码来源:JavaScriptWriter.java

示例5: renderLambda

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderLambda(LambdaExpressionTree.BodyKind bodyKind, List<TypeInfo> parameterTypes, List<String> parameterNames, CodeModel body) {
  append("{");
  if (!parameterNames.isEmpty()) {
    for (int i = 0; i < parameterNames.size(); i++) {
      if (i == 0) {
        append(" ");
      } else {
        append(", ");
      }
      append(parameterNames.get(i));
    }
    append(" ->\n");
  } else {
    append("\n");
  }
  indent();
  body.render(this);
  if (bodyKind == LambdaExpressionTree.BodyKind.EXPRESSION) {
    append("\n");
  }
  unindent();
  append("}");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:25,代码来源:KotlinCodeWriter.java

示例6: renderLambda

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderLambda(LambdaExpressionTree.BodyKind bodyKind, List<TypeInfo> parameterTypes, List<String> parameterNames, CodeModel body) {
  append("(");
  for (int i = 0; i < parameterNames.size(); i++) {
    String decl = renderTypeDeclaration(parameterTypes.get(i));
    if (decl == null) {
      continue;
    }
    if (i > 0) {
      append(", ");
    }
    append(decl);
    append(" ").append(parameterNames.get(i));
  }
  append(") ");
  if (bodyKind == LambdaExpressionTree.BodyKind.EXPRESSION) {
    append("=> ");
  } else {
    append("{\n");
  }
  indent();
  body.render(this);
  unindent();
  if (bodyKind == LambdaExpressionTree.BodyKind.STATEMENT) {
    append("}");
  }
}
 
开发者ID:vert-x3,项目名称:vertx-lang-ceylon,代码行数:28,代码来源:CeylonWriter.java

示例7: asyncResultHandler

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public ExpressionModel asyncResultHandler(LambdaExpressionTree.BodyKind bodyKind, ParameterizedTypeInfo resultType, String resultName, CodeModel body, CodeModel succeededBody, CodeModel failedBody) {
  return new LambdaExpressionModel(
    this,
    bodyKind,
    Arrays.asList(TypeReflectionFactory.create(Throwable.class), resultType.getArgs().get(0)),
    Arrays.asList(resultName + "_err", resultName),
    body);
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:10,代码来源:RubyCodeBuilder.java

示例8: asyncResultHandler

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
  public ExpressionModel asyncResultHandler(LambdaExpressionTree.BodyKind bodyKind, ParameterizedTypeInfo parameterizedTypeInfo, String s, CodeModel codeModel, CodeModel codeModel1, CodeModel codeModel2) {
    imports.add("scala.util.Failure");
    imports.add("scala.util.Success");
    return new ExpressionModel(this) {
      public void render(CodeWriter writer) {
        asyncResults.add(s);
        writer.append("{\n");
        writer.indent();
        writer.append("case Success(result) => ");
        writer.indent();

        if (codeModel1 != null) {
          writer.append("{\n");
          codeModel1.render(writer);
          writer.unindent();
          writer.append("}\n");
        } else {
          writer.append("println(\"Success\")\n");
          writer.unindent();
        }

        writer.append("case Failure(cause) => ");
        writer.indent();
        if (codeModel2 != null) {
          writer.append("{\n");
          writer.append("println(s\"$cause\")");
//          codeModel2.render(writer)
          writer.unindent();
          writer.append("\n}\n");
        } else {
          writer.append("println(\"Failure\")\n");
          writer.unindent();
        }

        writer.unindent();
        writer.append("}");
      }
    };
  }
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:41,代码来源:ScalaCodeBuilder.java

示例9: renderMapForEach

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderMapForEach(ExpressionModel map, String keyName, TypeInfo keyType, String valueName, TypeInfo valueType, LambdaExpressionTree.BodyKind bodyKind, CodeModel block){
  map.render(this);
  append(".foreach{\n");
  indent();
  append("case ");
  unindent();
  renderLambda(bodyKind, Arrays.asList(keyType, valueType), Arrays.asList(keyName, valueName), block);
  append("}");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:11,代码来源:ScalaCodeWriter.java

示例10: renderMapForEach

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderMapForEach(ExpressionModel map, String keyName, TypeInfo keyType, String valueName, TypeInfo valueType, LambdaExpressionTree.BodyKind bodyKind, CodeModel block) {
  map.render(this);
  append(".forEach(");
  renderLambda(bodyKind, Arrays.asList(valueType, keyType), Arrays.asList(valueName, keyName), block);
  append(")");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:8,代码来源:JavaScriptWriter.java

示例11: renderMapForEach

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderMapForEach(ExpressionModel map, String keyName, TypeInfo keyType, String valueName, TypeInfo valueType, LambdaExpressionTree.BodyKind bodyKind, CodeModel block) {
  append("for ((").append(keyName).append(", ").append(valueName).append(") in ");
  map.render(this);
  append(") {\n");
  indent();

  block.render(this);
  if (bodyKind == LambdaExpressionTree.BodyKind.EXPRESSION) {
    append("\n");
  }

  unindent();
  append("}\n");
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:16,代码来源:KotlinCodeWriter.java

示例12: LambdaExpressionModel

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
public LambdaExpressionModel(CodeBuilder builder, LambdaExpressionTree.BodyKind bodyKind, List<TypeInfo> parameterTypes, List<String> parameterNames, CodeModel body) {
  super(builder);
  this.bodyKind = bodyKind;
  this.parameterTypes = parameterTypes;
  this.parameterNames = parameterNames;
  this.body = body;
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:8,代码来源:LambdaExpressionModel.java

示例13: asyncResultHandler

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public ExpressionModel asyncResultHandler(LambdaExpressionTree.BodyKind bodyKind, ParameterizedTypeInfo resultType, String resultName, CodeModel body, CodeModel succeededBody, CodeModel failedBody) {
  return new LambdaExpressionModel(this, bodyKind, Collections.singletonList(resultType), Collections.singletonList(resultName), body);
}
 
开发者ID:vert-x3,项目名称:vertx-lang-ceylon,代码行数:5,代码来源:CeylonCodeBuilder.java

示例14: renderMapForEach

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
@Override
public void renderMapForEach(ExpressionModel map, String keyName, TypeInfo keyType, String valueName, TypeInfo valueType, LambdaExpressionTree.BodyKind bodyKind, CodeModel block) {
  append("renderMapForEach");
}
 
开发者ID:vert-x3,项目名称:vertx-lang-ceylon,代码行数:5,代码来源:CeylonWriter.java

示例15: renderMapForEach

import com.sun.source.tree.LambdaExpressionTree; //导入方法依赖的package包/类
public abstract void renderMapForEach(ExpressionModel map,
String keyName, TypeInfo keyType,
String valueName, TypeInfo valueType,
LambdaExpressionTree.BodyKind bodyKind, CodeModel block);
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:5,代码来源:CodeWriter.java


注:本文中的com.sun.source.tree.LambdaExpressionTree.BodyKind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。