public CompiledType emit(String moduleId, ResolvedSlot slot) throws IOException {
Precondition.checkMustNotBeNull(moduleId, "moduleId"); //$NON-NLS-1$
Precondition.checkMustNotBeNull(slot, "slot"); //$NON-NLS-1$
LOG.debug("Generates a mapper for the output \"{}\" in epilogue phase of \"{}\"",
slot.getSource().getOutputName(), moduleId);
CompilationUnit source;
if (slot.getSortProperties().isEmpty() && ParallelSortClientEmitter.legacy(environment) == false) {
DirectEngine engine = new DirectEngine(environment, moduleId, slot);
source = engine.generate();
} else {
DistributeEngine engine = new DistributeEngine(environment, moduleId, slot);
source = engine.generate();
}
environment.emit(source);
Name packageName = source.getPackageDeclaration().getName();
SimpleName simpleName = source.getTypeDeclarations().get(0).getName();
Name name = environment.getModelFactory().newQualifiedName(packageName, simpleName);
LOG.debug("Mapper for output \"{}\" in epilogue phase is {}",
slot.getSource().getOutputName(),
name);
return new CompiledType(name);