public static String getHttpMethod(Annotation[] annotations, boolean allowNull) throws InvalidRestMethod
{
String httpMethod = null;
for (Annotation annotation : annotations)
{
HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class);
if (http != null)
{
if (httpMethod != null)
{
throw new InvalidRestMethod("Crux REST methods can not be bound to more than one HTTP Method");
}
httpMethod = http.value();
}
}
if (!allowNull && httpMethod == null)
{
throw new InvalidRestMethod("Crux REST methods must be bound to one HTTP Method");