use of org.eclipse.xtend.ide.codebuilder.AbstractMethodBuilder in project xtext-xtend by eclipse.
the class MethodBuilderTest method testJavaSynchronized.
@Test
public void testJavaSynchronized() {
AbstractMethodBuilder _createMethodBuilder = this._codeBuilderFactory.createMethodBuilder(this.getJavaClass());
final Procedure1<AbstractMethodBuilder> _function = (AbstractMethodBuilder it) -> {
it.setContext(this.getJavaClass());
it.setMethodName("bar");
it.setReturnType(this.createTypeRef(this.getJavaClass()));
it.setVisibility(JvmVisibility.PUBLIC);
it.setSynchronizedFlag(true);
};
AbstractMethodBuilder _doubleArrow = ObjectExtensions.<AbstractMethodBuilder>operator_doubleArrow(_createMethodBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("public synchronized Bar bar() {");
_builder.newLine();
_builder.append(" ");
_builder.append(AbstractBuilderTest.DEFAULT_BODY, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
use of org.eclipse.xtend.ide.codebuilder.AbstractMethodBuilder in project xtext-xtend by eclipse.
the class MethodBuilderTest method testXtendSynchronized.
@Test
public void testXtendSynchronized() {
AbstractMethodBuilder _createMethodBuilder = this._codeBuilderFactory.createMethodBuilder(this.getXtendClass());
final Procedure1<AbstractMethodBuilder> _function = (AbstractMethodBuilder it) -> {
it.setContext(this.getXtendClass());
it.setMethodName("foo");
it.setReturnType(this.createTypeRef(this.getXtendClass()));
it.setVisibility(JvmVisibility.PUBLIC);
it.setSynchronizedFlag(true);
};
AbstractMethodBuilder _doubleArrow = ObjectExtensions.<AbstractMethodBuilder>operator_doubleArrow(_createMethodBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("def synchronized foo() {");
_builder.newLine();
_builder.append(" ");
_builder.append(AbstractBuilderTest.DEFAULT_BODY, " ");
_builder.newLineIfNotEmpty();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
use of org.eclipse.xtend.ide.codebuilder.AbstractMethodBuilder in project xtext-xtend by eclipse.
the class MethodBuilderTest method testXtendCustomBody.
@Test
public void testXtendCustomBody() {
AbstractMethodBuilder _createMethodBuilder = this._codeBuilderFactory.createMethodBuilder(this.getXtendClass());
final Procedure1<AbstractMethodBuilder> _function = (AbstractMethodBuilder it) -> {
it.setContext(this.getXtendClass());
it.setMethodName("foo");
final Procedure1<ISourceAppender> _function_1 = (ISourceAppender it_1) -> {
it_1.append("return");
};
it.setBodyGenerator(_function_1);
};
AbstractMethodBuilder _doubleArrow = ObjectExtensions.<AbstractMethodBuilder>operator_doubleArrow(_createMethodBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("def foo() {");
_builder.newLine();
_builder.append(" ");
_builder.append("return");
_builder.newLine();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
use of org.eclipse.xtend.ide.codebuilder.AbstractMethodBuilder in project xtext-xtend by eclipse.
the class MethodBuilderTest method testXtendAbstractBody.
@Test
public void testXtendAbstractBody() {
AbstractMethodBuilder _createMethodBuilder = this._codeBuilderFactory.createMethodBuilder(this.getXtendClass());
final Procedure1<AbstractMethodBuilder> _function = (AbstractMethodBuilder it) -> {
it.setContext(this.getXtendClass());
it.setAbstractFlag(true);
it.setMethodName("foo");
};
AbstractMethodBuilder _doubleArrow = ObjectExtensions.<AbstractMethodBuilder>operator_doubleArrow(_createMethodBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("def void foo()");
this.assertBuilds(_doubleArrow, _builder.toString());
}
use of org.eclipse.xtend.ide.codebuilder.AbstractMethodBuilder in project xtext-xtend by eclipse.
the class MethodBuilderTest method testJavaCustomBody.
@Test
public void testJavaCustomBody() {
AbstractMethodBuilder _createMethodBuilder = this._codeBuilderFactory.createMethodBuilder(this.getJavaClass());
final Procedure1<AbstractMethodBuilder> _function = (AbstractMethodBuilder it) -> {
it.setContext(this.getJavaClass());
it.setMethodName("foo");
final Procedure1<ISourceAppender> _function_1 = (ISourceAppender it_1) -> {
it_1.append("return");
};
it.setBodyGenerator(_function_1);
};
AbstractMethodBuilder _doubleArrow = ObjectExtensions.<AbstractMethodBuilder>operator_doubleArrow(_createMethodBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("void foo() {");
_builder.newLine();
_builder.append(" ");
_builder.append("return;");
_builder.newLine();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
Aggregations