This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Source Code#

import java.util.*;                  // Java utility classes and data structures

import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.plugin.*;

public class showParameters implements WikiPlugin {
  public String execute (WikiContext Context, Map ParameterMap) throws PluginException {
    String Result = "<h4>showParameters - lists the given plugin parameters</h4>\n";

  /**** take care of a missing ParameterMap (may that ever happen?) ****/

    if (ParameterMap == null) {
      return Result + "(no parameters given)";
    };

  /**** otherwise retrieve (and show) any given parameters ****/

    Iterator ParameterInterator = ParameterMap.keySet().iterator();
    if (!ParameterInterator.hasNext()) {                  // this looks probable
      return Result + "(no parameters given)";
    };

    Result += "<dl>";
      while (ParameterInterator.hasNext()) {
        Object Key = ParameterInterator.next();
        Result += "<dt>" + Key + (Key != null ? " (" + Key.getClass().getName() + ")" : "") + "\n";

        Object Value = (Key == null ? null : ParameterMap.get(Key));
        if (Value == null) {
          Result += "<dd>(null)";
        } else {
          if (Value instanceof String) {
            Result += "<dd>\"" + Value + "\"";
          } else {
            Result += "<dd>(" + Value.getClass().getName() + ") " + Value + "\n";
          };
        };
      };
    return Result + "</dl>";
  };
};

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 09-Apr-2003 15:22 by 129.69.13.219.