public RestDataElement getFirstChildWithNameInData(String nameInData) { for (RestDataElement restDataElement : getChildren()) { if (restDataElement.getNameInData().equals(nameInData)) { return restDataElement; } } throw new DataMissingException("Requested child " + nameInData + " does not exist"); }
public boolean containsChildWithNameInData(String nameInData) { for (RestDataElement restDataElement : getChildren()) { if (restDataElement.getNameInData().equals(nameInData)) { return true; } } return false; }
private boolean tryToRemoveChild(String childNameInData) { for (RestDataElement dataElement : getChildren()) { if (dataElement.getNameInData().equals(childNameInData)) { getChildren().remove(dataElement); return true; } } return false; }