public ClassModel compile(Edimap edimap, String classPackage) throws IllegalNameException {
model = new ClassModel();
model.setEdimap(edimap);
SegmentGroup segmentGroup = edimap.getSegments();
pushNode(segmentGroup);
JClass rootClass = new JClass(classPackage, EDIUtils.encodeClassName(segmentGroup.getJavaName()), getCurrentClassId()).setSerializable();
BindingConfig rootBeanConfig = new BindingConfig(getCurrentClassId(), getCurrentNodePath(), rootClass, null, null);
//Insert root class into classModel and its' corresponding xmltag-value.
model.addCreatedClass(rootClass);
model.setRootBeanConfig(rootBeanConfig);
LOG.debug("Added root class [" + rootClass + "] to ClassModel.");
addWriteMethod(rootBeanConfig);
processSegmentGroups(segmentGroup.getSegments(), rootBeanConfig);
LOG.debug("Finished parsing edi-configuration. All segments are added to ClassModel.");
LOG.debug("ClassModel contains " + model.getCreatedClasses().size() + " classes.");
// Attach the createdClassesByNode map... so we can use them if they