mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
30 lines
849 B
Java
30 lines
849 B
Java
package com.github.mybatisplus.toolkit;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.LambdaUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
import org.apache.ibatis.reflection.property.PropertyNamer;
|
|
|
|
/**
|
|
* @author yulichang
|
|
* @see LambdaUtils
|
|
* @see PropertyNamer
|
|
*/
|
|
@SuppressWarnings("all")
|
|
public final class MyLambdaUtils {
|
|
|
|
|
|
public static <T> String getName(SFunction<T, ?> fn) {
|
|
return PropertyNamer.methodToProperty(LambdaUtils.resolve(fn).getImplMethodName());
|
|
}
|
|
|
|
public static <T> String getColumn(SFunction<T, ?> fn) {
|
|
return StringUtils.camelToUnderline(getName(fn));
|
|
}
|
|
|
|
public static <T> Class<T> getEntityClass(SFunction<T, ?> fn) {
|
|
return (Class<T>) LambdaUtils.resolve(fn).getInstantiatedType();
|
|
}
|
|
|
|
}
|