| | |
| | | package com.ruoyi.quartz.util; |
| | | |
| | | import cn.hutool.core.lang.Validator; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.quartz.domain.SysJob; |
| | |
| | | throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, |
| | | InvocationTargetException |
| | | { |
| | | if (Validator.isNotNull(methodParams) && methodParams.size() > 0) |
| | | if (StringUtils.isNotNull(methodParams) && methodParams.size() > 0) |
| | | { |
| | | Method method = bean.getClass().getDeclaredMethod(methodName, getMethodParamsType(methodParams)); |
| | | method.invoke(bean, getMethodParamsValue(methodParams)); |
| | |
| | | */ |
| | | public static boolean isValidClassName(String invokeTarget) |
| | | { |
| | | return StringUtils.count(invokeTarget, ".") > 1; |
| | | return StringUtils.countMatches(invokeTarget, ".") > 1; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static String getBeanName(String invokeTarget) |
| | | { |
| | | String beanName = StringUtils.subBefore(invokeTarget, "(",false); |
| | | return StringUtils.subBefore(beanName, ".",true); |
| | | String beanName = StringUtils.substringBefore(invokeTarget, "("); |
| | | return StringUtils.substringBefore(beanName, "."); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static String getMethodName(String invokeTarget) |
| | | { |
| | | String methodName = StringUtils.subBefore(invokeTarget, "(",false); |
| | | return StringUtils.subAfter(methodName, ".",true); |
| | | String methodName = StringUtils.substringBefore(invokeTarget, "("); |
| | | return StringUtils.substringBefore(methodName, "."); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static List<Object[]> getMethodParams(String invokeTarget) |
| | | { |
| | | String methodStr = StringUtils.subBetween(invokeTarget, "(", ")"); |
| | | String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); |
| | | if (StringUtils.isEmpty(methodStr)) |
| | | { |
| | | return null; |