Class PageParameters

  • All Implemented Interfaces:
    java.io.Serializable, IIndexedParameters, INamedParameters, org.apache.wicket.util.io.IClusterable

    public class PageParameters
    extends java.lang.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:
    Serialized Form
    • Constructor Detail

      • PageParameters

        public PageParameters()
        Constructor.
      • PageParameters

        public PageParameters​(PageParameters copy)
        Copy constructor.
        Parameters:
        copy - The parameters to copy from
    • Method Detail

      • getIndexedCount

        public int getIndexedCount()
        Returns:
        count of indexed parameters
      • get

        public org.apache.wicket.util.string.StringValue get​(int index)
        Specified by:
        get in interface IIndexedParameters
        Parameters:
        index - The position of the parameter
        Returns:
        indexed parameter on given index
      • remove

        public PageParameters remove​(int index)
        Description copied from interface: IIndexedParameters
        Removes indexed parameter on given index
        Specified by:
        remove in interface IIndexedParameters
        Parameters:
        index - The position of the parameter
        Returns:
        this instance, for chaining
      • getNamedKeys

        public java.util.Set<java.lang.String> getNamedKeys()
        Description copied from interface: INamedParameters
        Return set of all named parameter names.
        Specified by:
        getNamedKeys in interface INamedParameters
        Returns:
        named parameter names
      • get

        public org.apache.wicket.util.string.StringValue get​(java.lang.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
      • getValues

        public java.util.List<org.apache.wicket.util.string.StringValue> getValues​(java.lang.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
      • getPosition

        public int getPosition​(java.lang.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.
      • remove

        public PageParameters remove​(java.lang.String name,
                                     java.lang.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
      • add

        public PageParameters add​(java.lang.String name,
                                  java.lang.Object value)
        Adds a page parameter to these with name and value
        Parameters:
        name -
        value -
        Returns:
        these
      • set

        public PageParameters set​(java.lang.String name,
                                  java.lang.Object value,
                                  int index)
        Sets the page parameter with name and value at the given index
        Parameters:
        name -
        value -
        index -
        Returns:
        this
      • set

        public PageParameters set​(java.lang.String name,
                                  java.lang.Object value)
        Sets the page parameter with name and value
        Parameters:
        name -
        value -
        Returns:
        this
      • overwriteWith

        public PageParameters overwriteWith​(PageParameters other)
        Copy the page parameters
        Parameters:
        other - The new parameters
        Returns:
        this instance, for chaining
      • mergeWith

        public PageParameters mergeWith​(PageParameters other)
        Merges the page parameters into this, overwriting existing values
        Parameters:
        other - The parameters to merge
        Returns:
        this instance, for chaining
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • equals

        public static boolean equals​(PageParameters p1,
                                     PageParameters p2)
        Compares two PageParameters objects.
        Parameters:
        p1 - The first parameters
        p2 - The second parameters
        Returns:
        true if the objects are equal, false otherwise.
      • isEmpty

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

        public PageParameters setLocale​(java.util.Locale locale)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object