Back to GWTP Home

com.gwtplatform.mvp.client.proxy
Class PlaceRequest

Package class diagram package PlaceRequest
java.lang.Object
  extended by com.gwtplatform.mvp.client.proxy.PlaceRequest

public class PlaceRequest
extends Object

This class represents a 'request' for a place location. It includes the 'id' of the place as well as any parameter values. It can convert from and to String tokens for use with the GWT History.

Place request tokens are formatted like this:

#nameToken(;key=value)*

There is a mandatory 'nameToken' value, followed by 0 or more key/value pairs, separated by semi-colons (';'). A few examples follow:

The separators (';' and '=') can be modified in ParameterTokenFormatter.


Nested Class Summary
static class PlaceRequest.Builder
          Class for constructing PlaceRequests.
 
Constructor Summary
PlaceRequest()
          Builds a request without any name token and without parameters.
PlaceRequest(String nameToken)
          Deprecated. Please use PlaceRequest.Builder.nameToken(String) instead
 
Method Summary
 boolean equals(Object obj)
           
 String getNameToken()
           
 String getParameter(String key, String defaultValue)
          Extracts a given parameter from the PlaceRequest.
 Set<String> getParameterNames()
          Retrieves all the parameters available with the request.
 int hashCode()
           
 boolean hasSameNameToken(PlaceRequest other)
          Checks if this place request has the same name token as the one passed in.
 boolean matchesNameToken(String nameToken)
          Checks if this place request matches the name token passed.
 PlaceRequest with(String name, String value)
          Deprecated. Please use PlaceRequest.Builder.with(String, String) instead
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlaceRequest

public PlaceRequest()
Builds a request without any name token and without parameters. You should typically use PlaceRequest(String) and specify the name token. However, this version is acceptable when calling com.gwtplatform.mvp.client.proxy.Proxy#reveal(com.gwtplatform.mvp.client.proxy.PlaceRequest).


PlaceRequest

@Deprecated
public PlaceRequest(String nameToken)
Deprecated. Please use PlaceRequest.Builder.nameToken(String) instead

Builds a request with the specified name token and without parameters. You can later add parameters by doing:

   PlaceRequest request = newRequest.with(key1, param1)
                                    .with(key2, param2);
 

Parameters:
nameToken - The name token for the request.
Method Detail

equals

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

getNameToken

public String getNameToken()

getParameter

public String getParameter(String key,
                           String defaultValue)
Extracts a given parameter from the PlaceRequest.

Parameters:
key - The name of the parameter.
defaultValue - The value returned if the parameter is not found.
Returns:
The value of the parameter if found, the defaultValue otherwise.

getParameterNames

public Set<String> getParameterNames()
Retrieves all the parameters available with the request.

Returns:
A Set containing all the parameter names.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

hasSameNameToken

public boolean hasSameNameToken(PlaceRequest other)
Checks if this place request has the same name token as the one passed in.

Parameters:
other - The PlaceRequest to check against.
Returns:
true if both requests share the same name token. false otherwise.

matchesNameToken

public boolean matchesNameToken(String nameToken)
Checks if this place request matches the name token passed.

Parameters:
nameToken - The name token to match.
Returns:
true if the request matches. false otherwise.

with

@Deprecated
public PlaceRequest with(String name,
                                    String value)
Deprecated. Please use PlaceRequest.Builder.with(String, String) instead

Returns a new instance of the request with the specified parameter name and value. If a parameter with the same name was previously specified, the new request contains the new value.

Parameters:
name - The new parameter name.
value - The new parameter value.
Returns:
The new place request instance.

Back to GWTP Home

Copyright © 2010-2013 ArcBees. All Rights Reserved.