Example usage for org.aspectj.lang ProceedingJoinPoint proceed

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

Introduction

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

Prototype

public Object proceed(Object[] args) throws Throwable;

Source Link

Document

Proceed with the next advice or target method invocation.

Usage

From source file:com.polydeucesys.kaos.example.aspect.StringSharerAspects.java

License:Apache License

@Around("readLinePointcut(msg)")
public Object modifyMessage(ProceedingJoinPoint pjp, String msg) throws Throwable {
    Strategy<String> strategy = ConfigurationFactory.getInstance().getConfiguration()
            .strategyForName("msg-aspect");
    if (!isReadStarted) {
        strategy.start();/*www . ja v a  2  s . com*/
        isReadStarted = true;
    }
    for (Behaviour before : strategy.beforeBehaviours()) {
        before.execute();
    }
    String work = msg;
    Object[] args = pjp.getArgs();
    for (Modifier<String> m : strategy.modifiers()) {
        work = m.modify(work);
    }
    args[0] = work;
    Object res = pjp.proceed(args);
    for (Behaviour after : strategy.afterBehaviours()) {
        after.execute();
    }
    return res;
}

From source file:com.qcadoo.mes.states.aop.StateChangePhaseAspect.java

License:Open Source License

@Around("(execution(@com.qcadoo.mes.states.annotation.StateChangePhase * *.*(..)) "
        + "|| execution(public void com.qcadoo.mes.states.service.StateChangeService.changeState(..)) "
        + "|| execution(public void com.qcadoo.mes.states.service.StateChangeService.changeStatePhase(..))) "
        + "&& args(stateChangeContext,..) && within(com.qcadoo.mes.states.service.StateChangeService+)")
public Object omitExecutionIfStateChangeEntityHasErrors(final ProceedingJoinPoint pjp,
        final StateChangeContext stateChangeContext) throws Throwable {
    stateChangeContext.save();/*from  ww  w  .j a  v  a 2  s.  c o m*/
    Object result = null;
    if (StateChangePhaseUtil.canRun(stateChangeContext)) {
        result = pjp.proceed(pjp.getArgs());
    } else {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(String.format(CANCELING_MSG_TMPL, stateChangeContext));
        }
        stateChangeContext.setStatus(StateChangeStatus.FAILURE);
        if (!stateChangeContext.save()) {
            if (LOGGER.isErrorEnabled()) {
                LOGGER.error(String.format(CANNOT_SAVE_STATE_CHANGE_ENTITY, stateChangeContext));
            }
        }
    }
    return result;
}

From source file:com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj.java

License:Apache License

@Around("call(void java.io.PrintStream.println(..))" + "&& args(x)"
        + "&& !within(com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj)"
        + "&& !within(com.rover12421.shaka.apktool.test.*)")
public void around_sout_println(ProceedingJoinPoint joinPoint, String x) throws Throwable {
    joinPoint.proceed(new Object[] { covertLocaleInfo(x) });
}

From source file:com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj.java

License:Apache License

@Around("call(* org.apache.commons.cli.OptionBuilder.withDescription(..))" + "&& args(newDescription)"
        + "&& !within(com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj)")
public OptionBuilder around_OptionBuilder_withDescription(ProceedingJoinPoint joinPoint, String newDescription)
        throws Throwable {
    return (OptionBuilder) joinPoint.proceed(new Object[] { covertLocaleInfo(newDescription) });
}

From source file:com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj.java

License:Apache License

@Around("call(void org.apache.commons.cli.HelpFormatter.printHelp(..))"
        + "&& args(cmdLineSyntax, header, options, footer)"
        + "&& !within(com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj)")
public void around_HelpFormatter_printHelp(ProceedingJoinPoint joinPoint, String cmdLineSyntax, String header,
        Options options, String footer) throws Throwable {
    joinPoint.proceed(
            new Object[] { covertLocaleInfo(cmdLineSyntax), covertLocaleInfo(header), options, footer });
}

From source file:com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj.java

License:Apache License

@Around("call(* java.lang.String.format(..))" + "&& args(format, args)"
        + "&& !within(com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj)")
public String around_String_format(ProceedingJoinPoint joinPoint, String format, Object... args)
        throws Throwable {
    return covertLocaleInfo((String) joinPoint.proceed(joinPoint.getArgs()));
}

From source file:com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj.java

License:Apache License

@Around("call(void org.jf.util.IndentingWriter.write(..))" + "&& args(s)"
        + "&& !within(com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj)")
public void around_IndentingWriter_write(ProceedingJoinPoint joinPoint, String s) throws Throwable {
    joinPoint.proceed(new Object[] { covertLocaleInfo(s) });
}

From source file:com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj.java

License:Apache License

@Around("call(void java.util.logging.Logger.*(String))" + "&& args(msg)"
        + "&& !within(com.rover12421.shaka.apktool.AspjectJ.apktool_cli.MultiLanguageAj)")
public void around_Logger_msg(ProceedingJoinPoint joinPoint, String msg) throws Throwable {
    joinPoint.proceed(new Object[] { covertLocaleInfo(msg) });
}

From source file:com.rover12421.shaka.apktool.lib.AndrolibAj.java

License:Apache License

@Around("execution(* brut.androlib.Androlib.decodeSourcesRaw(..))" + "&& args(apkFile, outDir, filename)")
public void decodeSourcesRaw(ProceedingJoinPoint joinPoint, ExtFile apkFile, File outDir, String filename)
        throws Throwable {
    /**/* w  ww .  ja v a  2s. c o m*/
     * ??dex,?classes.dex?copy,unkownfiles???
     */
    if (filename.equals("classes.dex")) {
        joinPoint.proceed(joinPoint.getArgs());
    }
}

From source file:com.rover12421.shaka.apktool.lib.AndrolibAj.java

License:Apache License

@Around("execution(* brut.androlib.Androlib.readMetaFile(..))")
public MetaInfo readMetaFile(ProceedingJoinPoint joinPoint) throws Throwable {
    metaInfo = (MetaInfo) joinPoint.proceed(joinPoint.getArgs());
    return metaInfo;
}