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

cn.vonce.sql.uitls.LambdaUtil Maven / Gradle / Ivy

The newest version!
package cn.vonce.sql.uitls;

import cn.vonce.sql.bean.Column;
import cn.vonce.sql.define.ColumnFun;

import java.lang.invoke.SerializedLambda;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Lambda工具类
 *
 * @author Jovi
 * @email [email protected]
 * @date 2022/12/7 19:18
 */
public class LambdaUtil {

    /**
     * 获取列字段对象
     *
     * @param column
     * @param 
     * @param 
     * @return
     */
    public static  Column getColumn(ColumnFun column) {
        SerializedLambda lambda = null;
        try {
            Method method = column.getClass().getDeclaredMethod("writeReplace");
            method.setAccessible(Boolean.TRUE);
            lambda = (SerializedLambda) method.invoke(column);
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return SqlBeanUtil.getColumnByLambda(lambda);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy