本文整理汇总了Java中org.eclipse.xtend2.lib.StringConcatenationClient类的典型用法代码示例。如果您正苦于以下问题:Java StringConcatenationClient类的具体用法?Java StringConcatenationClient怎么用?Java StringConcatenationClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringConcatenationClient类属于org.eclipse.xtend2.lib包,在下文中一共展示了StringConcatenationClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testNull_02
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Test
public void testNull_02() {
final Object x = null;
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("fooo");
_builder.newLine();
_builder.append("\t");
_builder.append(x, "\t");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("bar");
_builder.newLine();
}
};
this.assertEquals(_client);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:TemplateNodeTest.java
示例2: addDataToString
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
public void addDataToString(final MutableClassDeclaration cls) {
final Procedure1<MutableMethodDeclaration> _function = new Procedure1<MutableMethodDeclaration>() {
@Override
public void apply(final MutableMethodDeclaration it) {
Util.this.context.setPrimarySourceElement(it, Util.this.context.getPrimarySourceElement(cls));
it.setReturnType(Util.this.context.getString());
it.addAnnotation(Util.this.context.newAnnotationReference(Override.class));
it.addAnnotation(Util.this.context.newAnnotationReference(Pure.class));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("String result = new ");
_builder.append(ToStringHelper.class);
_builder.append("().toString(this);");
_builder.newLineIfNotEmpty();
_builder.append("return result;");
_builder.newLine();
}
};
it.setBody(_client);
}
};
cls.addMethod("toString", _function);
}
开发者ID:eclipse,项目名称:xtext-lib,代码行数:25,代码来源:DataProcessor.java
示例3: testSeparatorLoop
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Test
public void testSeparatorLoop() {
final List<String> strings = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a", "b", "c"));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
{
boolean _hasElements = false;
for(final String s : strings) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(", ", "");
}
_builder.append("\"");
_builder.append(s);
_builder.append("\"");
}
}
_builder.newLineIfNotEmpty();
}
};
this.assertEquals(_client);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:TemplateNodeTest.java
示例4: createProposal
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
protected ContentAssistEntry createProposal(final StringConcatenationClient template, final ContentAssistContext context, final boolean adaptIndentation) {
final ContentAssistEntry entry = new ContentAssistEntry();
entry.setPrefix(context.getPrefix());
String _lineDelimiter = this.getLineDelimiter();
final AbstractIdeTemplateProposalProvider.TemplateStringConcatenation stringConcat = new AbstractIdeTemplateProposalProvider.TemplateStringConcatenation(context, entry, _lineDelimiter);
String _xifexpression = null;
if (adaptIndentation) {
_xifexpression = this.getIndentation(context);
} else {
_xifexpression = null;
}
final String indentation = _xifexpression;
if ((indentation == null)) {
stringConcat.append(template);
} else {
stringConcat.append(template, indentation);
}
entry.setProposal(stringConcat.toString());
return entry;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:AbstractIdeTemplateProposalProvider.java
示例5: testIndentedIf
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Test
public void testIndentedIf() {
final boolean condition = true;
final String string = "foo";
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("Very wise:");
_builder.newLine();
{
if (condition) {
_builder.append("\t");
_builder.append("who ");
_builder.append(string, "\t");
_builder.append(" do");
_builder.newLineIfNotEmpty();
}
}
}
};
this.assertEquals(_client);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:TemplateNodeTest.java
示例6: doTransform
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Override
public void doTransform(final MutableClassDeclaration cls, @Extension final TransformationContext context) {
final Procedure1<MutableFieldDeclaration> _function = (MutableFieldDeclaration it) -> {
it.setStatic(true);
it.setFinal(true);
it.setType(context.newTypeReference(Logger.class));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append(Logger.class);
_builder.append(".getLogger(");
String _simpleName = cls.getSimpleName();
_builder.append(_simpleName);
_builder.append(".class)");
_builder.newLineIfNotEmpty();
}
};
it.setInitializer(_client);
context.setPrimarySourceElement(it, cls);
};
cls.addField("LOG", _function);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:LogProcessor.java
示例7: generateServices
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
protected void generateServices() {
if (((this.projectConfig.getGenericIde().getSrcGen() == null) || this.languageConfigs.isEmpty())) {
return;
}
final TextFileAccess file = new TextFileAccess();
file.setPath("META-INF/services/org.eclipse.xtext.ISetup");
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
{
for(final XtextGeneratorLanguage lang : XtextGenerator.this.languageConfigs) {
TypeReference _genericIdeSetup = XtextGenerator.this.naming.getGenericIdeSetup(lang.getGrammar());
_builder.append(_genericIdeSetup);
_builder.newLineIfNotEmpty();
}
}
}
};
file.setContent(_client);
file.writeTo(this.projectConfig.getGenericIde().getSrcGen());
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:XtextGenerator.java
示例8: _cache
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
protected StringConcatenationClient _cache(final ParserRule it) {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("private final ");
String _gaRuleAccessorClassName = GrammarAccessFragment2.this._grammarAccessExtensions.gaRuleAccessorClassName(it);
_builder.append(_gaRuleAccessorClassName);
_builder.append(" ");
String _gaRuleAccessorLocalVarName = GrammarAccessFragment2.this.gaRuleAccessorLocalVarName(it);
_builder.append(_gaRuleAccessorLocalVarName);
_builder.append(";");
_builder.newLineIfNotEmpty();
}
};
return _client;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:GrammarAccessFragment2.java
示例9: __generatePropertyWithDebugging
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
public StringConcatenationClient __generatePropertyWithDebugging(final Property it) {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("Property ");
IGeneratorNode __name = TracingSugarTest.this._myExtensions._name(it, true);
_builder.append(__name);
_builder.append(" : ");
final Function1<Type, String> _function = (Type it_1) -> {
return it_1.getName();
};
IGeneratorNode __type = TracingSugarTest.this._myExtensions._type(it, _function);
_builder.append(__type);
_builder.newLineIfNotEmpty();
}
};
return _client;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:TracingSugarTest.java
示例10: _initializer
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
protected StringConcatenationClient _initializer(final EnumRule it) {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("this.");
String _gaRuleAccessorLocalVarName = GrammarAccessFragment2.this.gaRuleAccessorLocalVarName(it);
_builder.append(_gaRuleAccessorLocalVarName);
_builder.append(" = new ");
String _gaRuleAccessorClassName = GrammarAccessFragment2.this._grammarAccessExtensions.gaRuleAccessorClassName(it);
_builder.append(_gaRuleAccessorClassName);
_builder.append("();");
_builder.newLineIfNotEmpty();
}
};
return _client;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:GrammarAccessFragment2.java
示例11: testSeparatorLoopWithWhitespace3
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Test
public void testSeparatorLoopWithWhitespace3() {
final List<String> strings = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a", "b", "c"));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
{
boolean _hasElements = false;
for(final String s : strings) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(",", "");
}
_builder.newLine();
_builder.append(s);
_builder.append(" ");
_builder.newLineIfNotEmpty();
_builder.newLine();
}
}
}
};
this.assertEquals(_client);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:26,代码来源:TemplateNodeTest.java
示例12: generateGenQuickfixProvider
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
public void generateGenQuickfixProvider() {
final TypeReference genClass = this.getQuickfixProviderClass(this.getGrammar());
final GeneratedJavaFileAccess file = this.fileAccessFactory.createGeneratedJavaFile(genClass);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = genClass.getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _quickfixProviderSuperClass = QuickfixProviderFragment2.this.getQuickfixProviderSuperClass(QuickfixProviderFragment2.this.getGrammar());
_builder.append(_quickfixProviderSuperClass);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
}
};
file.setContent(_client);
file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrcGen());
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:QuickfixProviderFragment2.java
示例13: testSeparatorLoopWithWhitespace2
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Test
public void testSeparatorLoopWithWhitespace2() {
final List<String> strings = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a", "b", "c"));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
{
boolean _hasElements = false;
for(final String s : strings) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate(",", "");
}
_builder.append(s);
_builder.append(" ");
_builder.append(s);
_builder.newLineIfNotEmpty();
}
}
}
};
this.assertEquals(_client);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:TemplateNodeTest.java
示例14: testIndentedFor
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Test
public void testIndentedFor() {
final List<String> list = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("foo", "bar"));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("Very wise:");
_builder.newLine();
_builder.append("\t");
{
for(final String s : list) {
_builder.append("\t");
_builder.append(s, "\t");
}
}
_builder.newLineIfNotEmpty();
}
};
this.assertEquals(_client);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:TemplateNodeTest.java
示例15: someCodeGen
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
private StringConcatenationClient someCodeGen(final int n) {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
{
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, n, true);
for(final Integer i : _doubleDotLessThan) {
_builder.append("before ");
CompositeGeneratorNode _append = GeneratorNodeTest.this.exts.append(GeneratorNodeTest.this.exts.trace(GeneratorNodeTest.this.loc((10 + (i).intValue()))), "Hello");
_builder.append(_append);
_builder.append(" after");
_builder.newLineIfNotEmpty();
_builder.append(" ");
StringConcatenationClient _someCodeGen = GeneratorNodeTest.this.someCodeGen((n - 1));
_builder.append(_someCodeGen, " ");
_builder.newLineIfNotEmpty();
}
}
}
};
return _client;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:GeneratorNodeTest.java
示例16: setCompilationStrategy
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
protected void setCompilationStrategy(/* @Nullable */ JvmMember member, /* @Nullable */ StringConcatenationClient strategy) {
if(member == null || strategy == null)
return;
CompilationTemplateAdapter adapter = new CompilationTemplateAdapter();
adapter.setCompilationTemplate(strategy);
member.eAdapters().add(adapter);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:JvmTypesBuilder.java
示例17: getCompilationTemplate
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
public StringConcatenationClient getCompilationTemplate(final JvmIdentifiableElement it) {
final CompilationTemplateAdapter adapter = IterableExtensions.<CompilationTemplateAdapter>head(Iterables.<CompilationTemplateAdapter>filter(it.eAdapters(), CompilationTemplateAdapter.class));
StringConcatenationClient _compilationTemplate = null;
if (adapter!=null) {
_compilationTemplate=adapter.getCompilationTemplate();
}
return _compilationTemplate;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:9,代码来源:JvmTypeExtensions.java
示例18: generateStandaloneSetup
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
private void generateStandaloneSetup(final LanguageConfig config1, final XpandExecutionContext ctx) {
ctx.getOutput().openFile(null, StringConcatOutputImpl.STRING_OUTLET);
try {
final IXtextGeneratorLanguage config2 = this.getLanguage();
if ((this.fragment instanceof IGeneratorFragmentExtension2)) {
((IGeneratorFragmentExtension2)this.fragment).addToStandaloneSetup(config1, ctx);
} else {
this.fragment.addToStandaloneSetup(config1.getGrammar(), ctx);
}
Output _output = ctx.getOutput();
final StringConcatenation result = ((StringConcatOutputImpl) _output).getStringOutlet();
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
StringBuilder _decreaseIndentation = FragmentAdapter.this.decreaseIndentation(result.toString(), 2);
_builder.append(_decreaseIndentation);
}
};
config2.getRuntimeGenSetup().getRegistrations().add(_client);
Set<TypeReference> _imports = config2.getRuntimeGenSetup().getImports();
TypeReference _typeReference = new TypeReference("org.eclipse.emf.ecore.EPackage");
_imports.add(_typeReference);
Set<TypeReference> _imports_1 = config2.getRuntimeGenSetup().getImports();
TypeReference _typeReference_1 = new TypeReference("org.eclipse.emf.ecore.resource.Resource");
_imports_1.add(_typeReference_1);
} finally {
ctx.getOutput().closeFile();
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:30,代码来源:FragmentAdapter.java
示例19: testAppendStringConcatClientNull
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
@Test
public void testAppendStringConcatClientNull() {
final StringConcatenation c = new StringConcatenation();
c.append((StringConcatenationClient)null);
c.append((StringConcatenationClient)null, "");
c.append((StringConcatenationClient)null, " ");
assertEquals("", c.toString());
}
开发者ID:eclipse,项目名称:xtext-lib,代码行数:9,代码来源:StringConcatenationTest.java
示例20: addGetter
import org.eclipse.xtend2.lib.StringConcatenationClient; //导入依赖的package包/类
public void addGetter(final MutableFieldDeclaration field, final Visibility visibility) {
this.validateGetter(field);
field.markAsRead();
final Procedure1<MutableMethodDeclaration> _function = new Procedure1<MutableMethodDeclaration>() {
@Override
public void apply(final MutableMethodDeclaration it) {
Util.this.context.setPrimarySourceElement(it, Util.this.context.getPrimarySourceElement(field));
it.addAnnotation(Util.this.context.newAnnotationReference(Pure.class));
it.setReturnType(Util.this.orObject(field.getType()));
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("return ");
Object _fieldOwner = Util.this.fieldOwner(field);
_builder.append(_fieldOwner);
_builder.append(".");
String _simpleName = field.getSimpleName();
_builder.append(_simpleName);
_builder.append(";");
}
};
it.setBody(_client);
it.setStatic(field.isStatic());
it.setVisibility(visibility);
}
};
field.getDeclaringType().addMethod(this.getGetterName(field), _function);
}
开发者ID:eclipse,项目名称:xtext-lib,代码行数:29,代码来源:AccessorsProcessor.java
注:本文中的org.eclipse.xtend2.lib.StringConcatenationClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论