A project to generate builders for EMF metamodels with a fluent Java API
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
readme.textile

readme.textile

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

PROJECT MOVED TO http://qyotta.de/redmine/projects/emfbuildergen

FURTHER DEVELOPMENT WILL BE MADE IN A NEW REPOSITORY:

git://qyotta.de/emfbuildergen.git

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The EMF Builder Generator project helps with generating Java builders for EMF metamodels. The generated Java classes follow a fluent API. Builders are very useful to create test data, but can also be used to construct object graphs in production code.

In a nutshell, instead of writing:

Company company = CompanyFactory.eINSTANCE.createCompany();
company.setName("MyCompany");

Department department = CompanyFactory.eINSTANCE.createDepartment();
department.setNumber(1);

Employee alice = CompanyFactory.eINSTANCE.createEmployee();
alice.setName("Alice");

Employee bob = CompanyFactory.eINSTANCE.createEmployee();
bob.setName("Bob");

department.getEmployees().add(alice);
department.getEmployees().add(bob);
company.getDepartment().add(department);

you now can write:

Company company = newCompanyBuilder()
  .withName("MyCompany")
  .withDepartment(
    newDepartmentBuilder()
      .withNumber(1)
      .withEmployees(
        newEmployeeBuilder()
          .withName("Alice")
      )
      .withEmployees(
        newEmployeeBuilder()
          .withName("Bob"))
      )
  .build();

See more examples in the wiki

This software is pubslished under the Eclipse Public License V1.0. Please note the FAQ for EPL.