Exemplo n.º 1
0
  /**
   * Gets the value of the specified parameter.
   *
   * @param name the parameter element name, cannot be <code>null</code>.
   * @return string containing the value of the parameter element, or <code>null</code> if the value
   *     is not set.
   * @throws IllegalArgumentException if <code>name == null</code>.
   */
  public String getParameter(String name) throws IllegalArgumentException {

    // Check preconditions
    MandatoryArgumentChecker.check("name", name);

    return _parameters.get(name);
  }
Exemplo n.º 2
0
  /**
   * Adds an output parameter to the result. The name and the value must both be specified.
   *
   * @param name the name of the output parameter, not <code>null</code> and not an empty string.
   * @param value the value of the output parameter, not <code>null</code> and not an empty string.
   * @throws IllegalArgumentException if <code>name  == null || "".equals(name)
   *          || value == null || "".equals(value)</code>.
   */
  protected void param(String name, String value) throws IllegalArgumentException {

    // Check preconditions
    MandatoryArgumentChecker.check("name", name, "value", value);
    if (name.length() < 1) {
      throw new IllegalArgumentException("\"\".equals(name)");
    } else if (value.length() < 1) {
      throw new IllegalArgumentException("\"\".equals(value)");
    }

    // This will erase any value set before with the same name.
    _parameters.set(name, value);
  }