@Test(expected= org.societies.utilities.DBC.PreconditionException.class) public void testGetMethodParameterNamesMalFormed() { assertEquals(2, ServiceMethodTranslator.getMethodParameterNames(METHOD_1).length); }
public static String [] getMethodParameterNames(String methodName) { Dbc.require("A method must be specified", methodName != null && methodName.length() > 0); Dbc.require("A method must have " + ParameterStart + " and " + ParameterEnd + " characters", methodName.contains(ParameterStart) && methodName.contains(ParameterEnd)); List <String> paramNames = new ArrayList<String> (); int paramStart = methodName.indexOf(ParameterStart) + 1; int paramEnd = methodName.indexOf(ParameterEnd); if (paramStart == paramEnd) { return new String [0]; } else { String params = methodName.substring(paramStart, paramEnd); String paramArray [] = params.split(ParameterDelimiter); for (int i = 0; i < paramArray.length; i++) { String paramName = paramArray[i].trim(); paramNames.add(paramName.substring(paramName.indexOf(ParameterSeparator) + 1, paramName.length())); } return paramNames.toArray(new String [paramNames.size()]); } }
ServiceMethodTranslator { public static String [] getMethodParameterNames(String methodName) { Dbc.require("A method must be specified", methodName != null && methodName.length() > 0); Dbc.require("A method must have " + ParameterStart + " and " + ParameterEnd + " characters", methodName.contains(ParameterStart) && methodName.contains(ParameterEnd)); List <String> paramNames = new ArrayList<String> (); int paramStart = methodName.indexOf(ParameterStart) + 1; int paramEnd = methodName.indexOf(ParameterEnd); if (paramStart == paramEnd) { return new String [0]; } else { String params = methodName.substring(paramStart, paramEnd); String paramArray [] = params.split(ParameterDelimiter); for (int i = 0; i < paramArray.length; i++) { String paramName = paramArray[i].trim(); paramNames.add(paramName.substring(paramName.indexOf(ParameterSeparator) + 1, paramName.length())); } return paramNames.toArray(new String [paramNames.size()]); } } }
ServiceMethodTranslator { public static String [] getMethodParameterNames(String methodName) { Dbc.require("A method must be specified", methodName != null && methodName.length() > 0); Dbc.require("A method must have " + ParameterStart + " and " + ParameterEnd + " characters", methodName.contains(ParameterStart) && methodName.contains(ParameterEnd)); List <String> paramNames = new ArrayList<String> (); int paramStart = methodName.indexOf(ParameterStart) + 1; int paramEnd = methodName.indexOf(ParameterEnd); if (paramStart == paramEnd) { return new String [0]; } else { String params = methodName.substring(paramStart, paramEnd); String paramArray [] = params.split(ParameterDelimiter); for (int i = 0; i < paramArray.length; i++) { String paramName = paramArray[i].trim(); paramNames.add(paramName.substring(paramName.indexOf(ParameterSeparator) + 1, paramName.length())); } return paramNames.toArray(new String [paramNames.size()]); } }  }
ServiceMethodTranslator { public static String [] getMethodParameterNames(String methodName) { Dbc.require("A method must be specified", methodName != null && methodName.length() > 0); Dbc.require("A method must have " + ParameterStart + " and " + ParameterEnd + " characters", methodName.contains(ParameterStart) && methodName.contains(ParameterEnd)); List <String> paramNames = new ArrayList<String> (); int paramStart = methodName.indexOf(ParameterStart) + 1; int paramEnd = methodName.indexOf(ParameterEnd); if (paramStart == paramEnd) { return new String [0]; } else { String params = methodName.substring(paramStart, paramEnd); String paramArray [] = params.split(ParameterDelimiter); for (int i = 0; i < paramArray.length; i++) { String paramName = paramArray[i].trim(); paramNames.add(paramName.substring(paramName.indexOf(ParameterSeparator) + 1, paramName.length())); } return paramNames.toArray(new String [paramNames.size()]); } }  static int getMethodIndex(String [] methodsArray, String methodName); static String getMethodName(String [] methodsArray, int index); static String getMethodSignature(String [] methodsArray, int index); static int getParameterNumber(String methodName); static String getMethodParameterType(String methodName, int parameter); static String getMethodParameterTypeCapitalised(String methodName, int parameter); static String [] getMethodParameterTypesCapitalised(String methodName); static String [] getMethodParameterTypes(String methodName); static String getMethodParameterName(String methodName, int parameter); static String [] getMethodParameterNames(String methodName); static Class [] getParameterClasses(String methodName); }
ServiceMethodTranslator { public static String [] getMethodParameterNames(String methodName) { Dbc.require("A method must be specified", methodName != null && methodName.length() > 0); Dbc.require("A method must have " + ParameterStart + " and " + ParameterEnd + " characters", methodName.contains(ParameterStart) && methodName.contains(ParameterEnd)); List <String> paramNames = new ArrayList<String> (); int paramStart = methodName.indexOf(ParameterStart) + 1; int paramEnd = methodName.indexOf(ParameterEnd); if (paramStart == paramEnd) { return new String [0]; } else { String params = methodName.substring(paramStart, paramEnd); String paramArray [] = params.split(ParameterDelimiter); for (int i = 0; i < paramArray.length; i++) { String paramName = paramArray[i].trim(); paramNames.add(paramName.substring(paramName.indexOf(ParameterSeparator) + 1, paramName.length())); } return paramNames.toArray(new String [paramNames.size()]); } }  static int getMethodIndex(String [] methodsArray, String methodName); static String getMethodName(String [] methodsArray, int index); static String getMethodSignature(String [] methodsArray, int index); static int getParameterNumber(String methodName); static String getMethodParameterType(String methodName, int parameter); static String getMethodParameterTypeCapitalised(String methodName, int parameter); static String [] getMethodParameterTypesCapitalised(String methodName); static String [] getMethodParameterTypes(String methodName); static String getMethodParameterName(String methodName, int parameter); static String [] getMethodParameterNames(String methodName); static Class [] getParameterClasses(String methodName); static final String JAVA_LANG_PREFIX; static final String ANDROID_OS_PREFIX; static final String JAVA_PRIMITIVES; static final String JAVA_LANG_CLASSES; }