Package pt.opensoft.util

Examples of pt.opensoft.util.Pair


     * ATEN��O: Este m�todo N�O FAZ urlencode. � necess�rio faz�-lo previamente.
     * @param name
     * @param value
     */
    public void addParameter(String name, String value) {
        _parameters.add(new Pair(name, value));
    }
View Full Code Here


      if( parameters == null ) {
        return;
      }
        for (Iterator iterator = parameters.keySet().iterator(); iterator.hasNext();) {
            Object key = iterator.next();
            _parameters.add(new Pair(key, parameters.get(key)));
        }
    }
View Full Code Here

    protected String constructOutputString() {

        StringWriter body = new StringWriter();
        Iterator iter = _parameters.iterator();
        while (iter.hasNext()) {
            Pair element = (Pair) iter.next();
          if( !body.toString().equals("") ) // It's not the first parameter, set the &
          {
            body.write("&");
          }
            body.write(element.getFirst() + "=" + element.getSecond());
        }
        return body.toString();
    }
View Full Code Here

  public String toString() {
    StringBuffer buffer = new StringBuffer( super.toString() );
    boolean first = true;
    for(Iterator i = _parameters.iterator(); i.hasNext();) {
      Pair parameter = (Pair) i.next();
      if( first ) {
        buffer.append("?");
        first = false;
      }
      else {
        buffer.append("&");
      }

      buffer.append(parameter.getFirst()).append("=").append(parameter.getSecond());
    }

    return buffer.toString();
  }
View Full Code Here

TOP

Related Classes of pt.opensoft.util.Pair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.