百戰(zhàn)大數(shù)據(jù)開發(fā)2022
? ?private static Map<SerializableFunction<?, ?>, Field> cache = new ConcurrentHashMap<>();
? ?public static <T, R> String getFieldName(SerializableFunction<T, R> function) {
? ? ? ?Field field = ReflectionTool.getField(function);
? ? ? ?return field.getName();
? ?}
? ?public static <T, R> Field getField(SerializableFunction<T, R> function) {
? ? ? ?return cache.computeIfAbsent(function, ReflectionTool::findField);
? ?}
標(biāo)簽: