Uri.QueryData Extends
Class used to represent URI query parameters. It is essentially a hash of name-value pairs, though a name can be present more than once. Has the same interface as the collections in goog.structs.

Inheritance

Constructor

goog.Uri.QueryData(opt_queryopt_uriopt_ignoreCase)

Parameters

opt_query : ?string=
Optional encoded query string to parse into the object.
opt_uri : goog.Uri=
Optional uri object that should have its cache invalidated when this object updates. Deprecated -- this is no longer required.
opt_ignoreCase : boolean=
If true, ignore the case of the parameter name in #get.

Instance Methods

Public Protected Private
add(keyvalue) !goog.Uri.QueryData
Adds a key value pair.
Arguments:
key : string
Name.
value : *
Value.
Returns: !goog.Uri.QueryData  Instance of this object.
code »
clear()
Clears the parameters.
code »
clone() !goog.Uri.QueryData
Clone the query data instance.
Returns: !goog.Uri.QueryData  New instance of the QueryData object.
code »
containsKey(key) boolean
Whether there is a parameter with the given name
Arguments:
key : string
The parameter name to check for.
Returns: boolean  Whether there is a parameter with the given name.
code »
containsValue(value) boolean
Whether there is a parameter with the given value.
Arguments:
value : *
The value to check for.
Returns: boolean  Whether there is a parameter with the given value.
code »
ensureKeyMapInitialized_()
If the underlying key map is not yet initialized, it parses the query string and fills the map with parsed data.
code »
extend(var_args)
Extends a query data object with another query data or map like object. This operates 'in-place', it does not create a new QueryData object.
Arguments:
var_args : ...(goog.Uri.QueryData | goog.structs.Map | Object)
The object from which key value pairs will be copied.
code »
filterKeys(keys) !goog.Uri.QueryData
Removes all keys that are not in the provided list. (Modifies this object.)
Arguments:
keys : Array.<string>
The desired keys.
Returns: !goog.Uri.QueryData  a reference to this object.
code »
get(keyopt_default) *
Returns the first value associated with the key. If the query data has no such key this will return undefined or the optional default.
Arguments:
key : string
The name of the parameter to get the value for.
opt_default : *=
The default value to return if the query data has no such key.
Returns: *  The first string value associated with the key, or opt_default if there's no value.
code »
getCount() ?number
No description.
Returns: ?number  The number of parameters.
code »
getKeyName_(arg) string
Helper function to get the key name from a JavaScript object. Converts the object to a string, and to lower case if necessary.
Arguments:
arg : *
The object to get a key name from.
Returns: string  valid key name which can be looked up in #keyMap_.
code »
getKeys() !Array.<string>
Returns all the keys of the parameters. If a key is used multiple times it will be included multiple times in the returned array
Returns: !Array.<string>  All the keys of the parameters.
code »
getValues(opt_key) !Array
Returns all the values of the parameters with the given name. If the query data has no such key this will return an empty array. If no key is given all values wil be returned.
Arguments:
opt_key : string=
The name of the parameter to get the values for.
Returns: !Array  All the values of the parameters with the given name.
code »
invalidateCache_()
Invalidate the cache.
code »
isEmpty() boolean
No description.
Returns: boolean  Whether we have any parameters.
code »
remove(key) boolean
Removes all the params with the given key.
Arguments:
key : string
Name.
Returns: boolean  Whether any parameter was removed.
code »
set(keyvalue) !goog.Uri.QueryData
Sets a key value pair and removes all other keys with the same value.
Arguments:
key : string
Name.
value : *
Value.
Returns: !goog.Uri.QueryData  Instance of this object.
code »
setIgnoreCase(ignoreCase)
Ignore case in parameter names. NOTE: If there are already key/value pairs in the QueryData, and ignoreCase_ is set to false, the keys will all be lower-cased.
Arguments:
ignoreCase : boolean
whether this goog.Uri should ignore case.
code »
setValues(keyvalues)
Sets the values for a key. If the key already exists, this will override all of the existing values that correspond to the key.
Arguments:
key : string
The key to set values for.
values : Array
The values to set.
code »
toDecodedString() string
No description.
Returns: string  Decoded query string.
code »
toString() string
No description.
Returns: string  Encoded query string.
code »

Instance Properties

count_ :
The number of params, or null if it requires computing.
Code »
encodedQuery_ :
Encoded query string, or null if it requires computing from the key map.
Code »
ignoreCase_ :
If true, ignore the case of the parameter name in #get.
Code »
keyMap_ : goog.structs.Map
The map containing name/value or name/array-of-values pairs. May be null if it requires parsing from the query string. We need to use a Map because we cannot guarantee that the key names will not be problematic for IE.
Code »

Static Methods

goog.Uri.QueryData.createFromKeysValues(keysvaluesopt_uriopt_ignoreCase) !goog.Uri.QueryData
Creates a new query data instance from parallel arrays of parameter names and values. Allows for duplicate parameter names. Throws an error if the lengths of the arrays differ.
Arguments:
keys : Array.<string>
Parameter names.
values : Array
Parameter values.
opt_uri : goog.Uri=
URI object that should have its cache invalidated when this object updates.
opt_ignoreCase : boolean=
If true, ignore the case of the parameter name in #get.
Returns: !goog.Uri.QueryData  The populated query data instance.
code »
goog.Uri.QueryData.createFromMap(mapopt_uriopt_ignoreCase) !goog.Uri.QueryData
Creates a new query data instance from a map of names and values.
Arguments:
map : !goog.structs.Map | !Object
Map of string parameter names to parameter value. If parameter value is an array, it is treated as if the key maps to each individual value in the array.
opt_uri : goog.Uri=
URI object that should have its cache invalidated when this object updates.
opt_ignoreCase : boolean=
If true, ignore the case of the parameter name in #get.
Returns: !goog.Uri.QueryData  The populated query data instance.
code »

Package Uri

Package Reference