Source:
<code>private void parseMethodAnnotations() { for (Annotation methodAnnotation : method.getAnnotations()) { Class<? extends Annotation> annotationType = methodAnnotation.annotationType(); RestMethod methodInfo = null; for (Annotation innerAnnotation : annotationType.getAnnotations()) { if (RestMethod.class == innerAnnotation.annotationType()) { methodInfo = (RestMethod) innerAnnotation; break; } } if (methodInfo != null) { if (restMethod != null) { throw new IllegalArgumentException("Method contains multiple HTTP annotations."); } try { path = (String) annotationType.getMethod("value").invoke(methodAnnotation); } catch (Exception e) { throw new RuntimeException("Failed to extract URI path.", e); } pathParams = parsePathParameters(path); restMethod = methodInfo; } else if (annotationType == QueryParams.class) { if (pathQueryParams != null) { throw new IllegalStateException( "QueryParam and QueryParams annotations are mutually exclusive."); } pathQueryParams = ((QueryParams) methodAnnotation).value(); if (pathQueryParams.length == 0) { throw new IllegalStateException("QueryParams annotation was empty."); } } else if (annotationType == QueryParam.class) { if (pathQueryParams != null) { throw new IllegalStateException( "QueryParam and QueryParams annotations are mutually exclusive."); } pathQueryParams = new QueryParam[] { (QueryParam) methodAnnotation }; } } if (restMethod == null) { throw new IllegalStateException( <START> "Method not annotated with GET, POST, PUT, or DELETE: " + method); <END> } if (pathQueryParams == null) { pathQueryParams = new QueryParam[0]; } }</code><technical_language>HEAD</technical_language>

Target:
private void parseMethodAnnotations() { for (Annotation methodAnnotation : method.getAnnotations()) { Class<? extends Annotation> annotationType = methodAnnotation.annotationType(); RestMethod methodInfo = null; for (Annotation innerAnnotation : annotationType.getAnnotations()) { if (RestMethod.class == innerAnnotation.annotationType()) { methodInfo = (RestMethod) innerAnnotation; break; } } if (methodInfo != null) { if (restMethod != null) { throw new IllegalArgumentException("Method contains multiple HTTP annotations."); } try { path = (String) annotationType.getMethod("value").invoke(methodAnnotation); } catch (Exception e) { throw new RuntimeException("Failed to extract URI path.", e); } if (!path.startsWith("/")) { throw new IllegalArgumentException("URL path must be prefixed with '/'."); } pathParams = parsePathParameters(path); restMethod = methodInfo; } else if (annotationType == QueryParams.class) { if (pathQueryParams != null) { throw new IllegalStateException( "QueryParam and QueryParams annotations are mutually exclusive."); } pathQueryParams = ((QueryParams) methodAnnotation).value(); if (pathQueryParams.length == 0) { throw new IllegalStateException("QueryParams annotation was empty."); } } else if (annotationType == QueryParam.class) { if (pathQueryParams != null) { throw new IllegalStateException( "QueryParam and QueryParams annotations are mutually exclusive."); } pathQueryParams = new QueryParam[] { (QueryParam) methodAnnotation }; } else if (annotationType == Multipart.class) { isMultipart = true; } } if (restMethod == null) { throw new IllegalStateException( "Method " + method + " not annotated with request type (e.g., GET, POST)."); } if (!restMethod.hasBody() && isMultipart) { throw new IllegalStateException( "Multipart can only be specific on HTTP methods with request body (e.g., POST)."); } if (pathQueryParams == null) { pathQueryParams = new QueryParam[0]; } }