String (MavenDomGoals mavenDomGoals) { StringBuilder res = new StringBuilder("Goals"); boolean hasGoals = false; for (MavenDomGoal mavenDomGoal : mavenDomGoals.getGoals()) { String goal = mavenDomGoal.getStringValue(); if (!StringUtil.isEmptyOrSpaces(goal)) { if (hasGoals) { res.append(", "); } else { res.append(" ("); hasGoals = true; } res.append(goal); } } if (hasGoals) { res.append(")"); } return res.toString(); }