public BuildTask toBuildTask(CRBuildTask crBuildTask) { BuildTask buildTask; switch (crBuildTask.getType()) { case rake: buildTask = new RakeTask(); break; case ant: buildTask = new AntTask(); break; case nant: buildTask = new NantTask(); break; default: throw new RuntimeException( String.format("unknown type of build task '%s'", crBuildTask.getType())); } setCommonBuildTaskMembers(buildTask, crBuildTask); setCommonTaskMembers(buildTask, crBuildTask); return buildTask; }
private void setCommonBuildTaskMembers(BuildTask buildTask, CRBuildTask crBuildTask) { buildTask.buildFile = crBuildTask.getBuildFile(); buildTask.target = crBuildTask.getTarget(); buildTask.workingDirectory = crBuildTask.getWorkingDirectory(); }