Sorry for the rough form but this may help:
public abstract class AppPlace extends Place {
/**
* Method that allows us to create a simple AppPlaceHistroyMapper. Allows
* the AppPlaceHistoryMapper to just call the AppPlace's getToken in order
* to build the url from the place object
*
* @return
*/
public abstract String getToken();
/**
* Get the integer value of the parameter for the given param key
*
* @param param
* @param token
* @return
*/
public int getInt(String param, String token) {
if (token.contains(param)) {
return Integer
.valueOf(token.substring(
token.indexOf(param + "=") + param.length() + 1)
.split("&")[0]);
} else {
return -1;
}
}
/**
* Get the String value of the parameter for the given param key
*
* @param param
* @param token
* @return
*/
public String getString(String param, String token) {
if (token.contains(param)) {
return param.substring(
token.indexOf(token + "=") + param.length() + 1).split("&")[0];
} else {
return null;
}
}
/**
* Create the url for the given params
*
* @param strings
* and even length number of strings (key, value, key, value,
* etc)
* @return
*/
public String createToken(String... strings) {
if (strings.length > 1 && strings.length % 2 == 0) {
String token = "?" + strings[0] + "=" + strings[1];
for (int i = 1; i < strings.length / 2; i++) {
token = token.concat("&" + strings[i * 2 + i - 1] + "="
+ strings[i * 2 + i]);
}
return token;
} else {
return "";
}
}
}
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/DR3CFt-rqc8J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment