Module org.apache.wicket.request
Class PageParameters
java.lang.Object
org.apache.wicket.request.mapper.parameter.PageParameters
- All Implemented Interfaces:
Serializable,IIndexedParameters,INamedParameters,org.apache.wicket.util.io.IClusterable
public class PageParameters
extends Object
implements org.apache.wicket.util.io.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 IRequestMappers
- 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a page parameter to these withnameandvalueadd(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.booleanChecks if the parameter with the given name existsbooleanstatic booleanequals(PageParameters p1, PageParameters p2) Compares twoPageParametersobjects.org.apache.wicket.util.string.StringValueget(int index) org.apache.wicket.util.string.StringValueReturns parameter value of named parameter with given nameintintReturn set of all named parameter names.intgetPosition(String name) Returns the position of a named parameter.List<org.apache.wicket.util.string.StringValue>Return list of all values for named parameter with given nameinthashCode()booleanisEmpty()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 withnameandvalueSets the page parameter withnameandvalueat the givenindexset(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.voidsetFragment(String fragment) 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:IIndexedParametersSets the indexed parameter on given index- Specified by:
setin interfaceIIndexedParameters- Parameters:
index- The position of the parameterobject- The parameter at this position- Returns:
- this instance, for chaining
- See Also:
-
get
- Specified by:
getin interfaceIIndexedParameters- Parameters:
index- The position of the parameter- Returns:
- indexed parameter on given index
-
remove
Description copied from interface:IIndexedParametersRemoves indexed parameter on given index- Specified by:
removein interfaceIIndexedParameters- Parameters:
index- The position of the parameter- Returns:
- this instance, for chaining
-
getNamedKeys
Description copied from interface:INamedParametersReturn set of all named parameter names.- Specified by:
getNamedKeysin interfaceINamedParameters- Returns:
- named parameter names
-
contains
Checks if the parameter with the given name exists- Parameters:
name- the parameter name- Returns:
trueif the parameter exists,falseotherwise
-
get
Description copied from interface:INamedParametersReturns parameter value of named parameter with given name- Specified by:
getin interfaceINamedParameters- Returns:
- parameter value
-
getValues
Description copied from interface:INamedParametersReturn list of all values for named parameter with given name- Specified by:
getValuesin interfaceINamedParameters- Returns:
- list of parameter values
-
getAllNamed
- Specified by:
getAllNamedin interfaceINamedParameters- Returns:
- All named parameters in exact order.
-
getAllNamedByType
- Specified by:
getAllNamedByTypein interfaceINamedParameters- Parameters:
type- The type to filter- Returns:
- All named parameters with the given type. If the type is
nullthen returns all named parameters.
-
getPosition
Description copied from interface:INamedParametersReturns the position of a named parameter.- Specified by:
getPositionin interfaceINamedParameters- Parameters:
name- the name of the parameter to look for- Returns:
- the position of the parameter.
-1if there is no parameter with that name.
-
remove
Description copied from interface:INamedParametersRemoves named parameter with given name.- Specified by:
removein 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 withnameandvalue- Parameters:
name-value-- Returns:
- these
-
add
Description copied from interface:INamedParametersAdds value to named parameter with given name.- Specified by:
addin interfaceINamedParameters- Returns:
- this
-
add
Description copied from interface:INamedParametersAdds named parameter to a specified position. TheIRequestMappers may or may not take the order into account.- Specified by:
addin interfaceINamedParameters- Returns:
- this
-
set
Sets the page parameter withnameandvalueat the givenindex- Parameters:
name-value-index-- Returns:
- this
-
set
Description copied from interface:INamedParametersSets the named parameter on specified position. TheIRequestMappers may or may not take the order into account.- Specified by:
setin interfaceINamedParameters- Returns:
- this
-
set
Sets the page parameter withnameandvalue- Parameters:
name-value-- Returns:
- this
-
set
Description copied from interface:INamedParametersSets the value for named parameter with given name.- Specified by:
setin interfaceINamedParameters- Returns:
- this
-
clearIndexed
Description copied from interface:IIndexedParametersRemoves all indexed parameters.- Specified by:
clearIndexedin interfaceIIndexedParameters- Returns:
- this instance, for chaining
-
clearNamed
Description copied from interface:INamedParametersRemoves all named parameters.- Specified by:
clearNamedin 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
-
getFragment
-
setFragment
-
hashCode
-
equals
-
equals
Compares twoPageParametersobjects.- Parameters:
p1- The first parametersp2- The second parameters- Returns:
trueif the objects are equal,falseotherwise.
-
isEmpty
- Returns:
trueif the parameters are empty and fragment is null,falseotherwise.
-
setLocale
-
toString
-