com.github.bingoohuang.sqltrigger.ReflectUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sql-trigger Show documentation
Show all versions of sql-trigger Show documentation
delay queue based on redis
The newest version!
package com.github.bingoohuang.sqltrigger;
import lombok.SneakyThrows;
import lombok.val;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class ReflectUtil {
@SneakyThrows
public static Object invokeMethod(Method method, Object obj, Object... args) {
return method.invoke(obj, args);
}
@SneakyThrows
public static void setField(Field field, Object obj, Object value) {
if (!field.isAccessible()) field.setAccessible(true);
field.set(obj, value);
}
public static Field findField(Class> type, String fieldName) {
for (val field : type.getDeclaredFields()) {
if (field.getName().equals(fieldName)) return field;
}
return null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy