Package org.eclipse.xtext.generator

Examples of org.eclipse.xtext.generator.InMemoryFileSystemAccess


  public stylesheet parse(final String inputString) {
    try {
      stylesheet _xblockexpression = null;
      {
        final stylesheet model = this.parseHelper.parse(inputString);
        InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
        final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
        Resource _eResource = model.eResource();
        this.generator.doGenerate(_eResource, fsa);
        _xblockexpression = (model);
      }
      return _xblockexpression;
View Full Code Here


      String _string = _builder_1.toString();
      MyValidationHelper.ValidationResult _validate = this.myValidationHelper.validate(model);
      String _issuesToString = _validate.issuesToString();
      String _trim = _issuesToString.trim();
      Assert.assertEquals(_string, _trim);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(1, _size);
      final String topClonerJavaFileName = (IFileSystemAccess.DEFAULT_OUTPUT + "a/b/c/cloners/ListWrapper1Cloner.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(topClonerJavaFileName);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_2 = new StringConcatenation();
      _builder_2.append("package a.b.c.cloners;");
      _builder_2.newLine();
      _builder_2.append("public class ListWrapper1Cloner {");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("public a.b.c.ListWrapper1 apply(a.b.c.ListWrapper1 other) {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (other == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("a.b.c.ListWrapper1 it = new a.b.c.ListWrapper1();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setPersonNames(personNamesCollectionCloner(it.getPersonNames(), other.getPersonNames()));");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("return it;");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("private java.util.List<java.lang.String> personNamesCollectionCloner(java.util.List<java.lang.String> thisCollection, java.util.List<java.lang.String> otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (otherCollection == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (thisCollection == null) thisCollection = new java.util.ArrayList<java.lang.String>();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("for (java.lang.String otherCollectionItem : otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("thisCollection.add(otherCollectionItem);");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("return thisCollection;");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("}");
      _builder_2.newLine();
      String _string_1 = _builder_2.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(topClonerJavaFileName);
      String _string_2 = _get.toString();
      Assert.assertEquals(_string_1, _string_2);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

      String _string = _builder_1.toString();
      MyValidationHelper.ValidationResult _validate = this.myValidationHelper.validate(model);
      String _issuesToString = _validate.issuesToString();
      String _trim = _issuesToString.trim();
      Assert.assertEquals(_string, _trim);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(1, _size);
      final String topClonerJavaFileName = (IFileSystemAccess.DEFAULT_OUTPUT + "a/b/c/cloners/BookCloner789.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(topClonerJavaFileName);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_2 = new StringConcatenation();
      _builder_2.append("package a.b.c.cloners;");
      _builder_2.newLine();
      _builder_2.append("public class BookCloner789 {");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("public a.b.m2.Book apply(a.b.m2.Book other) {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (other == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("a.b.m2.Book it = new a.b.m2.Book();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setName(other.getName());");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setAuthor(other.getAuthor());");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setSections(sectionsCollectionCloner(it.getSections(), other.getSections()));");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("return it;");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("private java.util.List<a.b.m2.Section> sectionsCollectionCloner(java.util.List<a.b.m2.Section> thisCollection, java.util.List<a.b.m2.Section> otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (otherCollection == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (thisCollection == null) thisCollection = new java.util.ArrayList<a.b.m2.Section>();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("for (a.b.m2.Section otherCollectionItem : otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("thisCollection.add(sectionsCloner.apply(otherCollectionItem));");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("return thisCollection;");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("private final SectionsCloner sectionsCloner = new SectionsCloner();");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("public static class SectionsCloner {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("public a.b.m2.Section apply(a.b.m2.Section other) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("if (other == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("a.b.m2.Section it = new a.b.m2.Section();");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("it.setName(other.getName());");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("it.setDescription(other.getDescription());");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("return it;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("}");
      _builder_2.newLine();
      String _string_1 = _builder_2.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(topClonerJavaFileName);
      String _string_2 = _get.toString();
      Assert.assertEquals(_string_1, _string_2);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

      String _string = _builder_1.toString();
      MyValidationHelper.ValidationResult _validate = this.myValidationHelper.validate(model);
      String _issuesToString = _validate.issuesToString();
      String _trim = _issuesToString.trim();
      Assert.assertEquals(_string, _trim);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(1, _size);
      final String topClonerJavaFileName = (IFileSystemAccess.DEFAULT_OUTPUT + "a/b/c/cloners/BookCloner987.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(topClonerJavaFileName);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_2 = new StringConcatenation();
      _builder_2.append("package a.b.c.cloners;");
      _builder_2.newLine();
      _builder_2.append("public class BookCloner987 {");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("public a.b.m2.Book apply(a.b.m2.Book other) {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (other == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("a.b.m2.Book it = new a.b.m2.Book();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setName(other.getName());");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setAuthor(other.getAuthor());");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setSections(sectionsCollectionCloner(it.getSections(), other.getSections()));");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("return it;");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("private java.util.List<a.b.m2.Section> sectionsCollectionCloner(java.util.List<a.b.m2.Section> thisCollection, java.util.List<a.b.m2.Section> otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (otherCollection == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (thisCollection == null) thisCollection = new java.util.ArrayList<a.b.m2.Section>();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("for (a.b.m2.Section otherCollectionItem : otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("thisCollection.add(sectionsCloner.apply(otherCollectionItem));");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("return thisCollection;");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("private final SectionsCloner sectionsCloner = new SectionsCloner();");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("public static class SectionsCloner {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("public a.b.m2.Section apply(a.b.m2.Section other) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("if (other == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("a.b.m2.Section it = new a.b.m2.Section();");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("it.setName(other.getName());");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("it.setDescription(other.getDescription());");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("it.setParagraphs(paragraphsCollectionCloner(it.getParagraphs(), other.getParagraphs()));");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("return it;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("private java.util.Set<a.b.m2.Paragraph> paragraphsCollectionCloner(java.util.Set<a.b.m2.Paragraph> thisCollection, java.util.Set<a.b.m2.Paragraph> otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("if (otherCollection == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("if (thisCollection == null) thisCollection = new java.util.HashSet<a.b.m2.Paragraph>();");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("for (a.b.m2.Paragraph otherCollectionItem : otherCollection) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t\t");
      _builder_2.append("thisCollection.add(paragraphsCloner.apply(otherCollectionItem));");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("return thisCollection;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("private final ParagraphsCloner paragraphsCloner = new ParagraphsCloner();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("public static class ParagraphsCloner {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("public a.b.m2.Paragraph apply(a.b.m2.Paragraph other) {");
      _builder_2.newLine();
      _builder_2.append("\t\t\t\t");
      _builder_2.append("if (other == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t\t\t");
      _builder_2.append("a.b.m2.Paragraph it = new a.b.m2.Paragraph();");
      _builder_2.newLine();
      _builder_2.append("\t\t\t\t");
      _builder_2.append("it.setNumber(other.getNumber());");
      _builder_2.newLine();
      _builder_2.append("\t\t\t\t");
      _builder_2.append("it.setText(other.getText());");
      _builder_2.newLine();
      _builder_2.append("\t\t\t\t");
      _builder_2.append("return it;");
      _builder_2.newLine();
      _builder_2.append("\t\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("}");
      _builder_2.newLine();
      String _string_1 = _builder_2.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(topClonerJavaFileName);
      String _string_2 = _get.toString();
      Assert.assertEquals(_string_1, _string_2);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

      String _string = _builder_1.toString();
      MyValidationHelper.ValidationResult _validate = this.myValidationHelper.validate(model);
      String _issuesToString = _validate.issuesToString();
      String _trim = _issuesToString.trim();
      Assert.assertEquals(_string, _trim);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(3, _size);
      final String bookCloner = (IFileSystemAccess.DEFAULT_OUTPUT + "a/b/m/BookCloner.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(bookCloner);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_2 = new StringConcatenation();
      _builder_2.append("package a.b.m;");
      _builder_2.newLine();
      _builder_2.append("public class BookCloner {");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("public a.b.m.Book apply(a.b.m.Book other) {");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("if (other == null) return null;");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("a.b.m.Book it = new a.b.m.Book();");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setName(other.getName());");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("it.setSection(sectionCloner.apply(other.getSection()));");
      _builder_2.newLine();
      _builder_2.append("\t\t");
      _builder_2.append("return it;");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("}");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.newLine();
      _builder_2.append("\t");
      _builder_2.append("private final a.b.m.SectionDeep sectionCloner = new a.b.m.SectionDeep();");
      _builder_2.newLine();
      _builder_2.append("}");
      _builder_2.newLine();
      String _string_1 = _builder_2.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(bookCloner);
      String _string_2 = _get.toString();
      Assert.assertEquals(_string_1, _string_2);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

      _builder.append("}");
      _builder.newLine();
      final String code = _builder.toString();
      final Model model = this.parseHelper.parse(code);
      this.validationHelper.assertNoIssues(model);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(1, _size);
      final String topClonerJavaFileName = (IFileSystemAccess.DEFAULT_OUTPUT + "my/home/cloners/MagazineCloner.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(topClonerJavaFileName);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("package my.home.cloners;");
      _builder_1.newLine();
      _builder_1.append("public class MagazineCloner {");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public a.b.m.Magazine apply(a.b.m.Magazine other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("a.b.m.Magazine it = new a.b.m.Magazine();");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setName(other.getName());");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setIsbn(other.getIsbn());");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setArticle(articleCloner.apply(other.getArticle()));");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("private final ArticleCloner articleCloner = new ArticleCloner();");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public static class ArticleCloner {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("public a.b.m.Article apply(a.b.m.Article other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("a.b.m.Article it = new a.b.m.Article();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setName(other.getName());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setAuthor(other.getAuthor());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setPageNumber(other.getPageNumber());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setSection(sectionCloner.apply(other.getSection()));");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("private final SectionCloner sectionCloner = new SectionCloner();");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("public static class SectionCloner {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("public a.b.m.Section apply(a.b.m.Section other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("a.b.m.Section it = new a.b.m.Section();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("it.setName(other.getName());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("it.setDescription(other.getDescription());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("it.setParagraph(paragraphCloner.apply(other.getParagraph()));");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("private final ParagraphCloner paragraphCloner = new ParagraphCloner();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("public static class ParagraphCloner {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("public a.b.m.Paragraph apply(a.b.m.Paragraph other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t\t");
      _builder_1.append("a.b.m.Paragraph it = new a.b.m.Paragraph();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t\t");
      _builder_1.append("it.setNumber(other.getNumber());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t\t");
      _builder_1.append("it.setText(other.getText());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("}");
      _builder_1.newLine();
      String _string = _builder_1.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(topClonerJavaFileName);
      String _string_1 = _get.toString();
      Assert.assertEquals(_string, _string_1);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

      _builder.append("}");
      _builder.newLine();
      final String code = _builder.toString();
      final Model model = this.parseHelper.parse(code);
      this.validationHelper.assertNoIssues(model);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(1, _size);
      final String topClonerJavaFileName = (IFileSystemAccess.DEFAULT_OUTPUT + "my/home/cloners/reduced/MagazineCloner.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(topClonerJavaFileName);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("package my.home.cloners.reduced;");
      _builder_1.newLine();
      _builder_1.append("public class MagazineCloner {");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public a.b.m.Magazine apply(a.b.m.Magazine other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("a.b.m.Magazine it = new a.b.m.Magazine();");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setName(other.getName());");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setArticle(articleCloner.apply(other.getArticle()));");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("private final ArticleCloner articleCloner = new ArticleCloner();");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public static class ArticleCloner {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("public a.b.m.Article apply(a.b.m.Article other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("a.b.m.Article it = new a.b.m.Article();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setName(other.getName());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setSection(sectionCloner.apply(other.getSection()));");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("private final SectionCloner sectionCloner = new SectionCloner();");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("public static class SectionCloner {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("public a.b.m.Section apply(a.b.m.Section other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("a.b.m.Section it = new a.b.m.Section();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("it.setDescription(other.getDescription());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("}");
      _builder_1.newLine();
      String _string = _builder_1.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(topClonerJavaFileName);
      String _string_1 = _get.toString();
      Assert.assertEquals(_string, _string_1);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

      _builder.newLine();
      _builder.append("}");
      final String code = _builder.toString();
      final Model model = this.parseHelper.parse(code);
      this.validationHelper.assertNoErrors(model);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(1, _size);
      final String topClonerJavaFileName = (IFileSystemAccess.DEFAULT_OUTPUT + "my/home/cloners/WeekdayOpeningHoursCloner.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(topClonerJavaFileName);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("package my.home.cloners;");
      _builder_1.newLine();
      _builder_1.append("public class WeekdayOpeningHoursCloner {");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public a.b.c.WeekdayOpeningHours apply(a.b.c.WeekdayOpeningHours other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("a.b.c.WeekdayOpeningHours it = new a.b.c.WeekdayOpeningHours();");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setWeekDay(other.getWeekDay());");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setHours(hoursCloner.apply(other.getHours()));");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("private final HoursCloner hoursCloner = new HoursCloner();");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public static class HoursCloner {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("public a.b.c.FromToItem apply(a.b.c.FromToItem other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("a.b.c.FromToItem it = new a.b.c.FromToItem();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setFrom(other.getFrom());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setTo(other.getTo());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("}");
      _builder_1.newLine();
      String _string = _builder_1.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(topClonerJavaFileName);
      String _string_1 = _get.toString();
      Assert.assertEquals(_string, _string_1);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

      _builder.newLine();
      _builder.append("}");
      final String code = _builder.toString();
      final Model model = this.parseHelper.parse(code);
      this.validationHelper.assertNoIssues(model);
      InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
      final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
      Resource _eResource = model.eResource();
      this.generatorDslToJava.doGenerate(_eResource, fsa);
      Map<String,CharSequence> _textFiles = fsa.getTextFiles();
      int _size = _textFiles.size();
      Assert.assertEquals(1, _size);
      final String topClonerJavaFileName = (IFileSystemAccess.DEFAULT_OUTPUT + "default/WeekdayOpeningHoursCloner.java");
      Map<String,CharSequence> _textFiles_1 = fsa.getTextFiles();
      boolean _containsKey = _textFiles_1.containsKey(topClonerJavaFileName);
      Assert.assertTrue(_containsKey);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("package default;");
      _builder_1.newLine();
      _builder_1.append("public class WeekdayOpeningHoursCloner {");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public a.b.c.WeekdayOpeningHours apply(a.b.c.WeekdayOpeningHours other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("a.b.c.WeekdayOpeningHours it = new a.b.c.WeekdayOpeningHours();");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setWeekDay(other.getWeekDay());");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("it.setHours(hoursCloner.apply(other.getHours()));");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("private final HoursCloner hoursCloner = new HoursCloner();");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("public static class HoursCloner {");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("public a.b.c.FromToItem apply(a.b.c.FromToItem other) {");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("if (other == null) return null;");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("a.b.c.FromToItem it = new a.b.c.FromToItem();");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setFrom(other.getFrom());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("it.setTo(other.getTo());");
      _builder_1.newLine();
      _builder_1.append("\t\t\t");
      _builder_1.append("return it;");
      _builder_1.newLine();
      _builder_1.append("\t\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("}");
      _builder_1.newLine();
      _builder_1.append("}");
      _builder_1.newLine();
      String _string = _builder_1.toString();
      Map<String,CharSequence> _textFiles_2 = fsa.getTextFiles();
      CharSequence _get = _textFiles_2.get(topClonerJavaFileName);
      String _string_1 = _get.toString();
      Assert.assertEquals(_string, _string_1);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.generator.InMemoryFileSystemAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.