cn.schoolwow.util.module.query.instance.service.GetInstanceFieldArrayFlow Maven / Gradle / Ivy
The newest version!
package cn.schoolwow.util.module.query.instance.service;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.util.module.query.instance.domain.InstanceQueryOption;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GetInstanceFieldArrayFlow implements BusinessFlow {
public void executeBusinessFlow(FlowContext flowContext) throws Exception {
InstanceQueryOption instanceQueryOption = (InstanceQueryOption) flowContext.checkData("instanceQueryOption");
Class clazz = instanceQueryOption.instance.getClass();
List fieldList = new ArrayList<>();
while(null!=clazz){
Field[] fields = clazz.getDeclaredFields();
Field.setAccessible(fields, true);
fieldList.addAll(Arrays.asList(fields));
clazz = clazz.getSuperclass();
}
flowContext.putTemporaryData("fieldList", fieldList);
}
public String name() {
return "获取实例所有字段";
}
}