本文整理汇总了Java中org.eclipse.xtend2.lib.StringConcatenation类的典型用法代码示例。如果您正苦于以下问题:Java StringConcatenation类的具体用法?Java StringConcatenation怎么用?Java StringConcatenation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringConcatenation类属于org.eclipse.xtend2.lib包,在下文中一共展示了StringConcatenation类的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: _ebnf2
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
protected String _ebnf2(final Alternatives it, final AntlrOptions options, final boolean supportActions) {
StringConcatenation _builder = new StringConcatenation();
{
EList<AbstractElement> _elements = it.getElements();
boolean _hasElements = false;
for(final AbstractElement element : _elements) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate("\n |", "");
}
String _ebnf = this.ebnf(element, options, supportActions);
_builder.append(_ebnf);
}
}
_builder.newLineIfNotEmpty();
return _builder.toString();
}
示例4: testMultiInheritance_02
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void testMultiInheritance_02() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test with org.eclipse.xtext.enumrules.EnumRulesTestLanguage");
_builder.newLine();
_builder.append("import \'http://www.eclipse.org/xtext/common/JavaVMTypes\' as types");
_builder.newLine();
_builder.append("generate myDsl \"http://example.xtext.org/MyDsl\" as mydsl");
_builder.newLine();
_builder.append("Array returns mydsl::Array: componentType=DeclaredType componentType=ComponentType;");
_builder.newLine();
_builder.append("DeclaredType returns types::JvmDeclaredType: members+=DeclaredType;");
_builder.newLine();
_builder.append("ComponentType returns types::JvmComponentType: \'ignore\';");
_builder.newLine();
final String grammarAsString = _builder.toString();
final XtextResource resource = this.getResourceFromString(grammarAsString);
EObject _head = IterableExtensions.<EObject>head(resource.getContents());
final Grammar grammar = ((Grammar) _head);
EClassifier _classifier = IterableExtensions.<AbstractRule>head(grammar.getRules()).getType().getClassifier();
EClass array = ((EClass) _classifier);
Assert.assertEquals("JvmComponentType", this.<EStructuralFeature>feature(array, "componentType").getEType().getName());
}
示例5: getEquivalent
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
public String getEquivalent(final ParameterizedTypeReference type) {
boolean _isEmpty = type.getTypeArguments().isEmpty();
if (_isEmpty) {
return type.getType().getSimpleName();
}
StringConcatenation _builder = new StringConcatenation();
String _simpleName = type.getType().getSimpleName();
_builder.append(_simpleName);
_builder.append("<");
final Function1<LightweightTypeReference, CharSequence> _function = (LightweightTypeReference it) -> {
return it.getSimpleName();
};
String _join = IterableExtensions.<LightweightTypeReference>join(type.getTypeArguments(), ", ", _function);
_builder.append(_join);
_builder.append(">");
return _builder.toString();
}
示例6: mLCommentIgnoring01b
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void mLCommentIgnoring01b() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("A: \'A\'");
_builder.newLine();
_builder.newLine();
_builder.append("B: \'B\'");
_builder.newLine();
final String testee = _builder.toString();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("A: \'A\'");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("/*");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("* rule B");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("*/");
_builder_1.newLine();
_builder_1.append("B: \'B\'");
_builder_1.newLine();
final String expected = _builder_1.toString();
this._antlrGrammarComparatorTestHelper.compare(testee, expected);
}
示例7: testSimpleFullBuild
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void testSimpleFullBuild() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity B {}");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A { foo.B myReference }");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus(
"src/MyFile.indextestlanguage", _builder.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
};
final BuildRequest buildRequest = this.newBuildRequest(_function);
this.build(buildRequest);
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
Assert.assertEquals(2, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
}
示例8: testBug_287550_01
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void testBug_287550_01() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar language with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate myDsl \"http://example.xtext.org/MyDsl\"");
_builder.newLine();
_builder.append("Model: Left | Right;");
_builder.newLine();
_builder.append("Left: Delegate;");
_builder.newLine();
_builder.append("Right returns Model: Delegate \'=\';");
_builder.newLine();
_builder.append("Delegate returns Left: value=ID;");
_builder.newLine();
String grammar = _builder.toString();
final XtextResource resource = this.getResourceFromString(grammar);
Assert.assertEquals(resource.getErrors().toString(), 0, resource.getErrors().size());
}
示例9: testExplicitFieldListing
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void testExplicitFieldListing() {
ToStringHelperTest.MyEntity _myEntity = new ToStringHelperTest.MyEntity();
final ToStringBuilder helper = new ToStringBuilder(_myEntity).add("boolProp", Boolean.valueOf(false)).addField("intProp");
StringConcatenation _builder = new StringConcatenation();
_builder.append("MyEntity [");
_builder.newLine();
_builder.append(" ");
_builder.append("boolProp = false");
_builder.newLine();
_builder.append(" ");
_builder.append("intProp = 42");
_builder.newLine();
_builder.append("]");
Assert.assertEquals(
ToStringHelperTest.toUnix(_builder.toString()), helper.toString());
}
示例10: formatMemberFeatureCallBuilderMultiline1
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void formatMemberFeatureCallBuilderMultiline1() {
final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("newArrayList(\"x\").map(");
_builder.newLine();
_builder.append("\t");
_builder.append("length");
_builder.newLine();
_builder.append(")[lenght]");
_builder.newLine();
it.setExpectation(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("newArrayList(\"x\") . map ( length ");
_builder_1.newLine();
_builder_1.append(") [ lenght ]");
_builder_1.newLine();
it.setToBeFormatted(_builder_1);
};
this._xbaseFormatterTester.assertFormattedExpression(_function);
}
示例11: _assignmentEbnf
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Override
protected String _assignmentEbnf(final RuleCall it, final Assignment assignment, final AntlrOptions options, final boolean supportsActions) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("(");
_builder.newLine();
_builder.append("\t");
_builder.append("{ before(grammarAccess.");
String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<RuleCall>getOriginalElement(it));
_builder.append(_grammarElementAccess, "\t");
_builder.append("); }");
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _ruleName = this._grammarAccessExtensions.ruleName(it.getRule());
_builder.append(_ruleName, "\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("{ after(grammarAccess.");
String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<RuleCall>getOriginalElement(it));
_builder.append(_grammarElementAccess_1, "\t");
_builder.append("); }");
_builder.newLineIfNotEmpty();
_builder.append(")");
_builder.newLine();
return _builder.toString();
}
示例12: compileEntryFinally
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
protected CharSequence compileEntryFinally(final ParserRule it, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
{
if ((it.isDefinesHiddenTokens() || this._grammarAccessExtensions.definesUnorderedGroups(it, options))) {
_builder.append("finally {");
_builder.newLine();
_builder.append("\t");
CharSequence _compileRestoreHiddenTokens = this.compileRestoreHiddenTokens(it, options);
_builder.append(_compileRestoreHiddenTokens, "\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
CharSequence _compileRestoreUnorderedGroups = this.compileRestoreUnorderedGroups(it, options);
_builder.append(_compileRestoreUnorderedGroups, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
}
}
return _builder;
}
示例13: generateTypeWithDebugging
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
public CharSequence generateTypeWithDebugging(final Type it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Class ");
String _name = it.getName();
_builder.append(_name);
_builder.append(" {");
_builder.newLineIfNotEmpty();
{
EList<Property> _properties = it.getProperties();
for(final Property p : _properties) {
_builder.append("\t");
CharSequence _generateProperty = this.generateProperty(p);
_builder.append(_generateProperty, "\t");
_builder.newLineIfNotEmpty();
}
}
_builder.append("}");
_builder.newLine();
return _builder;
}
示例14: testInvalidReturnInThrowBug406762_3
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void testInvalidReturnInThrowBug406762_3() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("throw {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.assertInvalidReturnInsideThrow(_builder);
}
示例15: testLastCompleteNode_2_2
import org.eclipse.xtend2.lib.StringConcatenation; //导入依赖的package包/类
@Test
public void testLastCompleteNode_2_2() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("parent1");
_builder.newLine();
_builder.append("\t");
_builder.append("child1");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<|>grandChild1");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[ID:parent1]");
_builder_1.newLine();
_builder_1.append("[INDENT:]");
_builder_1.newLine();
_builder_1.append("[ID:child1]");
_builder_1.newLine();
this.assertLastCompleteNode(_builder, _builder_1.toString());
}