cn.schoolwow.util.domain.query.reflection.QueryReflectionResponse Maven / Gradle / Ivy
package cn.schoolwow.util.domain.query.reflection;
import cn.schoolwow.quickflow.QuickFlow;
import cn.schoolwow.quickflow.QuickFlowBuilder;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.util.module.query.reflection.domain.ReflectionOption;
import cn.schoolwow.util.module.query.reflection.service.GetClassFieldArrayFlow;
import cn.schoolwow.util.module.query.reflection.service.GetClassFieldFlow;
import java.lang.reflect.Field;
import java.util.List;
public class QueryReflectionResponse {
private static QuickFlow reflectionQuickFlow = QuickFlowBuilder.newInstance();
public QueryReflectionResponse(ReflectionOption reflectionOption) {
this.reflectionQuickFlow.putContextThreadLocalData("reflectionOption", reflectionOption);
}
/**获取字段列表*/
public List getFieldList(){
FlowContext flowContext = reflectionQuickFlow.executeFlow(new GetClassFieldArrayFlow());
List fieldList = (List) flowContext.getData("fieldList");
return fieldList;
}
/**获取指定字段*/
public Field getField(String fieldName){
FlowContext flowContext = reflectionQuickFlow.startFlow(new GetClassFieldFlow())
.putCurrentCompositeFlowData("fieldName", fieldName)
.execute();
Field field = (Field) flowContext.checkData("field");
return field;
}
}