add Element.hasChildren

This commit is contained in:
Grahame Grieve 2019-08-05 11:32:23 +10:00
parent 94dda85240
commit 8122ce591e
1 changed files with 8 additions and 0 deletions

View File

@ -604,6 +604,14 @@ public class Element extends Base {
return getNamedChild(name) != null;
}
public boolean hasChildren(String name) {
if (children != null)
for (Element child : children)
if (child.getName().equals(name))
return true;
return false;
}
@Override
public String toString() {
return name+"="+fhirType() + "["+(children == null || hasValue() ? value : Integer.toString(children.size())+" children")+"]";