Пример #1
0
 /**
  * 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;
 }
Пример #2
0
  /*
   * (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();
  }