private String getRestMethod(JMethod method) throws UnableToCompleteException { String restMethod = null; if (method.getAnnotation(DELETE.class) != null) { restMethod = METHOD_DELETE; } else if (method.getAnnotation(GET.class) != null) { restMethod = METHOD_GET; } else if (method.getAnnotation(HEAD.class) != null) { restMethod = METHOD_HEAD; } else if (method.getAnnotation(OPTIONS.class) != null) { restMethod = METHOD_OPTIONS; } else if (method.getAnnotation(POST.class) != null) { restMethod = METHOD_POST; } else if (method.getAnnotation(PUT.class) != null) { restMethod = METHOD_PUT; } else if (method.getAnnotation(JSONP.class) != null) { restMethod = METHOD_JSONP; } else { restMethod = method.getName(); if (!REST_METHODS.contains(restMethod)) { getLogger() .log( ERROR, "Invalid rest method. It must either have a lower case rest method name or have a javax rs method annotation: " + method.getReadableDeclaration()); throw new UnableToCompleteException(); } } return restMethod; }
static { REST_METHODS.add(METHOD_DELETE); REST_METHODS.add(METHOD_GET); REST_METHODS.add(METHOD_HEAD); REST_METHODS.add(METHOD_OPTIONS); REST_METHODS.add(METHOD_POST); REST_METHODS.add(METHOD_PUT); REST_METHODS.add(METHOD_JSONP); }