/** ** Removes all arguments which have blank values ** @return This URIArg */ public URIArg removeBlankValues() { for (Iterator<KeyVal> i = this.getKeyValList().iterator(); i.hasNext(); ) { KeyVal kv = i.next(); if (!kv.hasValue()) { i.remove(); } } return this; }
/** * ** Returns a String representation of all key/values ** @param sbuff The StringBuffer to write * the key/values to, or null for a new one ** @param includeBlankValues True to include keys for * blank values. ** @return A String representation of all key/values */ public StringBuffer getArgString(StringBuffer sbuff, boolean includeBlankValues) { StringBuffer sb = (sbuff != null) ? sbuff : new StringBuffer(); int argCnt = 0; for (Iterator i = this.getKeyValList().iterator(); i.hasNext(); ) { KeyVal kv = (KeyVal) i.next(); if (includeBlankValues || kv.hasValue()) { if (argCnt > 0) { sb.append("&"); } sb.append(kv.toString()); argCnt++; } } return sb; }