Example #1
0
 /**
  * ** Gets a list of all the argument key names ** @return a list of all the argument key names
  */
 public java.util.List<String> getArgNames() {
   java.util.List<String> knList = new Vector<String>();
   for (KeyVal kv : this.getKeyValList()) {
     knList.add(kv.getKey());
   }
   return knList;
 }
Example #2
0
 /**
  * ** Gets args as RTProperties instance ** @return A new RTProperties instance with this URIArg's
  * key value pairs
  */
 public RTProperties getArgProperties() {
   RTProperties rtp = new RTProperties();
   for (Iterator i = this.getKeyValList().iterator(); i.hasNext(); ) {
     KeyVal kv = (KeyVal) i.next();
     rtp.setString(kv.getKey(), this.decodeArg(kv.getValue()));
   }
   return rtp;
 }
Example #3
0
 /**
  * ** Removes all occurances of the specified key from the URI ** @param key The key to remove
  * ** @return This URIArg, with the argument added
  */
 public URIArg removeArg(String key) {
   if (key != null) {
     for (Iterator<KeyVal> i = this.getKeyValList().iterator(); i.hasNext(); ) {
       KeyVal kv = i.next();
       if (kv.getKey().equals(key)) {
         i.remove();
       }
     }
   }
   return this;
 }
Example #4
0
 /**
  * ** Gets an <code>OrderedMap</code> of the argument key/value pairs indexed ** by their keys
  * ** @return An <code>OrderedMap</code> of the argument key/value pairs
  */
 protected OrderedMap<String, KeyVal> getKeyValMap() {
   OrderedMap<String, KeyVal> kvMap = new OrderedMap<String, KeyVal>();
   for (KeyVal kv : this.getKeyValList()) {
     // only the first occurance is retained
     String kn = kv.getKey();
     if (!kvMap.containsKey(kn)) {
       kvMap.put(kn, kv);
     }
   }
   return kvMap;
 }
Example #5
0
 /**
  * ** Gets the first occuring KeyVal of the specified key ** @param key The key to get ** @return
  * The KeyVal associated with <code>key</code>, if any
  */
 protected KeyVal getKeyVal(String key) {
   if (key != null) {
     Collection<KeyVal> kvList = this.getKeyValList();
     for (KeyVal kv : kvList) {
       if (kv.getKey().equals(key)) {
         return kv;
       }
     }
     return null;
   } else {
     return null;
   }
 }
Example #6
0
 /**
  * ** Returns a new URIArg with this URIArg's arguments encoded into a ** single RTProperties
  * added with a specified key [CHECK] ** @param rtpKey The key to add the encoded args at
  * ** @param exclKeys keys to exclude from encoding ** @return A new URIArg with non excluded
  * arguments encoded
  */
 public URIArg rtpEncode(String rtpKey, String... exclKeys) {
   URIArg rtpUrl = new URIArg(this.getURI());
   RTProperties rtp = new RTProperties();
   for (KeyVal kv : this.getKeyValList()) {
     String kn = kv.getKey();
     if (ListTools.contains(exclKeys, kn)) {
       rtpUrl.addArg(kv);
     } else {
       rtp.setString(kn, kv.getValue());
     }
   }
   rtpUrl.addArg(rtpKey, rtp);
   return rtpUrl;
 }
Example #7
0
 /**
  * ** Returns a new URIArg with this URIArg's arguments decoded from a ** single RTProperties
  * added a specified key [CHECK] ** @param rtpKey The key of the RTProperties to decode the
  * encoded args from ** @return A new URIArg with non excluded arguments encoded
  */
 public URIArg rtpDecode(String rtpKey) {
   URIArg cpyUrl = new URIArg(this.getURI());
   for (KeyVal kv : this.getKeyValList()) {
     String kn = kv.getKey();
     if (!kn.equals(rtpKey)) {
       cpyUrl.addArg(kv);
     } else {
       RTProperties rtp = URIArg.parseRTP(kv.getValue());
       for (Object rpk : rtp.getPropertyKeys()) {
         String rk = rpk.toString();
         String rv = rtp.getString(rk, "");
         cpyUrl.addArg(rk, rv);
       }
     }
   }
   return cpyUrl;
 }
Example #8
0
 public KeyVal(KeyVal kv) {
   this.key = (kv != null) ? kv.getKey() : "";
   this.val = (kv != null) ? kv.getValue() : "";
 }