Methods Summary |
---|
public java.lang.String | getName(java.lang.String signature)This method will return the method name from the signature String passed
as argument.
eg: for java.lana.String nickName( java.lang.String, int )
StringBuilder sb = new StringBuilder();
String[] tokens = (signature.split("\\s"));
for (int i = 1; i < tokens.length; i++)
sb.append(tokens[i]);
String name = sb.toString();
name = name.substring(0, name.indexOf("("));
return name;
|
public java.lang.Class[] | getParamTypeClass(java.lang.String[] par, java.lang.ClassLoader cl)given a parameter array contained in a method, this method returns the
Class array representation of the parameters
List<Class> list = new ArrayList<Class>();
for(String s : par) {
Class c = checkIfPrimitive(s);
if (c != null)
list.add(c);
else {
try {
c = Class.forName(s, false, cl);
list.add(c);
} catch (ClassNotFoundException e) {
//do nothing. Other test will report the problem if parameter
// is not specified correctly
}
}
}
return list.toArray(new Class[0]);
|
public java.lang.String[] | getParameters(java.lang.String signature)This method parses the function-signature argument and returns the list of
parameters as String array.
signature param to this method contains the value of this element in tld.
java.lana.String nickName( java.lang.String, int )
StringBuilder sb = new StringBuilder();
String[] tokens = (signature.split("\\s"));
for (int i = 1; i < tokens.length; i++)
sb.append(tokens[i]);
String fullParamString = sb.toString().substring(sb.indexOf("(") + 1, sb.indexOf(")"));
String[] params = getParams(fullParamString);
return params;
|
public java.lang.String[] | getParams(java.lang.String fullParamString)
List<String> list = new ArrayList<String>();
if (fullParamString.contains(",")) {
String rest = fullParamString.substring(fullParamString.indexOf(",") + 1, fullParamString.length());
fullParamString = fullParamString.substring(0, fullParamString.indexOf(","));
list.add(fullParamString);
getParams(rest);
} else list.add(fullParamString);
return list.toArray(new String[0]);
|
public java.lang.String | getRetType(java.lang.String signature)This method returns the first token of this string, which must be the return
type of the method.
String[] tokens = (signature.split("\\s"));
return tokens[0];
|
public boolean | parametersMatch(java.lang.reflect.Method m, java.lang.Class[] param)Checks if the parameter array matches with this method's parameters
boolean match = false;
Class[] types = m.getParameterTypes();
if (types.length!=param.length)
return false;
for (int i=0; i<types.length; i++) {
match = types[i].equals(param[i]);
}
return match;
|
public boolean | returnTypeMatch(java.lang.reflect.Method m, java.lang.String retType)Checks if the return type specified in this method m and the return type
required matches
Class ret = m.getReturnType();
Class retTypeClass = checkIfPrimitive(retType);
if (retTypeClass == null);
try {
retTypeClass = Class.forName(retType);
} catch (ClassNotFoundException e) {
//do nothing. If return type is incorrect, it will be caught by
// another test in verifier.
}
if(retTypeClass != null) //this may happen if retType is
return retTypeClass.equals(ret);//non-primitive and invalid
else return false;
|