本文整理汇总了Java中org.eclipse.xtend2.lib.StringConcatenation.append方法的典型用法代码示例。如果您正苦于以下问题:Java StringConcatenation.append方法的具体用法?Java StringConcatenation.append怎么用?Java StringConcatenation.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtend2.lib.StringConcatenation
的用法示例。
在下文中一共展示了StringConcatenation.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compilarTexto
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarTexto(final Postre p) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _isHelado = p.isHelado();
if (_isHelado) {
_builder.append("Tipo de producto: Helado");
_builder.newLineIfNotEmpty();
} else {
_builder.append("Tipo de producto: Postre no helado");
_builder.newLineIfNotEmpty();
}
}
_builder.append("Distribuidor: ");
Distribuidor _distribuidor = p.getDistribuidor();
_builder.append(_distribuidor);
_builder.newLineIfNotEmpty();
_builder.append("Listado de ingredientes: ");
String _ingredientes = this.ingredientes(p.getIngredientes());
_builder.append(_ingredientes);
_builder.newLineIfNotEmpty();
return _builder;
}
示例2: generateInitialContents
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public void generateInitialContents(final IFileSystemAccess2 fsa) {
String _primaryFileExtension = this.fileExtensionProvider.getPrimaryFileExtension();
String _plus = ("src/model/Model." + _primaryFileExtension);
StringConcatenation _builder = new StringConcatenation();
_builder.append("Restaurantes \"Hola\" fecha 30-10-2016");
_builder.newLine();
_builder.newLine();
_builder.append("Ingredientes {");
_builder.newLine();
_builder.append("\t");
_builder.append("Ingrediente: COD1 \'moluscos\' infoURL: http://moluscos.com alergenico");
_builder.newLine();
_builder.append("}");
_builder.newLine();
fsa.generateFile(_plus, _builder);
}
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:17,代码来源:RestauranteNewProjectWizardInitialContents.java
示例3: testBasicForLoop_0
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testBasicForLoop_0() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("for (var i = 0; i < 10; i = i + 1) {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("for (int i = 0; (i < 10); i = (i + 1)) {");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.compilesTo(_builder, _builder_1);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例4: testUnassignedRule_01
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testUnassignedRule_01() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("First : Second name+=ID;");
_builder.newLine();
_builder.append("Second: name+=ID;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
示例5: testForLoop_03
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testForLoop_03() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("for(i: 1..2) { i.toString }");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("org.eclipse.xtext.xbase.lib.IntegerRange _upTo = new org.eclipse.xtext.xbase.lib.IntegerRange(1, 2);");
_builder_1.newLine();
_builder_1.append("for (final Integer i : _upTo) {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("i.toString();");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.compilesTo(_builder, _builder_1);
}
示例6: testBlockHasNoSuperfluousBraces_03
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testBlockHasNoSuperfluousBraces_03() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{ var (int)=>void fun = [ int i | new Object() new Object() ] }");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("final org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Integer> _function = (Integer i) -> {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("new Object();");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("new Object();");
_builder_1.newLine();
_builder_1.append("};");
_builder_1.newLine();
_builder_1.append("org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super Integer> fun = _function;");
_builder_1.newLine();
this.compilesTo(_builder, _builder_1, JavaVersion.JAVA8);
}
示例7: loadModel
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void loadModel() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Hello Xtext!");
_builder.newLine();
final Mensamodel result = this.parseHelper.parse(_builder);
Assert.assertNotNull(result);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例8: compilarIngredientes
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarIngredientes(final List<Ingrediente> ingredientes) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("var code = \'<table class=\"tingredientes\">\\");
_builder.newLine();
_builder.append("\t");
_builder.append("<tr class=\"tingredientes_cabecera\">\\");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<td></td>\\");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<td>Ingrediente</td>\\");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<td>Al�rgeno</td>\\");
_builder.newLine();
_builder.append("\t");
_builder.append("</tr>\\");
_builder.newLine();
{
for(final Ingrediente i : ingredientes) {
_builder.append("\t");
CharSequence _compilarTexto = this.compilarTexto(i);
_builder.append(_compilarTexto, "\t");
_builder.newLineIfNotEmpty();
}
}
_builder.append("</table>\';");
_builder.newLine();
return _builder;
}
示例9: compilarProductos
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarProductos(final List<Producto> productos) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("var code = \'");
{
for(final Producto p : productos) {
CharSequence _compilarTexto = this.compilarTexto(p);
_builder.append(_compilarTexto);
}
}
_builder.append("\';");
_builder.newLineIfNotEmpty();
return _builder;
}
示例10: compilarMenus
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarMenus(final List<Menu> menus) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("var code = \'");
{
for(final Menu m : menus) {
CharSequence _compilarTexto = this.compilarTexto(m);
_builder.append(_compilarTexto);
}
}
_builder.append("\';");
_builder.newLineIfNotEmpty();
return _builder;
}
示例11: informacionNutricional
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence informacionNutricional(final Nutricional n) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Por cada ");
String _cantidad = n.getCantidad();
_builder.append(_cantidad);
String _unidad = n.getUnidad();
_builder.append(_unidad);
_builder.append(" de producto se proporciona:");
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _energia = n.getEnergia();
_builder.append(_energia, "\t");
_builder.append("Kcal de energ�a, ");
String _grasas = n.getGrasas();
_builder.append(_grasas, "\t");
_builder.append("g de grasa, ");
String _hidratos = n.getHidratos();
_builder.append(_hidratos, "\t");
_builder.append("g de hidratos de carbono ");
String _proteinas = n.getProteinas();
_builder.append(_proteinas, "\t");
_builder.append("g de proteinas ");
String _sal = n.getSal();
_builder.append(_sal, "\t");
_builder.append("g de sal");
_builder.newLineIfNotEmpty();
return _builder;
}
示例12: formatSwitchSL1
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void formatSwitchSL1() {
final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
it_1.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
};
it.preferences(_function_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("switch \'x\' { case \'x\': println(\'x\') case \'y\': println(\'y\') }");
_builder.newLine();
it.setToBeFormatted(_builder);
};
this._xbaseFormatterTester.assertFormattedExpression(_function);
}
示例13: formatConstructorCallNoParenthesis
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void formatConstructorCallNoParenthesis() {
final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("val v1 = new ArrayList");
_builder.newLine();
_builder.append("val v2 = new ArrayList");
_builder.newLine();
it.setToBeFormatted(_builder);
};
this._xbaseFormatterTester.assertFormattedExpression(_function);
}
示例14: formatMemberFeatureCallBuilder1
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void formatMemberFeatureCallBuilder1() {
final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("newArrayList(\"x\").map()[]");
_builder.newLine();
it.setExpectation(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("newArrayList(\"x\") . map ( ) [ ]");
_builder_1.newLine();
it.setToBeFormatted(_builder_1);
};
this._xbaseFormatterTester.assertFormattedExpression(_function);
}
示例15: testBug367144_1
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testBug367144_1() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo::bar::SubOfClassWithStatics::MY_STATIC_METHOD");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("String _MY_STATIC_METHOD = foo.bar.SubOfClassWithStatics.MY_STATIC_METHOD();");
_builder_1.newLine();
_builder_1.append("return _MY_STATIC_METHOD;");
_builder_1.newLine();
this.compilesTo(_builder, _builder_1);
}