added getCommaListString method
This commit is contained in:
@ -144,4 +144,19 @@ public abstract class StringUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> String getCommaListString(Class<T> clazz, T[] typeArray, String methodName) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||||
|
String returnValue = "";
|
||||||
|
Method method = clazz.getMethod(methodName);
|
||||||
|
|
||||||
|
for (T currentProject : typeArray) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
String value = (String) method.invoke(currentProject) + ",";
|
||||||
|
returnValue += value;
|
||||||
|
}
|
||||||
|
if (returnValue.endsWith(",")) {
|
||||||
|
returnValue = returnValue.substring(0, returnValue.length() - 1);
|
||||||
|
}
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user