public static void ExceptionHandle(Invocation ai, Throwable e) throws Exception { Method method = CustomPlugin.getExceptionsMap().get(e.getClass()); if (method == null) { resolve(ai, e); } else { method.invoke( Modifier.isStatic(method.getModifiers()) ? null : method.getDeclaringClass().newInstance(), resolveParameters(method.getParameterTypes(), ai, e)); } }
public static void Inject(Object obj, Class clz) { Map<Field, Object> injectObjs = CustomPlugin.getInjectObjs().get(clz); injectObjs.forEach( (key, value) -> { try { Object fieldValue = key.get(obj); if (fieldValue == null) { key.set(obj, value); } else if (!fieldValue.getClass().getName().contains("EnhancerByCGLIB")) { key.set(obj, CustomInterceptor.Proxy(fieldValue)); } } catch (IllegalAccessException e) { LOGGER.error("Inject error in Class [" + clz.getName() + "]"); e.printStackTrace(); } }); }
static { pluginMap = CustomPlugin.getCustoms(); }