Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.github.linyimin0812.Bridge Maven / Gradle / Ivy
/*
* Copyright The Arthas Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.github.linyimin0812;
/**
* @author linyimin
**/
public class Bridge {
public static final AbstractBridge NOP_BRIDGE = new NopBridge();
private static AbstractBridge bridgeInstance = NOP_BRIDGE;
public static AbstractBridge getBridge() {
return bridgeInstance;
}
public static void setBridge(AbstractBridge bridge) {
bridgeInstance = bridge;
}
public static void atEnter(Class> clazz, Object target, String methodName, String methodDesc, Object[] args) {
bridgeInstance.atEnter(clazz, target, methodName, methodDesc, args);
}
public static void atExit(Class> clazz, Object target, String methodName, String methodDesc, Object[] args, Object returnObject) {
bridgeInstance.atExit(clazz, target, methodName, methodDesc, args, returnObject);
}
public static void atExceptionExit(Class> clazz, Object target, String methodName, String methodDesc, Object[] args, Throwable throwable) {
bridgeInstance.atExceptionExit(clazz, target, methodName, methodDesc, args, throwable);
}
public static abstract class AbstractBridge {
public abstract void atEnter(Class> clazz, Object target, String methodName, String methodDesc, Object[] args);
public abstract void atExit(Class> clazz, Object target, String methodName, String methodDesc, Object[] args, Object returnObject);
public abstract void atExceptionExit(Class> clazz, Object target, String methodName, String methodDesc, Object[] args, Throwable throwable);
}
static class NopBridge extends AbstractBridge {
@Override
public void atEnter(Class> clazz, Object target, String methodName, String methodDesc, Object[] args) {
// NopBridge do not need to do anything
}
@Override
public void atExit(Class> clazz, Object target, String methodName, String methodDesc, Object[] args, Object returnObject) {
// NopBridge do not need to do anything
}
@Override
public void atExceptionExit(Class> clazz, Object target, String methodName, String methodDesc, Object[] args, Throwable throwable) {
// NopBridge do not need to do anything
}
}
}