All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.schoolwow.util.domain.query.reflection.QueryReflectionResponse Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy