Example usage for org.aspectj.lang ProceedingJoinPoint getTarget

List of usage examples for org.aspectj.lang ProceedingJoinPoint getTarget

Introduction

In this page you can find the example usage for org.aspectj.lang ProceedingJoinPoint getTarget.

Prototype

Object getTarget();

Source Link

Document

Returns the target object.

Usage

From source file:moe.yuna.palinuridae.log.LogAspect.java

@Around("execution(* moe.yuna.palinuridae.core.*BaseDao.select*(..))")
public Object logSelect(ProceedingJoinPoint pjp) throws Throwable {
    long currentTimeMillis = System.currentTimeMillis();
    Object result = pjp.proceed(pjp.getArgs());
    long currentTimeMillis1 = System.currentTimeMillis();
    LoggerFactory.getLogger(pjp.getTarget().getClass()).debug("====result:" + result);
    return result;
}

From source file:moe.yuna.palinuridae.log.ProcessTimeAspect.java

@Around("execution(* moe.yuna.palinuridae.xutilsmodel.XUtilsModelDao.*(..))")
public Object xutilProcessTime(ProceedingJoinPoint pjp) throws Throwable {
    long nanoTime = System.currentTimeMillis();
    Object result = pjp.proceed(pjp.getArgs());
    LoggerFactory.getLogger(pjp.getTarget().getClass())
            .debug("====xutil process time:" + (System.currentTimeMillis() - nanoTime) + "ms=========");
    return result;
}

From source file:moe.yuna.palinuridae.log.ProcessTimeAspect.java

@Around("execution(* moe.yuna.palinuridae.core.*BaseDao.*(..))")
public Object logProcessTime(ProceedingJoinPoint pjp) throws Throwable {
    long nanoTime = System.currentTimeMillis();
    Object result = pjp.proceed(pjp.getArgs());
    LoggerFactory.getLogger(pjp.getTarget().getClass())
            .debug("====process time:" + (System.currentTimeMillis() - nanoTime) + "ms=========");
    return result;
}

From source file:mum.maharishi.maharishiinn.others.MyControllerAspect.java

@Around("execution (* mum.maharishi.maharishiinn.service.UserInformationService.nothing(..))")
public Object aroundAspectMethod(ProceedingJoinPoint pjp) throws Throwable {
    //Before here
    Object retVal = null;// www  .j a v  a  2 s  .  com
    try {
        Object[] args = pjp.getArgs();
        retVal = pjp.proceed(args);

        Object targetClass = pjp.getTarget();
        jptDomain val = ((UserInformationService) targetClass).something("here");

        System.out.println("val.value is: " + val.getName());
    } catch (Exception e) {
        //After throw here
    } finally {
        //after finally here
    }

    //after here
    retVal = (Integer) retVal + 1;
    return retVal;
}

From source file:net.sf.dynamicreports.site.ExamplesAspect.java

License:Open Source License

@Around("show()")
public JasperReportBuilder show(ProceedingJoinPoint pjp) throws Throwable {
    JasperReportBuilder reportBuilder = (JasperReportBuilder) pjp.getTarget();
    GenerateSite.generateExampleImage(name, reportBuilder);
    return reportBuilder;
}

From source file:net.sf.dynamicreports.site.ExamplesAspect.java

License:Open Source License

@Around("export()")
public JasperReportBuilder to(ProceedingJoinPoint pjp) throws Throwable {
    JasperReportBuilder reportBuilder = (JasperReportBuilder) pjp.getTarget();
    GenerateSite.generateExampleImage(name, reportBuilder,
            (AbstractJasperExporterBuilder<?, ?>) pjp.getArgs()[0]);
    return reportBuilder;
}

From source file:net.sf.dynamicreports.site.ExamplesAspect.java

License:Open Source License

@Around("toConcatenatedPdf()")
public JasperConcatenatedReportBuilder toConcatenatedPdf(ProceedingJoinPoint pjp) throws Throwable {
    JasperConcatenatedReportBuilder reportBuilder = (JasperConcatenatedReportBuilder) pjp.getTarget();
    GenerateSite.generateExampleImage(name, reportBuilder, (JasperPdfExporterBuilder) pjp.getArgs()[0]);
    return reportBuilder;
}

From source file:net.sf.gazpachoquest.aspects.ProfilingAdvise.java

License:Open Source License

private String createTaskName(final ProceedingJoinPoint proceedingJoinPoint) {
    return new StringBuffer(proceedingJoinPoint.getTarget().getClass().getSimpleName()).append(".")
            .append(proceedingJoinPoint.getSignature().getName()).toString();
}

From source file:net.sf.oval.guard.GuardAspect2.java

License:Open Source License

@Around("execution((@net.sf.oval.guard.Guarded *).new(..))")
public Object allConstructors(final ProceedingJoinPoint thisJoinPoint) throws Throwable {
    final ConstructorSignature signature = (ConstructorSignature) thisJoinPoint.getSignature();

    LOG.debug("aroundConstructor() {1}", signature);

    final Constructor<?> ctor = signature.getConstructor();
    final Object[] args = thisJoinPoint.getArgs();
    final Object target = thisJoinPoint.getTarget();

    // pre conditions
    {/*www  .  jav  a 2 s  .  c o  m*/
        guard.guardConstructorPre(target, ctor, args);
    }

    final Object result = thisJoinPoint.proceed();

    // post conditions
    {
        guard.guardConstructorPost(target, ctor, args);
    }

    return result;
}

From source file:net.sf.oval.guard.GuardAspect2.java

License:Open Source License

@SuppressAjWarnings("adviceDidNotMatch")
@Around("execution(* (@net.sf.oval.guard.Guarded *).*(..))")
public Object allMethods(final ProceedingJoinPoint thisJoinPoint) throws Throwable {
    final MethodSignature signature = (MethodSignature) thisJoinPoint.getSignature();

    LOG.debug("aroundMethod() {1}", signature);

    final Method method = signature.getMethod();
    final Object[] args = thisJoinPoint.getArgs();
    final Object target = thisJoinPoint.getTarget();

    return guard.guardMethod(target, method, args, new ProceedInvocable(thisJoinPoint));
}