/** * Serializes an {@link com.modelsolv.reprezen.restapi.ZenModel} at the given path. * * @param path * Location of the RESTApi metamodel. * @param model * {@link com.modelsolv.reprezen.restapi.ZenModel} to serialize. */ @Override public void serialize(String path, ZenModel model) throws RestApiException { XtextResourceSet resourceSet = new XtextDslStandaloneSetup().createInjectorAndDoEMFRegistration() .getInstance(XtextResourceSet.class); org.eclipse.emf.ecore.resource.Resource resource = resourceSet.createResource(URI.createFileURI(path)); resource.getContents().add(model); try { resource.save(SaveOptions.newBuilder().noValidation().getOptions().toOptionsMap()); } catch (IOException e) { throw new RestApiException(String.format("Could not save the ZenModel at location '%s'", path), e); } }