Ejemplo n.º 1
0
  /**
   * Print a list of definitions in different format: fqdn, vdlt, and vdlx
   *
   * @param writer the target to output the list
   * @param defList a list of definitions
   * @param format the output format
   * @see #FORMAT_FQDN
   * @see #FORMAT_VDLT
   * @see #FORMAT_VDLX NOTE: might be better to move into another module?
   */
  public void printDefinitionList(Writer writer, java.util.List defList, int format)
      throws IOException {
    if (defList == null || defList.isEmpty()) return;
    Definitions defs = new Definitions();
    if (format != FORMAT_FQDN) {
      defs.setDefinition(defList);
      if (format == FORMAT_VDLX) defs.toXML(writer, "");
      else if (format == FORMAT_VDLT) defs.toString(writer);
    } else {
      for (Iterator i = defList.iterator(); i.hasNext(); ) {
        Definition def = (Definition) i.next();

        writer.write(def.identify());
        writer.write("\n");
      }
      writer.flush();
    }
  }