本文整理了Java中org.aspectj.lang.Signature.toShortString()
方法的一些代码示例,展示了Signature.toShortString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature.toShortString()
方法的具体详情如下:
包路径:org.aspectj.lang.Signature
类名称:Signature
方法名:toShortString
[英]Returns an abbreviated string representation of this signature.
[中]返回此签名的缩写字符串表示形式。
代码示例来源:origin: spring-projects/spring-framework
@Override
public String toShortString() {
return "execution(" + getSignature().toShortString() + ")";
}
代码示例来源:origin: changmingxie/tcc-transaction
public String toShortString() {
return "execution(" + getSignature().toShortString() + ")";
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
// makeEncSJP, although meant for computing the enclosing join point,
// it serves our purpose here
JoinPoint.StaticPart aspectJVersionJp = Factory.makeEncSJP(method);
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
assertEquals(aspectJVersionJp.getSignature().toLongString(), jp.getSignature().toLongString());
assertEquals(aspectJVersionJp.getSignature().toShortString(), jp.getSignature().toShortString());
assertEquals(aspectJVersionJp.getSignature().toString(), jp.getSignature().toString());
assertEquals(aspectJVersionJp.toLongString(), jp.toLongString());
assertEquals(aspectJVersionJp.toShortString(), jp.toShortString());
assertEquals(aspectJVersionJp.toString(), jp.toString());
}
});
代码示例来源:origin: lerry903/RuoYi
private String getMethodName(ProceedingJoinPoint joinPoint) {
String methodName = joinPoint.getSignature().toShortString();
String shortMethodNameSuffix = "(..)";
if (methodName.endsWith(shortMethodNameSuffix)) {
methodName = methodName.substring(0, methodName.length() - shortMethodNameSuffix.length());
}
return methodName;
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public String toShortString() {
return "execution(" + getSignature().toShortString() + ")";
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop
@Override
public String toShortString() {
return "execution(" + getSignature().toShortString() + ")";
}
代码示例来源:origin: com.isotrol.impe3/impe3-pms-core
@Around("@within(org.springframework.stereotype.Service)")
public Object time(ProceedingJoinPoint pjp) throws Throwable {
final Stopwatch w = Stopwatch.createStarted();
try {
return pjp.proceed();
}
finally {
final long t = w.elapsed(TimeUnit.MILLISECONDS);
final String key = pjp.getTarget().getClass().getName() + "." + pjp.getSignature().toShortString();
map.add(key, t);
if (t > 500) {
logger.warn(String.format("[%s] took [%d] ms", key, t));
}
}
}
代码示例来源:origin: vihuela/RAD
private Object logMethod(final ProceedingJoinPoint joinPoint) throws Throwable {
Object result = joinPoint.proceed();
from = joinPoint.getSignature().toShortString();
argMessage = " Args : " + (joinPoint.getArgs() != null ? Arrays.deepToString(joinPoint.getArgs()) : "");
String type = ((MethodSignature) joinPoint.getSignature()).getReturnType().toString();
resMessage = " ,Result : " + ("void".equalsIgnoreCase(type) ? "void" : result);
AspectUtil.print(joinPoint, from + "\n" + argMessage + resMessage);
return result;
}
}
代码示例来源:origin: net.anotheria/moskito-aop
/**
* Do tagging for @TagReturnValue.
*/
@Around(value = "execution(* *(..)) && (@annotation(tagReturnValue))")
public Object doTagging(ProceedingJoinPoint pjp, TagReturnValue tagReturnValue) throws Throwable {
Object result = pjp.proceed();
MoSKitoContext.addTag(tagReturnValue.name(), result == null ? null : result.toString(), TagType.ANNOTATED, pjp.getSignature().toShortString());
return result;
}
代码示例来源:origin: yongshun/some_java_code
@AfterThrowing(pointcut = "pointcut()", throwing = "exception")
public void logMethodInvokeException(JoinPoint joinPoint, Exception exception) {
logger.info("---method {} invoke exception: {}---", joinPoint.getSignature().toShortString(), exception.getMessage());
}
}
代码示例来源:origin: yongshun/some_java_code
@Before("pointcut()")
public void logMethodInvokeParam(JoinPoint joinPoint) {
logger.info("---Before method {} invoke, param: {}---", joinPoint.getSignature().toShortString(), joinPoint.getArgs());
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
@SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"})
protected Object aroundInvoke(ProceedingJoinPoint ctx) throws Throwable {
StopWatch stopWatch = new Slf4JStopWatch(ctx.getSignature().toShortString());
try {
stopWatch.start();
Object res = ctx.proceed();
return res;
} finally {
stopWatch.stop();
}
}
}
代码示例来源:origin: yongshun/some_java_code
@AfterReturning(pointcut = "pointcut()", returning = "retVal")
public void logMethodInvokeResult(JoinPoint joinPoint, Object retVal) {
logger.info("---After method {} invoke, result: {}---", joinPoint.getSignature().toShortString(), joinPoint.getArgs());
}
代码示例来源:origin: ustcwudi/springboot-seed
/**
* Monitor whether exception is thrown in service layer. If exception
* has been thrown, in order to detecting it conveniently, log the
* situation where it happened. Then create a server internal error
* exception and throw it out.
*/
@AfterThrowing(pointcut = "com.wind.monitor.ServiceMonitor.serviceLayer()", throwing = "e")
public void monitorException(JoinPoint joinPoint, Throwable e) {
// Log the situation where exception happened
Object[] args = joinPoint.getArgs();
Signature signature = joinPoint.getSignature();
log.error("[" + signature.toShortString() + "]" + Arrays.toString(args) + "[" + e.toString() + "]");
// Throw a new server internal error exception
throw new ServerInternalErrorException(e.getMessage(), e);
}
代码示例来源:origin: yongshun/some_java_code
@Around("pointcut()")
public Object methodInvokeExpiredTime(ProceedingJoinPoint pjp) throws Throwable {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
// 开始
Object retVal = pjp.proceed();
stopWatch.stop();
// 结束
// 上报到公司监控平台
reportToMonitorSystem(pjp.getSignature().toShortString(), stopWatch.getTotalTimeMillis());
return retVal;
}
代码示例来源:origin: OpenNMS/opennms
@Around("@within(profile) || @annotation(profile)")
public Object logAroundByMethod(ProceedingJoinPoint joinPoint, Profile profile) throws Throwable {
Timer timer = new Timer();
try {
timer.start();
return joinPoint.proceed();
} finally {
log(joinPoint.getKind(), joinPoint.getSignature().toShortString(), timer.stop());
}
}
代码示例来源:origin: ShawnyXiao/SpringBoot-MyBatis
/**
* Monitor whether exception is thrown in service layer. If exception
* has been thrown, in order to detecting it conveniently, log the
* situation where it happened. Then create a server internal error
* exception and throw it out.
*/
@AfterThrowing(pointcut = "com.shawn.monitor.ServiceMonitor.serviceLayer()", throwing = "e")
public void monitorException(JoinPoint joinPoint, Throwable e) {
// Log the situation where exception happened
Object[] args = joinPoint.getArgs();
Signature signature = joinPoint.getSignature();
log.error("[" + signature.toShortString() + "]" + Arrays.toString(args) + "[" + e.toString() + "]");
// Throw a new server internal error exception
throw new ServerInternalErrorException();
}
代码示例来源:origin: org.opennms.core/org.opennms.core.profiler
@Around("@within(profile) || @annotation(profile)")
public Object logAroundByMethod(ProceedingJoinPoint joinPoint, Profile profile) throws Throwable {
Timer timer = new Timer();
try {
timer.start();
return joinPoint.proceed();
} finally {
log(joinPoint.getKind(), joinPoint.getSignature().toShortString(), timer.stop());
}
}
代码示例来源:origin: com.gitee.qdbp/qdbp-general-ctl
protected void save(ProceedingJoinPoint point, Method method, String permission, Object returns) {
// 获取操作描述
String sign = point.getSignature().toShortString();
OperateRecord annotation = findOperateRecordAnnotation(method);
if (annotation != null && !annotation.enable()) {
return;
}
String operateDesc;
if (annotation != null && VerifyTools.isNotBlank(annotation.value())) {
operateDesc = annotation.value();
} else {
operateDesc = getAndCheckOperateDesc(permission, sign);
}
Class<?> clazz = point.getTarget().getClass();
MultipartFile file = findUploadFile(point);
save(clazz, method, sign, operateDesc, permission, annotation, returns, null, file, null);
}
代码示例来源:origin: com.gitee.zhaohuihua/bdp-general-web
protected void save(ProceedingJoinPoint point, Method method, Object returns, IUser operator) {
// 获取操作描述
String permission = vars.getPermission();
String sign = point.getSignature().toShortString();
OperateRecord annotation = findOperateRecordAnnotation(method);
if (annotation != null && !annotation.enable()) {
return;
}
String operateDesc;
if (annotation != null && VerifyTools.isNotBlank(annotation.value())) {
operateDesc = annotation.value();
} else {
operateDesc = getAndCheckOperateDesc(permission, sign);
}
Class<?> clazz = point.getTarget().getClass();
MultipartFile file = findUploadFile(point);
save(clazz, method, sign, operateDesc, permission, annotation, returns, null, file, operator);
}
内容来源于网络,如有侵权,请联系作者删除!