org.apache.lenya.util
Class Query

java.lang.Object
  extended by org.apache.lenya.util.Query

public class Query
extends java.lang.Object

Utility class to analyze a query string of the form key1=value1&key2=value2&.... Access is not thread-safe.

Invalid parts (not a valid key-value-pair) are omitted.


Field Summary
protected static java.lang.String KEY_VALUE_DELIMITER
           
protected static java.lang.String PAIR_DELIMITER
           
 
Constructor Summary
Query(java.lang.String string)
          Creates a query object with default values for the pair and key-value delimiters.
Query(java.lang.String string, java.lang.String pairDelimiter, java.lang.String keyValueDelimiter)
          Creates a query object.
 
Method Summary
 java.lang.String getKeyValueDelimiter()
           
 java.lang.String getPairDelimiter()
           
 java.lang.String getValue(java.lang.String key)
           
 java.lang.String getValue(java.lang.String key, java.lang.String defaultValue)
           
 void removeValue(java.lang.String key)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PAIR_DELIMITER

protected static final java.lang.String PAIR_DELIMITER
See Also:
Constant Field Values

KEY_VALUE_DELIMITER

protected static final java.lang.String KEY_VALUE_DELIMITER
See Also:
Constant Field Values
Constructor Detail

Query

public Query(java.lang.String string)
Creates a query object with default values for the pair and key-value delimiters.

Parameters:
string - The query string.

Query

public Query(java.lang.String string,
             java.lang.String pairDelimiter,
             java.lang.String keyValueDelimiter)
Creates a query object.

Parameters:
string - The string.
pairDelimiter - The delimiter between key-value pairs.
keyValueDelimiter - The delimiter between key and value.
Method Detail

getValue

public java.lang.String getValue(java.lang.String key)

getValue

public java.lang.String getValue(java.lang.String key,
                                 java.lang.String defaultValue)

getKeyValueDelimiter

public java.lang.String getKeyValueDelimiter()

getPairDelimiter

public java.lang.String getPairDelimiter()

removeValue

public void removeValue(java.lang.String key)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 1999-2006 Apache Software Foundation. All Rights Reserved.