public class PageParameters extends Object implements IClusterable, IIndexedParameters, INamedParameters
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
INamedParameters.NamedPair, INamedParameters.Type
Constructor and Description |
---|
PageParameters()
Constructor.
|
PageParameters(PageParameters copy)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
PageParameters |
add(String name,
Object value)
Adds a page parameter to these with
name and value |
PageParameters |
add(String name,
Object value,
INamedParameters.Type type)
Adds value to named parameter with given name.
|
PageParameters |
add(String name,
Object value,
int index,
INamedParameters.Type type)
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() |
List<INamedParameters.NamedPair> |
getAllNamedByType(INamedParameters.Type type) |
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 page parameter with
name and value |
PageParameters |
set(String name,
Object value,
INamedParameters.Type type)
Sets the value for named parameter with given name.
|
PageParameters |
set(String name,
Object value,
int index)
Sets the page parameter with
name and value at the given index |
PageParameters |
set(String name,
Object value,
int index,
INamedParameters.Type type)
Sets the named parameter on specified position.
|
String |
toString() |
public PageParameters()
public PageParameters(PageParameters copy)
copy
- The parameters to copy frompublic int getIndexedCount()
public PageParameters set(int index, Object object)
IIndexedParameters
set
in interface IIndexedParameters
index
- The position of the parameterobject
- The parameter at this positionIIndexedParameters.set(int, java.lang.Object)
public StringValue get(int index)
get
in interface IIndexedParameters
index
- The position of the parameterpublic PageParameters remove(int index)
IIndexedParameters
remove
in interface IIndexedParameters
index
- The position of the parameterpublic Set<String> getNamedKeys()
INamedParameters
getNamedKeys
in interface INamedParameters
public StringValue get(String name)
INamedParameters
get
in interface INamedParameters
public List<StringValue> getValues(String name)
INamedParameters
getValues
in interface INamedParameters
public List<INamedParameters.NamedPair> getAllNamed()
getAllNamed
in interface INamedParameters
public List<INamedParameters.NamedPair> getAllNamedByType(INamedParameters.Type type)
getAllNamedByType
in interface INamedParameters
type
- The type to filternull
then returns all named parameters.public int getPosition(String name)
INamedParameters
getPosition
in interface INamedParameters
name
- the name of the parameter to look for-1
if there is no parameter with that name.public PageParameters remove(String name, String... values)
INamedParameters
remove
in interface INamedParameters
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.public PageParameters add(String name, Object value)
name
and value
name
- value
- public PageParameters add(String name, Object value, INamedParameters.Type type)
INamedParameters
add
in interface INamedParameters
public PageParameters add(String name, Object value, int index, INamedParameters.Type type)
INamedParameters
IRequestMapper
s may or may not take
the order into account.add
in interface INamedParameters
public PageParameters set(String name, Object value, int index)
name
and value
at the given index
name
- value
- index
- public PageParameters set(String name, Object value, int index, INamedParameters.Type type)
INamedParameters
IRequestMapper
s may or may not
take the order into account.set
in interface INamedParameters
public PageParameters set(String name, Object value)
name
and value
name
- value
- public PageParameters set(String name, Object value, INamedParameters.Type type)
INamedParameters
set
in interface INamedParameters
public PageParameters clearIndexed()
IIndexedParameters
clearIndexed
in interface IIndexedParameters
public PageParameters clearNamed()
INamedParameters
clearNamed
in interface INamedParameters
public PageParameters overwriteWith(PageParameters other)
other
- The new parameterspublic PageParameters mergeWith(PageParameters other)
other
- The parameters to mergepublic static boolean equals(PageParameters p1, PageParameters p2)
PageParameters
objects.p1
- The first parametersp2
- The second parameterstrue
if the objects are equal, false
otherwise.public boolean isEmpty()
true
if the parameters are empty, false
otherwise.Copyright © 2006–2021 Apache Software Foundation. All rights reserved.