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

com.github.hippoom.tdb.reflection.MethodInvoker Maven / Gradle / Ivy

There is a newer version: 0.5.0
Show newest version
package com.github.hippoom.tdb.reflection;

import lombok.SneakyThrows;

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

public class MethodInvoker {

    @SneakyThrows
    public static  T invoke(Object target, String methodName, Object... args) {
        Method method = target.getClass().getDeclaredMethod(methodName);
        method.setAccessible(true);
        //noinspection JavaReflectionInvocation,unchecked
        return (T) method.invoke(target, args);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy