Ejemplo n.º 1
0
  /**
   * Retrieves the value of the give path. If the path is NULL, or if the type of this Item is a
   * String, Integer, or Double it will return the value of this Item. If the path is not NULL (and
   * the type is a Record or a List), it will pass the path to the Record/List, and return the
   * resulting Item.
   *
   * @param path - the substructure-path of the item you want
   * @return the wanted Item
   */
  public Item getValueOfPath(String path) {
    if (type == Type.String) return this;
    if (type == Type.Integer) return this;
    if (type == Type.Double) return this;
    if (type == Type.Record) {
      if (path == null) {
        return this;
      } else {
        return recordValue.getValueOfPath(path);
      }
    }
    if (type == Type.List) {

      if (path == null) {
        return this;
      } else {
        return listValue.getValueOfPath(path);
      }
    }
    return null;
  }