private void processVerb(Method method) { verb = new HttpVerbResolver(logger).resolve(method.getElement()); }
void processMethod(Method method) { processElement(method.getElement()); processVerb(method); processResult(method); createVariables(method); }
private void resolveRestActionResult(Method method) { List<Type> typeArguments = method.getReturnType().getTypeArguments(); if (typeArguments.size() == 1) { resultType = typeArguments.get(0); } else { ExecutableElement element = method.getElement(); logger.error().context(element).log(BAD_REST_ACTION, NameUtils.qualifiedMethodName(element)); throw new UnableToProcessException(); } }
private void resolveVariable(Method method, Variable variable) { HttpVariable httpVariable = new HttpVariable(logger, utils, getPath(), variable); if (body.isPresent() && httpVariable.isBody()) { ExecutableElement methodElement = method.getElement(); logger.error() .context(methodElement) .log(MANY_POTENTIAL_BODY, NameUtils.qualifiedMethodName(methodElement)); throw new UnableToProcessException(); } if (httpVariable.isBody()) { body = Optional.of(httpVariable); } else { httpVariables.add(httpVariable); } }
private void logPotentialErrors(Method method) { ExecutableElement methodElement = method.getElement(); String methodName = NameUtils.qualifiedMethodName(methodElement); boolean containsFormVariables = containsFormVariables(); boolean containsBody = body.isPresent(); if (containsBody && containsFormVariables) { logger.error().context(methodElement).log(FORM_AND_BODY_PARAM, methodName); throw new UnableToProcessException(); } if ((verb == HttpVerb.GET || verb == HttpVerb.HEAD) && (containsBody || containsFormVariables)) { logger.error().context(methodElement).log(GET_WITH_BODY, methodName); throw new UnableToProcessException(); } }