Here you can find the source of invokeStaticClass(Class> staticClass, String methodName, Object[] args, Class... parameterTypes)
public static Object invokeStaticClass(Class<?> staticClass, String methodName, Object[] args, Class... parameterTypes)
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Main { private static Logger log = LoggerFactory.getLogger("org.featureflags.Utils"); public static Object invokeStaticClass(Class<?> staticClass, String methodName, Object[] args, Class... parameterTypes) { Method method = null;/*from w w w . ja v a 2 s .com*/ try { method = staticClass.getMethod(methodName, parameterTypes); } catch (SecurityException e) { log.error("Can't get method " + methodName, e); return null; } catch (NoSuchMethodException e) { log.error("Can't get method " + methodName, e); return null; } try { return method.invoke(null, args); } catch (IllegalArgumentException e) { log.error("Can't call method " + methodName, e); } catch (IllegalAccessException e) { log.error("Can't call method " + methodName, e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof IllegalArgumentException) { log.info("Flag does not exist " + args[0]); } else { log.error("Can't call method " + methodName, e); } } return null; } }