org.jboss.resteasy.util.IsHttpMethod Maven / Gradle / Ivy
package org.jboss.resteasy.util;
import javax.ws.rs.HttpMethod;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
/**
* @author Bill Burke
* @version $Revision: 1 $
*/
public class IsHttpMethod
{
public static Set getHttpMethods(Method method)
{
HashSet methods = new HashSet();
for (Annotation annotation : method.getAnnotations())
{
HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class);
if (http != null) methods.add(http.value());
}
if (methods.size() == 0) return null;
return methods;
}
}