Module org.apache.wicket.request
Class PageParameters
java.lang.Object
org.apache.wicket.request.mapper.parameter.PageParameters
- All Implemented Interfaces:
Serializable
,IIndexedParameters
,INamedParameters
,IClusterable
public class PageParameters
extends Object
implements IClusterable, IIndexedParameters, INamedParameters
Mutable class that holds parameters of a Page. Page parameters consist of indexed parameters and
named parameters. Indexed parameters are URL segments before the query string. Named parameters
are usually represented as query string params (i.e. ?arg1=var1&arg2=val)
Indexed vs Named Parameters: Suppose we mounted a page on /user
and the
following url was accessed /user/profile/bob?action=view&redirect=false
. In this example
profile
and bob
are indexed parameters with respective indexes 0 and 1.
action
and redirect
are named parameters.
How those parameters are populated depends on the IRequestMapper
s
- Author:
- Matej Knopp
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.wicket.request.mapper.parameter.INamedParameters
INamedParameters.NamedPair, INamedParameters.Type
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a page parameter to these withname
andvalue
add
(String name, Object value, int index, INamedParameters.Type type) Adds named parameter to a specified position.add
(String name, Object value, INamedParameters.Type type) Adds value to named parameter with given name.Removes all indexed parameters.Removes all named parameters.boolean
Checks if the parameter with the given name existsboolean
static boolean
equals
(PageParameters p1, PageParameters p2) Compares twoPageParameters
objects.get
(int index) Returns parameter value of named parameter with given nameint
int
Return set of all named parameter names.int
getPosition
(String name) Returns the position of a named parameter.Return list of all values for named parameter with given nameint
hashCode()
boolean
isEmpty()
mergeWith
(PageParameters other) Merges the page parameters into this, overwriting existing valuesoverwriteWith
(PageParameters other) Copy the page parametersremove
(int index) Removes indexed parameter on given indexRemoves named parameter with given name.Sets the indexed parameter on given indexSets the page parameter withname
andvalue
Sets the page parameter withname
andvalue
at the givenindex
set
(String name, Object value, int index, INamedParameters.Type type) Sets the named parameter on specified position.set
(String name, Object value, INamedParameters.Type type) Sets the value for named parameter with given name.toString()
-
Constructor Details
-
PageParameters
public PageParameters()Constructor. -
PageParameters
Copy constructor.- Parameters:
copy
- The parameters to copy from
-
-
Method Details
-
getIndexedCount
- Returns:
- count of indexed parameters
-
getNamedCount
- Returns:
- count of named parameters
-
set
Description copied from interface:IIndexedParameters
Sets the indexed parameter on given index- Specified by:
set
in interfaceIIndexedParameters
- Parameters:
index
- The position of the parameterobject
- The parameter at this position- Returns:
- this instance, for chaining
- See Also:
-
get
- Specified by:
get
in interfaceIIndexedParameters
- Parameters:
index
- The position of the parameter- Returns:
- indexed parameter on given index
-
remove
Description copied from interface:IIndexedParameters
Removes indexed parameter on given index- Specified by:
remove
in interfaceIIndexedParameters
- Parameters:
index
- The position of the parameter- Returns:
- this instance, for chaining
-
getNamedKeys
Description copied from interface:INamedParameters
Return set of all named parameter names.- Specified by:
getNamedKeys
in interfaceINamedParameters
- Returns:
- named parameter names
-
contains
Checks if the parameter with the given name exists- Parameters:
name
- the parameter name- Returns:
true
if the parameter exists,false
otherwise
-
get
Description copied from interface:INamedParameters
Returns parameter value of named parameter with given name- Specified by:
get
in interfaceINamedParameters
- Returns:
- parameter value
-
getValues
Description copied from interface:INamedParameters
Return list of all values for named parameter with given name- Specified by:
getValues
in interfaceINamedParameters
- Returns:
- list of parameter values
-
getAllNamed
- Specified by:
getAllNamed
in interfaceINamedParameters
- Returns:
- All named parameters in exact order.
-
getAllNamedByType
- Specified by:
getAllNamedByType
in interfaceINamedParameters
- Parameters:
type
- The type to filter- Returns:
- All named parameters with the given type. If the type is
null
then returns all named parameters.
-
getPosition
Description copied from interface:INamedParameters
Returns the position of a named parameter.- Specified by:
getPosition
in interfaceINamedParameters
- Parameters:
name
- the name of the parameter to look for- Returns:
- the position of the parameter.
-1
if there is no parameter with that name.
-
remove
Description copied from interface:INamedParameters
Removes named parameter with given name.- Specified by:
remove
in interfaceINamedParameters
- Parameters:
name
- the name of the parameter to removevalues
- values used as criteria. The parameter will be removed only if its value is equal to any of the criteria.- Returns:
- this
-
add
Adds a page parameter to these withname
andvalue
- Parameters:
name
-value
-- Returns:
- these
-
add
Description copied from interface:INamedParameters
Adds value to named parameter with given name.- Specified by:
add
in interfaceINamedParameters
- Returns:
- this
-
add
Description copied from interface:INamedParameters
Adds named parameter to a specified position. TheIRequestMapper
s may or may not take the order into account.- Specified by:
add
in interfaceINamedParameters
- Returns:
- this
-
set
Sets the page parameter withname
andvalue
at the givenindex
- Parameters:
name
-value
-index
-- Returns:
- this
-
set
Description copied from interface:INamedParameters
Sets the named parameter on specified position. TheIRequestMapper
s may or may not take the order into account.- Specified by:
set
in interfaceINamedParameters
- Returns:
- this
-
set
Sets the page parameter withname
andvalue
- Parameters:
name
-value
-- Returns:
- this
-
set
Description copied from interface:INamedParameters
Sets the value for named parameter with given name.- Specified by:
set
in interfaceINamedParameters
- Returns:
- this
-
clearIndexed
Description copied from interface:IIndexedParameters
Removes all indexed parameters.- Specified by:
clearIndexed
in interfaceIIndexedParameters
- Returns:
- this instance, for chaining
-
clearNamed
Description copied from interface:INamedParameters
Removes all named parameters.- Specified by:
clearNamed
in interfaceINamedParameters
- Returns:
- this
-
overwriteWith
Copy the page parameters- Parameters:
other
- The new parameters- Returns:
- this instance, for chaining
-
mergeWith
Merges the page parameters into this, overwriting existing values- Parameters:
other
- The parameters to merge- Returns:
- this instance, for chaining
-
hashCode
-
equals
-
equals
Compares twoPageParameters
objects.- Parameters:
p1
- The first parametersp2
- The second parameters- Returns:
true
if the objects are equal,false
otherwise.
-
isEmpty
- Returns:
true
if the parameters are empty,false
otherwise.
-
setLocale
-
toString
-