Add mapreduce cleanup action

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149432516
This commit is contained in:
mountford 2017-03-07 10:13:07 -08:00 committed by Ben McIlwain
parent bd7db61606
commit 5d4287a375
11 changed files with 1171 additions and 2 deletions

View file

@ -114,6 +114,19 @@ public final class RequestParameters {
}
}
/**
* Returns first GET or POST parameter associated with {@code name} as a boolean.
*
* @throws BadRequestException if request parameter is present but not a valid boolean
*/
public static Optional<Boolean> extractOptionalBooleanParameter(
HttpServletRequest req, String name) {
String stringParam = req.getParameter(name);
return isNullOrEmpty(stringParam)
? Optional.<Boolean>absent()
: Optional.of(Boolean.valueOf(stringParam));
}
/**
* Returns {@code true} if parameter is present and not empty and not {@code "false"}.
*