Exemplo n.º 1
0
  public <T extends File> T getDescendentOfType(Class<T> type) {
    Assert.notNull(type, "cannot search a descendent with type null");
    if (type.isAssignableFrom(getClass())) {
      return (T) this;
    } else {
      for (Directory child : this.getFiles(Directory.class).toList()) {
        T c = child.getDescendentOfType(type);
        if (c != null) {
          return c;
        }
      }
    }

    return null;
  }