Polishing

This commit is contained in:
Juergen Hoeller
2014-08-22 00:14:10 +02:00
parent 39a23660fa
commit e324c2ab4a
5 changed files with 39 additions and 55 deletions

View File

@@ -58,16 +58,15 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
/**
* Provide a URL path to help identify the target request for this FlashMap.
* The path may be absolute (e.g. /application/resource) or relative to the
* current request (e.g. ../resource).
* @param path the URI path
* <p>The path may be absolute (e.g. "/application/resource") or relative to the
* current request (e.g. "../resource").
*/
public void setTargetRequestPath(String path) {
this.targetRequestPath = path;
}
/**
* Return the target URL path or {@code null}.
* Return the target URL path (or {@code null} if none specified).
*/
public String getTargetRequestPath() {
return this.targetRequestPath;
@@ -75,7 +74,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
/**
* Provide request parameters identifying the request for this FlashMap.
* @param params a Map with the names and values of expected parameters.
* @param params a Map with the names and values of expected parameters
*/
public FlashMap addTargetRequestParams(MultiValueMap<String, String> params) {
if (params != null) {
@@ -90,8 +89,8 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
/**
* Provide a request parameter identifying the request for this FlashMap.
* @param name the expected parameter name, skipped if empty or {@code null}
* @param value the expected value, skipped if empty or {@code null}
* @param name the expected parameter name (skipped if empty or {@code null})
* @param value the expected value (skipped if empty or {@code null})
*/
public FlashMap addTargetRequestParam(String name, String value) {
if (StringUtils.hasText(name) && StringUtils.hasText(value)) {
@@ -117,18 +116,15 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
}
/**
* Whether this instance has expired depending on the amount of elapsed
* time since the call to {@link #startExpirationPeriod}.
* Return whether this instance has expired depending on the amount of
* elapsed time since the call to {@link #startExpirationPeriod}.
*/
public boolean isExpired() {
if (this.expirationStartTime != 0) {
return (System.currentTimeMillis() - this.expirationStartTime > this.timeToLive * 1000);
}
else {
return false;
}
return (this.expirationStartTime != 0 &&
(System.currentTimeMillis() - this.expirationStartTime > this.timeToLive * 1000));
}
/**
* Compare two FlashMaps and prefer the one that specifies a target URL
* path or has more target URL parameters. Before comparing FlashMap