use of org.eclipse.xtend.ide.codebuilder.AbstractParameterBuilder in project xtext-xtend by eclipse.
the class ConstructorBuilderTest method testJavaConstructor.
@Test
public void testJavaConstructor() {
AbstractConstructorBuilder _createConstructorBuilder = this._codeBuilderFactory.createConstructorBuilder(this.getJavaClass());
final Procedure1<AbstractConstructorBuilder> _function = (AbstractConstructorBuilder it) -> {
it.setContext(this.getJavaClass());
it.setVisibility(JvmVisibility.PRIVATE);
AbstractParameterBuilder _newParameterBuilder = it.newParameterBuilder();
_newParameterBuilder.setType(this.createTypeRef(this.getJavaClass()));
AbstractParameterBuilder _newParameterBuilder_1 = it.newParameterBuilder();
_newParameterBuilder_1.setType(this.createTypeRef(this.getJavaClass()));
};
AbstractConstructorBuilder _doubleArrow = ObjectExtensions.<AbstractConstructorBuilder>operator_doubleArrow(_createConstructorBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("private Bar(Bar bar, Bar bar2) {");
_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.AbstractParameterBuilder in project xtext-xtend by eclipse.
the class ConstructorBuilderTest method testXtendConstructor.
@Test
public void testXtendConstructor() {
AbstractConstructorBuilder _createConstructorBuilder = this._codeBuilderFactory.createConstructorBuilder(this.getXtendClass());
final Procedure1<AbstractConstructorBuilder> _function = (AbstractConstructorBuilder it) -> {
it.setContext(this.getXtendClass());
it.setVisibility(JvmVisibility.PROTECTED);
AbstractParameterBuilder _newParameterBuilder = it.newParameterBuilder();
_newParameterBuilder.setType(this.createTypeRef(this.getXtendClass()));
AbstractParameterBuilder _newParameterBuilder_1 = it.newParameterBuilder();
_newParameterBuilder_1.setType(this.createTypeRef(this.getXtendClass()));
};
AbstractConstructorBuilder _doubleArrow = ObjectExtensions.<AbstractConstructorBuilder>operator_doubleArrow(_createConstructorBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("protected new(Foo foo, Foo foo2) {");
_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.AbstractParameterBuilder in project xtext-xtend by eclipse.
the class ConstructorBuilderTest method testJavaParameterNames.
@Test
public void testJavaParameterNames() {
AbstractConstructorBuilder _createConstructorBuilder = this._codeBuilderFactory.createConstructorBuilder(this.getJavaClass());
final Procedure1<AbstractConstructorBuilder> _function = (AbstractConstructorBuilder it) -> {
it.setContext(this.getJavaClass());
it.setVisibility(JvmVisibility.PRIVATE);
AbstractParameterBuilder _newParameterBuilder = it.newParameterBuilder();
final Procedure1<AbstractParameterBuilder> _function_1 = (AbstractParameterBuilder it_1) -> {
it_1.setType(this.createTypeRef(this.getXtendClass()));
it_1.setName("bar");
};
ObjectExtensions.<AbstractParameterBuilder>operator_doubleArrow(_newParameterBuilder, _function_1);
AbstractParameterBuilder _newParameterBuilder_1 = it.newParameterBuilder();
final Procedure1<AbstractParameterBuilder> _function_2 = (AbstractParameterBuilder it_1) -> {
it_1.setType(this.createTypeRef(this.getJavaClass()));
it_1.setName("foo");
};
ObjectExtensions.<AbstractParameterBuilder>operator_doubleArrow(_newParameterBuilder_1, _function_2);
};
AbstractConstructorBuilder _doubleArrow = ObjectExtensions.<AbstractConstructorBuilder>operator_doubleArrow(_createConstructorBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("private Bar(Foo bar, Bar foo) {");
_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.AbstractParameterBuilder in project xtext-xtend by eclipse.
the class MethodBuilderTest method testSetContextOnParameters.
@Test
public void testSetContextOnParameters() {
AbstractMethodBuilder _createMethodBuilder = this._codeBuilderFactory.createMethodBuilder(this.getXtendClass());
final Procedure1<AbstractMethodBuilder> _function = (AbstractMethodBuilder it) -> {
final AbstractParameterBuilder builder = it.newParameterBuilder();
Assert.assertNull(builder.getContext());
it.setContext(this.getXtendClass());
Assert.assertEquals(this.getXtendClass(), builder.getContext());
};
ObjectExtensions.<AbstractMethodBuilder>operator_doubleArrow(_createMethodBuilder, _function);
}
use of org.eclipse.xtend.ide.codebuilder.AbstractParameterBuilder in project xtext-xtend by eclipse.
the class MethodBuilderTest method testJavaMethod.
@Test
public void testJavaMethod() {
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);
AbstractParameterBuilder _newParameterBuilder = it.newParameterBuilder();
_newParameterBuilder.setType(this.createTypeRef(this.getJavaClass()));
AbstractParameterBuilder _newParameterBuilder_1 = it.newParameterBuilder();
_newParameterBuilder_1.setType(this.createTypeRef(this.getJavaClass()));
};
AbstractMethodBuilder _doubleArrow = ObjectExtensions.<AbstractMethodBuilder>operator_doubleArrow(_createMethodBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("public Bar bar(Bar bar, Bar bar2) {");
_builder.newLine();
_builder.append(" ");
_builder.append(AbstractBuilderTest.DEFAULT_BODY, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
Aggregations