/** * Same as {@link #fromString(String)}, but throws if there is no corresponding verb. * * @param httpMethod the method to pair * @return the corresponding http verb * @throws NoSuchElementException if there is no corresponding verb */ public static HttpVerb fromStringUnchecked(String httpMethod) { Optional<HttpVerb> verb = fromString(httpMethod); if (verb.isPresent()) return verb.get(); throw new NoSuchElementException(String.format("invalid http method: %s", httpMethod)); } }
/** * Same as {@link #fromString(String)}, but throws if there is no corresponding verb. * * @param httpMethod the method to pair * @return the corresponding http verb * @throws NoSuchElementException if there is no corresponding verb */ public static HttpVerb fromStringUnchecked(String httpMethod) { Optional<HttpVerb> verb = fromString(httpMethod); if (verb.isPresent()) return verb.get(); throw new NoSuchElementException(String.format("invalid http method: %s", httpMethod)); } }