private static List <SpringMvcParameter> getAutoWiredJavaObjects(method methodToMap) { var springMvcParamters = new List <SpringMvcParameter>(); if (methodToMap.parameterAnnotation != null) { foreach (var parameterAnnotation in methodToMap.parameterAnnotation) { var springMvcParameter = new SpringMvcParameter(); switch (parameterAnnotation.typeName) { case "org.springframework.web.bind.annotation.RequestParam": case "org.springframework.web.bind.annotation.ModelAttribute": case "org.springframework.web.bind.annotation.PathVariable": springMvcParameter.autoWiredMethodUsed = parameterAnnotation.typeName.Replace("org.springframework.web.bind.annotation.", ""); if (parameterAnnotation.member != null) { springMvcParameter.name = decodeString(parameterAnnotation.member.memberValue).Replace("\"", ""); } break; default: if (parameterAnnotation.typeName != null) { springMvcParameter.autoWiredMethodUsed = parameterAnnotation.typeName; } break; } springMvcParamters.Add(springMvcParameter); } } return(springMvcParamters); }
public static TreeNode getTreeNodeWithAutoWiredObject(ICirData cirData, string targetFunction, SpringMvcParameter springMvcParameter, int parameterIndex) { try { if (cirData != null && cirData.dFunctions_bySignature.ContainsKey(targetFunction)) { var cirFunction = cirData.dFunctions_bySignature[targetFunction]; if (cirFunction.FunctionParameters.Count <= parameterIndex) { var filteredSignature = new O2.DotNetWrappers.Filters.FilteredSignature(targetFunction); if (filteredSignature.lsParameters_Parsed.Count > parameterIndex) { springMvcParameter.className = filteredSignature.lsParameters_Parsed[parameterIndex]; } else { DI.log.error("in getTreeNodeWithAutoWiredObject, requested parameter index not found in function: {0}", targetFunction); } } else { var functionParameter = cirFunction.FunctionParameters[parameterIndex]; springMvcParameter.className = functionParameter.ParameterType.Replace("&", ""); } if (springMvcParameter.className != "") { // Hack to handle int Java mappings if (springMvcParameter.className == "int") { springMvcParameter.className = "java.lang.Integer"; } if (cirData.dClasses_bySignature.ContainsKey(springMvcParameter.className)) { var childNodeText = string.Format("{0} - {1} - {2}", springMvcParameter.autoWiredMethodUsed, springMvcParameter.name, springMvcParameter.className); return(O2Forms.newTreeNode(childNodeText, childNodeText, 0, cirData.dClasses_bySignature[springMvcParameter.className])); } DI.log.error("in getTreeNodeWithAutoWiredObject, parameter type not found in cirData class list:{0}", springMvcParameter.className); } } else { DI.log.error("in getTreeNodeWithAutoWiredObject, loaded cirData did not contained signature :{0}", targetFunction); } } catch (Exception ex) { DI.log.error("in getTreeNodeWithAutoWiredObject:", ex.Message); } return(new TreeNode()); }