use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project applause by applause.
the class EntityDataAccessExtensions method parameterList.
public String parameterList(final DataSourceAccessMethod it) {
EList<Parameter> _declaredParameters = it.getDeclaredParameters();
final Function1<Parameter, String> _function = new Function1<Parameter, String>() {
public String apply(final Parameter param) {
Type _type = param.getType();
String _typeName = EntityDataAccessExtensions.this._typeExtensions.typeName(_type);
String _plus = (_typeName + " *");
Type _type_1 = param.getType();
String _parameterName = EntityDataAccessExtensions.this.parameterName(_type_1);
String _plus_1 = (_plus + _parameterName);
return _plus_1;
}
};
List<String> _map = ListExtensions.<Parameter, String>map(_declaredParameters, _function);
String _join = IterableExtensions.join(_map, ", ");
return _join;
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-xtend by eclipse.
the class DependentElementsCalculatorTests method testPolymorphicDispatch.
@Test
public void testPolymorphicDispatch() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def dispatch foo(Number it) {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("def dispatch foo(String it) {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile fooFile = this.testHelper.xtendFile("Foo", _builder.toString());
IResourcesSetupUtil.waitForBuild();
XtendTypeDeclaration _get = fooFile.getXtendTypes().get(0);
final XtendClass fooClass = ((XtendClass) _get);
final XtendMember fooMethod1 = fooClass.getMembers().get(1);
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
final Iterable<URI> dependentElementURIs = this.dependentElementsCalculator.getDependentElementURIs(fooMethod1, _nullProgressMonitor);
Assert.assertEquals(5, IterableExtensions.size(dependentElementURIs));
EList<XtendMember> _members = fooClass.getMembers();
EList<JvmMember> _members_1 = this.associations.getInferredType(fooClass).getMembers();
final Function1<EObject, Boolean> _function = (EObject it) -> {
return Boolean.valueOf((!(it instanceof JvmConstructor)));
};
final Consumer<EObject> _function_1 = (EObject it) -> {
final Function1<URI, Boolean> _function_2 = (URI element) -> {
URI _uRI = EcoreUtil.getURI(it);
return Boolean.valueOf(Objects.equal(element, _uRI));
};
Assert.assertTrue(it.toString(), IterableExtensions.<URI>exists(dependentElementURIs, _function_2));
};
IterableExtensions.<EObject>toList(IterableExtensions.<EObject>filter(Iterables.<EObject>concat(_members, _members_1), _function)).forEach(_function_1);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-xtend by eclipse.
the class AbstractSingleEditorQueuedBuildTest method removeNestedTypes.
@Test
public void removeNestedTypes() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package mypackage;");
_builder.newLine();
_builder.newLine();
_builder.append("public class Bar {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public class Foo { public class Foo3 {} }");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public static class Foo2 {}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("/mypackage/Bar.java", _builder.toString());
final Procedure0 _function = () -> {
final Function1<ITextEditor, ITextEditor> _function_1 = (ITextEditor it) -> {
ITextEditor _xblockexpression = null;
{
this._javaEditorExtension.changeContent(it, "public class Foo { public class Foo3 {} }", "");
_xblockexpression = this._javaEditorExtension.changeContent(it, "public static class Foo2 {}", "");
}
return _xblockexpression;
};
this.save("/mypackage/Bar.java", _function_1);
};
this.assertThereAreDeltas(_function, "mypackage.Bar", "mypackage.Bar$Foo", "mypackage.Bar$Foo2", "mypackage.Bar$Foo$Foo3");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-xtend by eclipse.
the class AbstractSingleEditorQueuedBuildTest method renameNestedTypes.
@Test
public void renameNestedTypes() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public class Bar {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public class Foo {");
_builder.newLine();
_builder.newLine();
_builder.append("\t\t");
_builder.append("public class Foo3 {}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public static class Foo2 {}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("/mypackage/Bar.java", _builder.toString());
final Procedure0 _function = () -> {
final Function1<ITextEditor, ITextEditor> _function_1 = (ITextEditor it) -> {
ITextEditor _xblockexpression = null;
{
this._javaEditorExtension.changeContent(it, " Foo ", " NewFoo ");
this._javaEditorExtension.changeContent(it, " Foo2 ", " NewFoo2 ");
_xblockexpression = this._javaEditorExtension.changeContent(it, " Foo3 ", " NewFoo3 ");
}
return _xblockexpression;
};
this.save("/mypackage/Bar.java", _function_1);
};
this.assertThereAreDeltas(_function, "mypackage.Bar", "mypackage.Bar$Foo", "mypackage.Bar$Foo2", "mypackage.Bar$NewFoo", "mypackage.Bar$NewFoo2", "mypackage.Bar$NewFoo$NewFoo3", "mypackage.Bar$Foo$Foo3");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.xbase.lib.Functions.Function1 in project xtext-xtend by eclipse.
the class AbstractSingleEditorQueuedBuildTest method removePublicAndPrivateMethods.
@Test
public void removePublicAndPrivateMethods() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package mypackage;");
_builder.newLine();
_builder.newLine();
_builder.append("public class Bar {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public void bar() {}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("private void bar2() {}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("/mypackage/Bar.java", _builder.toString());
final Procedure0 _function = () -> {
final Function1<ITextEditor, ITextEditor> _function_1 = (ITextEditor it) -> {
return this._javaEditorExtension.changeContent(this._javaEditorExtension.changeContent(it, "public void bar() {}", ""), "private void bar2() {}", "");
};
this.save("/mypackage/Bar.java", _function_1);
};
this.assertThereAreDeltas(_function, "mypackage.Bar");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations