/** * Adds a profile to the mocel * * @param profile profile */ public Model addProfile(Profile profile) { requireNonNull(profile, "Required not null profile"); profiles().add(profile); // add profile to xml if (root.hasSingleChild("profiles")) { root.getSingleChild("profiles").appendChild(profile.asXMLElement()); profile.element = root.getLastChild(); } else { root.insertChild( createElement("profiles", profile.asXMLElement()), beforeAnyOf("name", "build", "modules").or(inTheEnd())); profile.element = root.getSingleChild("profiles").getFirstChild(); } return this; }