package com.nantian.cloud.dbcapp.tool;

import com.nantian.cloud.dbcapp.carbon.domain.carbonAccount.InstrumentDetailVo;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class ReflectionUtils {

    public static List<HeaderAliasVo> getHeaderAliasVoList(Class<?> clazz) {
        List<HeaderAliasVo> result = new ArrayList<>();
        Field[] fields = clazz.getDeclaredFields();
        for (Field field : fields) {
            ExcelAnnotation annotation = field.getAnnotation(ExcelAnnotation.class);
            if (annotation != null) {
                HeaderAliasVo headerAliasVo = new HeaderAliasVo(field.getName(),annotation.value());
                result.add(headerAliasVo);
            }
        }
        return result;
    }

}
