本文整理汇总了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());
}