private void testGetAndSet() throws IllegalAccessException, InstantiationException, IntrospectionException,
            InvocationTargetException {
        Elasticsearch6SideTableInfo t = new Elasticsearch6SideTableInfo();
        Class modelClass = t.getClass();
        Object obj = modelClass.newInstance();
        Field[] fields = modelClass.getDeclaredFields();
        for (Field f : fields) {
            if (!f.getName().equals("CURR_TYPE")) {
                if (f.getName().equals("aLike")
                        || f.isSynthetic()) {
                    continue;
                }

                PropertyDescriptor pd = new PropertyDescriptor(f.getName(), modelClass);
                Method get = pd.getReadMethod();
                Method set = pd.getWriteMethod();
                set.invoke(obj, get.invoke(obj));
            }
        }
    }
Company: www.dtstack.com

@author zhufeng
@date 2020-07-02
elasticsearch6/elasticsearch6-side/elasticsearch6-side-core/src/test/java/com/dtstack/flink/sql/side/elasticsearch6/table/Elasticsearch6SideTableInfoTest.java