/** * Extracts parameters from a method call and attaches these with the comments extracted from the * javadoc * * @param apiAction The Verb of the action containing these parametes * @param method The method to inspect * @param parameterComments The parameter comments associated with these parameters * @return A collection of parameters keyed by name */ protected Map<String, RamlQueryParameter> extractQueryParameters( RamlActionType apiAction, Method method, Map<String, String> parameterComments) { // Since POST requests have a body we choose to keep all request data in one place as much as // possible if (apiAction.equals(RamlActionType.POST) || method.getParameterCount() == 0) { return Collections.emptyMap(); } Map<String, RamlQueryParameter> queryParams = new LinkedHashMap<>(); for (Parameter param : method.getParameters()) { if (isQueryParameter( param)) { // Lets skip resourceIds since these are going to be going in the URL RamlParamType simpleType = SchemaHelper.mapSimpleType(param.getType()); if (simpleType == null) { queryParams.putAll( SchemaHelper.convertClassToQueryParameters( param, javaDocs.getJavaDoc(param.getType()))); } else { // Check if we have comments String paramComment = parameterComments.get(param.getName()); queryParams.putAll(SchemaHelper.convertParameterToQueryParameter(param, paramComment)); } } } return queryParams; }
/** * Method to check if a specific action type supports multipart mime request * * @param target The target Verb to check * @return If true, the verb supports multipart mime request */ public static boolean doesActionTypeSupportMultipartMime(RamlActionType target) { return target.equals(RamlActionType.POST); }
/** * Method to check if a specific action type supports payloads in the body of the request * * @param target The target Verb to check * @return If true, the verb supports a payload in the request body */ public static boolean doesActionTypeSupportRequestBody(RamlActionType target) { return target.equals(RamlActionType.POST) || target.equals(RamlActionType.PUT); }