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

com.ly.mybatis.mapperservice.table.lambda.LambdaUtil Maven / Gradle / Ivy

package com.ly.mybatis.mapperservice.table.lambda;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;

import java.lang.invoke.SerializedLambda;
import java.lang.reflect.Field;

@SuppressWarnings("unused")
public class LambdaUtil {
    private static final SerializedLambdaHolder SERIALIZED_LAMBDA_HOLDER = new SerializedLambdaHolder();

    private static final LambdaHolder LAMBDA_FIELD_HOLDER = new LambdaHolder();

    public static  String getFieldName(SFunction function) {
        return getField(function).getName();
    }

    public static  Field getField(SFunction function) {
        return getLambda(function).getImplField();
    }

    public static  Lambda getLambda(SFunction function) {
        return LAMBDA_FIELD_HOLDER.get(getSerializedLambda(function));
    }

    public static  SerializedLambda getSerializedLambda(SFunction function) {
        return SERIALIZED_LAMBDA_HOLDER.get(function);
    }

    public static  Class getClass(SFunction function) {
        return (Class) getLambda(function).getImplClass();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy