/** * return the child ObjectDefinition, if the child with a given name exist, return null otherwise. * Note this access is much slower that the indexed approach, the performance can degrade if the * number of children is high * * @param childName * @return */ public ObjectDefinition getchild(String childName) { for (ObjectDefinition child : children) { if (child.getName().equals(childName)) { return child; } } return null; }
/* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("name: " + name + "\n"); sb.append(" Fields: \n"); sb.append(fields.toString()); if (!children.isEmpty()) sb.append("\nChildren: "); for (ObjectDefinition c : children) { sb.append("\n child "); if (c != null) sb.append(c.toString()); } return sb.toString(); }