com.google.gag.annotation.remark.OhNoYouDidnt Java Examples

The following examples show how to use com.google.gag.annotation.remark.OhNoYouDidnt. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CharsetExtractor.java    From riptide with MIT License 5 votes vote down vote up
@ThisWouldBeOneLineIn(
        language = "Spring 4.3+",
        toWit = "type.getCharset()")
@OhNoYouDidnt
public Optional<Charset> getCharset(final MediaType type) {
    return Optional.ofNullable(type.getParameter("charset"))
            .map(quotes::trimFrom)
            .map(Charset::forName);
}
 
Example #2
Source File: ExampleRestController.java    From problem-spring-web with MIT License 5 votes vote down vote up
@RequestMapping(path = "/handler-invalid-param", method = POST)
public void validRequestParam(@RequestBody final UserRequest user) {
    @Hack("I couldn't make Spring throw this implicitly using annotations...")
    @Facepalm
    @OhNoYouDidnt
    final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
    final Set<ConstraintViolation<UserRequest>> violations = validator.validate(user);
    throw new ConstraintViolationException(violations);
}
 
Example #3
Source File: ExampleRestController.java    From problem-spring-web with MIT License 5 votes vote down vote up
@RequestMapping(path = "/handler-invalid-param", method = POST)
public void validRequestParam(@RequestBody final UserRequest user) {
    @Hack("I couldn't make Spring throw this implicitly using annotations...")
    @Facepalm
    @OhNoYouDidnt
    final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
    final Set<ConstraintViolation<UserRequest>> violations = validator.validate(user);
    throw new ConstraintViolationException(violations);
}
 
Example #4
Source File: AbstractThrowableProblem.java    From problem with MIT License 3 votes vote down vote up
/**
 * This is required to workaround missing support for {@link com.fasterxml.jackson.annotation.JsonAnySetter} on
 * constructors annotated with {@link com.fasterxml.jackson.annotation.JsonCreator}.
 *
 * @param key   the custom key
 * @param value the custom value
 * @see <a href="https://github.com/FasterXML/jackson-databind/issues/562">Jackson Issue 562</a>
 */
@API(status = INTERNAL)
@Hack
@OhNoYouDidnt
void set(final String key, final Object value) {
    parameters.put(key, value);
}