org.apache.wicket.request.mapper.parameter
Class PageParameters

java.lang.Object
  extended by 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 IRequestMappers

Author:
Matej Knopp
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.wicket.request.mapper.parameter.INamedParameters
INamedParameters.NamedPair
 
Constructor Summary
PageParameters()
          Construct.
PageParameters(PageParameters copy)
          Copy constructor.
 
Method Summary
 PageParameters add(String name, Object value)
          Adds value to named parameter with given name.
 PageParameters add(String name, Object value, int index)
          Adds named parameter to a specified position.
 PageParameters clearIndexed()
          Removes all indexed parameters.
 PageParameters clearNamed()
          Removes all named parameters.
 boolean equals(Object obj)
           
static boolean equals(PageParameters p1, PageParameters p2)
          Compares two PageParameters objects.
 StringValue get(int index)
           
 StringValue get(String name)
          Returns parameter value of named parameter with given name
 List<INamedParameters.NamedPair> getAllNamed()
           
 int getIndexedCount()
           
 Set<String> getNamedKeys()
          Return set of all named parameter names.
 int getPosition(String name)
          Returns the position of a named parameter.
 List<StringValue> getValues(String name)
          Return list of all values for named parameter with given name
 int hashCode()
           
 boolean isEmpty()
           
 PageParameters mergeWith(PageParameters other)
          Merges the page parameters into this, overwriting existing values
 PageParameters overwriteWith(PageParameters other)
          Copy the page parameters
 PageParameters remove(int index)
          Removes indexed parameter on given index
 PageParameters remove(String name, String... values)
          Removes named parameter with given name.
 PageParameters set(int index, Object object)
          Sets the indexed parameter on given index
 PageParameters set(String name, Object value)
          Sets the value for named parameter with given name.
 PageParameters set(String name, Object value, int index)
          Sets the named parameter on specified position.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageParameters

public PageParameters()
Construct.


PageParameters

public PageParameters(PageParameters copy)
Copy constructor.

Parameters:
copy -
Method Detail

getIndexedCount

public int getIndexedCount()
Returns:
count of indexed parameters

set

public PageParameters set(int index,
                          Object object)
Description copied from interface: IIndexedParameters
Sets the indexed parameter on given index

Specified by:
set in interface IIndexedParameters
Returns:
this
See Also:
IIndexedParameters.set(int, java.lang.Object)

get

public StringValue get(int index)
Specified by:
get in interface IIndexedParameters
Returns:
indexed parameter on given index
See Also:
IIndexedParameters.get(int)

remove

public PageParameters remove(int index)
Description copied from interface: IIndexedParameters
Removes indexed parameter on given index

Specified by:
remove in interface IIndexedParameters
Returns:
this
See Also:
IIndexedParameters.remove(int)

getNamedKeys

public Set<String> getNamedKeys()
Description copied from interface: INamedParameters
Return set of all named parameter names.

Specified by:
getNamedKeys in interface INamedParameters
Returns:
named parameter names
See Also:
INamedParameters.getNamedKeys()

get

public StringValue get(String name)
Description copied from interface: INamedParameters
Returns parameter value of named parameter with given name

Specified by:
get in interface INamedParameters
Returns:
parameter value
See Also:
INamedParameters.get(java.lang.String)

getValues

public List<StringValue> getValues(String name)
Description copied from interface: INamedParameters
Return list of all values for named parameter with given name

Specified by:
getValues in interface INamedParameters
Returns:
list of parameter values
See Also:
INamedParameters.getValues(java.lang.String)

getAllNamed

public List<INamedParameters.NamedPair> getAllNamed()
Specified by:
getAllNamed in interface INamedParameters
Returns:
All named parameters in exact order.
See Also:
INamedParameters.getAllNamed()

getPosition

public int getPosition(String name)
Description copied from interface: INamedParameters
Returns the position of a named parameter.

Specified by:
getPosition in interface INamedParameters
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.
See Also:
INamedParameters.getPosition(String)

remove

public PageParameters remove(String name,
                             String... values)
Description copied from interface: INamedParameters
Removes named parameter with given name.

Specified by:
remove in interface INamedParameters
Parameters:
name - the name of the parameter to remove
values - values used as criteria. The parameter will be removed only if its value is equal to any of the criteria.
Returns:
this
See Also:
INamedParameters.remove(java.lang.String, java.lang.String...)

add

public PageParameters add(String name,
                          Object value)
Description copied from interface: INamedParameters
Adds value to named parameter with given name.

Specified by:
add in interface INamedParameters
Returns:
this
See Also:
INamedParameters.add(java.lang.String, java.lang.Object)

add

public PageParameters add(String name,
                          Object value,
                          int index)
Description copied from interface: INamedParameters
Adds named parameter to a specified position. The IRequestMappers may or may not take the order into account.

Specified by:
add in interface INamedParameters
Returns:
this
See Also:
INamedParameters.add(java.lang.String, java.lang.Object, int)

set

public PageParameters set(String name,
                          Object value,
                          int index)
Description copied from interface: INamedParameters
Sets the named parameter on specified position. The IRequestMappers may or may not take the order into account.

Specified by:
set in interface INamedParameters
Returns:
this
See Also:
INamedParameters.set(java.lang.String, java.lang.Object, int)

set

public PageParameters set(String name,
                          Object value)
Description copied from interface: INamedParameters
Sets the value for named parameter with given name.

Specified by:
set in interface INamedParameters
Returns:
this
See Also:
INamedParameters.set(java.lang.String, java.lang.Object)

clearIndexed

public PageParameters clearIndexed()
Description copied from interface: IIndexedParameters
Removes all indexed parameters.

Specified by:
clearIndexed in interface IIndexedParameters
Returns:
this
See Also:
IIndexedParameters.clearIndexed()

clearNamed

public PageParameters clearNamed()
Description copied from interface: INamedParameters
Removes all named parameters.

Specified by:
clearNamed in interface INamedParameters
Returns:
this
See Also:
INamedParameters.clearNamed()

overwriteWith

public PageParameters overwriteWith(PageParameters other)
Copy the page parameters

Parameters:
other -
Returns:
this

mergeWith

public PageParameters mergeWith(PageParameters other)
Merges the page parameters into this, overwriting existing values

Parameters:
other -
Returns:
this

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

equals

public static boolean equals(PageParameters p1,
                             PageParameters p2)
Compares two PageParameters objects.

Parameters:
p1 -
p2 -
Returns:
true if the objects are equal, false otherwise.

isEmpty

public boolean isEmpty()
Returns:
true if the parameters are empty, false otherwise.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006–2017 Apache Software Foundation. All rights reserved.