// 列名信息
private String headerDataKey;
// 导出EXCEL的头信息
private String header;
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public String getHeaderDataKey() {
return headerDataKey;
}
public void setHeaderDataKey(String headerDataKey) {
this.headerDataKey = headerDataKey;
}
/**
* 将方法名转换为需要的方法对象
*
* @param className
* class名
* @param methodNames
* 方法名
* @return 方法对象集合
* @throws Exception
*/
@SuppressWarnings("rawtypes")
private List<Method> getMethods(String className, String methodNames)
throws Exception {
if (StringUtils.isBlank(methodNames)) {
return null;
}
List<Method> needMethods = new ArrayList<Method>();
// 获得Class对象
Class c = Class.forName(className);
// 该对象的所有方法
Method[] methods = c.getMethods();
// 传入的方法名
String[] names = methodNames.split(",");
for (int i = 0; i < names.length; i++) {
for (Method method : methods) {
if (method.getName().equalsIgnoreCase("get" + names[i])) {
// 获得和方法名对应的方法对象
needMethods.add(method);
continue;
}
}
}
return needMethods;
}
private String headerDataKey;
// 导出EXCEL的头信息
private String header;
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public String getHeaderDataKey() {
return headerDataKey;
}
public void setHeaderDataKey(String headerDataKey) {
this.headerDataKey = headerDataKey;
}
/**
* 将方法名转换为需要的方法对象
*
* @param className
* class名
* @param methodNames
* 方法名
* @return 方法对象集合
* @throws Exception
*/
@SuppressWarnings("rawtypes")
private List<Method> getMethods(String className, String methodNames)
throws Exception {
if (StringUtils.isBlank(methodNames)) {
return null;
}
List<Method> needMethods = new ArrayList<Method>();
// 获得Class对象
Class c = Class.forName(className);
// 该对象的所有方法
Method[] methods = c.getMethods();
// 传入的方法名
String[] names = methodNames.split(",");
for (int i = 0; i < names.length; i++) {
for (Method method : methods) {
if (method.getName().equalsIgnoreCase("get" + names[i])) {
// 获得和方法名对应的方法对象
needMethods.add(method);
continue;
}
}
}
return needMethods;
}
22万+

被折叠的 条评论
为什么被折叠?



