本文整理匯總了Java中org.aspectj.lang.JoinPoint.getTarget方法的典型用法代碼示例。如果您正苦於以下問題:Java JoinPoint.getTarget方法的具體用法?Java JoinPoint.getTarget怎麽用?Java JoinPoint.getTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.aspectj.lang.JoinPoint
的用法示例。
在下文中一共展示了JoinPoint.getTarget方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loggingAdvice
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
@After("allAppMethodswithin()")
// Try allAppMethodswithin
public void loggingAdvice(JoinPoint jp) {
System.out.println("JoinPoint -> " + jp.toString());
System.out.println("Target -> " + jp.getTarget());
if (jp.getTarget() instanceof StatementService) {
System.out
.println("logging code inserted after StatementService method execution");
} else if (jp.getTarget() instanceof PaymentService) {
System.out
.println("logging code inserted after PaymentService method execution");
}
}
示例2: onWebViewLoadUrl
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
@Before("call(* android.webkit.WebView+.loadUrl(..))")
public void onWebViewLoadUrl(JoinPoint joinPoint) {
if (!Configuration.httpMonitorEnable || !Configuration.webviewEnable) {
return;
}
try {
if (joinPoint.getTarget() instanceof WebView) {
WebView web = (WebView) joinPoint.getTarget();
synchronized (webviews) {
for (int i = webviews.size() - 1; i >= 0; i--) {
WebView item = webviews.get(i).get();
if (item == null) {
webviews.remove(i);
} else if (item.equals(web)) {
return;
}
}
webviews.add(new WeakReference<>(web));
}
web.setWebViewClient(ProbeWebClient.instance);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
示例3: updateTestCase
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
private void updateTestCase(final JoinPoint joinPoint) {
final MethodSignature signature = (MethodSignature) joinPoint.getSignature();
final Object[] args = joinPoint.getArgs();
final Object target = joinPoint.getTarget();
final Allure1Annotations annotations = new Allure1Annotations(target, signature, args);
getLifecycle().getCurrentTestCase().ifPresent(uuid -> {
getLifecycle().updateTestCase(uuid, annotations::updateTitle);
getLifecycle().updateTestCase(uuid, annotations::updateDescription);
getLifecycle().updateTestCase(uuid, annotations::updateParameters);
getLifecycle().updateTestCase(uuid, annotations::updateLabels);
getLifecycle().updateTestCase(uuid, annotations::updateLinks);
});
}
示例4: getLog
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
protected Logger getLog(final JoinPoint joinPoint) {
final Object target = joinPoint.getTarget();
if (target != null) {
return LoggerFactory.getLogger(target.getClass());
}
return LoggerFactory.getLogger(getClass());
}
示例5: checkStart
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
/**
* 判斷玩家準備是否要開始遊戲
*
* @param point 切點
*/
@After(value = "execution(* telemarketer.skittlealley.model.game.drawguess.DrawGuessContext.addPlayer(..))",
argNames = "point")
public void checkStart(JoinPoint point) {
DrawGuessContext ctx = (DrawGuessContext) point.getTarget();
service.checkStart(ctx);
}
示例6: checkStop
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
/**
* 判斷玩家退出是否終止遊戲
*
* @param point 切點
* @param info 退出玩家信息
*/
@AfterReturning(value = "execution(* telemarketer.skittlealley.model.game.drawguess.DrawGuessContext.removePlayer(..)) ",
returning = "info", argNames = "point,info")
public void checkStop(JoinPoint point, DrawPlayerInfo info) {
DrawGuessContext ctx = (DrawGuessContext) point.getTarget();
if (info == null) { // 並不在準備玩家中
// 如果需要所有未準備玩家退出時開始遊戲 可進行checkStart
return;
}
service.checkStop(ctx);
}
示例7: checkPause
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
/**
* 判斷玩家答對是否要停止這輪遊戲
*
* @param point 切點
* @param number 答對人數
*/
@AfterReturning(value = "execution(* telemarketer.skittlealley.model.game.drawguess.DrawGuessContext.incrRightNumber(..)) ",
returning = "number", argNames = "point,number")
public void checkPause(JoinPoint point, Integer number) {
DrawGuessContext ctx = (DrawGuessContext) point.getTarget();
service.checkPause(ctx, number);
}
示例8: onViewCreatedProcess
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
@After("onViewCreated()")
public void onViewCreatedProcess(JoinPoint joinPoint) throws Throwable {
Object puppet = joinPoint.getTarget();
//Only inject the class that marked by Puppet annotation.
Object[] args = joinPoint.getArgs();
Method onCreate = getRiggerMethod("onViewCreated", Object.class, View.class, Bundle.class);
onCreate.invoke(getRiggerInstance(), puppet, args[0], args[1]);
}
示例9: lkConstructor
import org.aspectj.lang.JoinPoint; //導入方法依賴的package包/類
@After("execution(net.lemonsoft.lemonkit.ui.view.LK*.new(..))")
public void lkConstructor(JoinPoint joinPoint) throws Throwable {
if (!(joinPoint.getTarget() instanceof LKUIView))
return;
Object[] args = joinPoint.getArgs();
LKUIExtensionModel model = new LKUIExtensionModel();
if (args.length >= 2)
model = LKUIAttrsParser.parse((View) joinPoint.getTarget(), (AttributeSet) args[1]);
lkPool.put(getLKKey(joinPoint), model);
applyLKComplete(model, (LKUIView) joinPoint.getTarget());
}