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.rover12421.shaka.apktool.lib.ResTypeSpecAj.java

License:Apache License

@Around("execution(* brut.androlib.res.data.ResTypeSpec.addResSpec(..))" + "&& args(spec)")
public void addResSpec(ProceedingJoinPoint joinPoint, ResResSpec spec) throws Throwable {
    ResTypeSpec thiz = (ResTypeSpec) joinPoint.getThis();

    addAllResResSpec(spec);/* w ww . j av  a 2 s  .co m*/

    ResResSpec exitsSpec = null;
    try {
        exitsSpec = thiz.getResSpec(spec.getName());
    } catch (Exception e) {
    }

    if (exitsSpec == null) {
        joinPoint.proceed(joinPoint.getArgs());
    } else {
        LogHelper.warning(String.format("Multiple res specs: %s/%s", thiz.getName(), spec.getName()));
        if (exitsSpec.getId() != spec.getId()) {
            addMultipleResResSpec(spec);
            addMultipleResResSpec(exitsSpec);
        }
    }
}

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

License:Apache License

@Around("execution(* brut.androlib.res.decoder.StringBlock.outputStyleTag(..))"
        + "&& args(tag, builder, close)")
public void outputStyleTag(ProceedingJoinPoint joinPoint, String tag, StringBuilder builder, boolean close)
        throws Throwable {
    String newTag = tag.replaceAll(";+", ";");
    if (!newTag.equals(tag)) {
        LogHelper.info("outputStyleTag " + tag + " >>> " + newTag);
    }/*from   w  w  w  .  j a  va 2s .c o  m*/

    joinPoint.proceed(new Object[] { newTag, builder, close });
}

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

License:Apache License

@Around("execution(* brut.androlib.res.decoder.StringBlock.getStyle(..))" + "&& args(index)")
public int[] getStyle(ProceedingJoinPoint joinPoint, int index) throws Throwable {
    StringBlock thiz = (StringBlock) joinPoint.getThis();
    int[] m_styleOffsets = thiz.getStyleOffsets();
    int[] m_styles = thiz.getStyles();
    if (m_styleOffsets == null || m_styles == null || index >= m_styleOffsets.length) {
        return null;
    }/*w  ww  .  j  a va2 s .c  o  m*/
    int offset = m_styleOffsets[index] / 4;
    if (offset < 0 || offset > m_styles.length) {
        return null;
    }
    return (int[]) joinPoint.proceed(joinPoint.getArgs());
}

From source file:com.rover12421.shaka.lib.multiLanguage.MultiLanguageAj.java

License:Apache License

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

From source file:com.rover12421.shaka.lib.multiLanguage.MultiLanguageAj.java

License:Apache License

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

From source file:com.rover12421.shaka.lib.multiLanguage.MultiLanguageAj.java

License:Apache License

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

From source file:com.rover12421.shaka.lib.multiLanguage.MultiLanguageAj.java

License:Apache License

@Around("call(* java.lang.String.format(..))" + "&& args(format, args)"
        + "&& !within(com.rover12421.shaka.lib.multiLanguage.* +)" + "&& !within(org.jf.dexlib2.util.* +)")
public String around_String_format(ProceedingJoinPoint joinPoint, String format, Object... args)
        throws Throwable {
    return MultiLanguageSupport.covertLocaleInfo((String) joinPoint.proceed(joinPoint.getArgs()));
}

From source file:com.rover12421.shaka.lib.multiLanguage.MultiLanguageAj.java

License:Apache License

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

From source file:com.rover12421.shaka.smali.baksmali.baksmaliMainAj.java

License:Apache License

@Around("execution(* org.jf.baksmali.main.main(..))" + "&& args(args)")
public void main(ProceedingJoinPoint joinPoint, String[] args) throws Throwable {
    try {/*from   ww  w .  j a v  a  2  s.com*/
        CommandLineParser parser = new PosixParser();
        CommandLine cli = parser.parse(org.jf.baksmali.main.getOptions(), args);
        if (CommandLineArgEnum.InlieMethodResolverFromFile.hasMatch(cli)) {
            ShakaBaksmaliOption.setInlineMethodResolverFile(
                    cli.getOptionValue(CommandLineArgEnum.InlieMethodResolverFromFile.getOpt()));
            int index = Arrays.binarySearch(args, CommandLineArgEnum.InlieMethodResolverFromFile.getOpt());
            if (index < 0) {
                index = Arrays.binarySearch(args, CommandLineArgEnum.InlieMethodResolverFromFile.getLongOpt());
            }

            if (index >= 0) {
                String[] nArgs = new String[args.length - 2];
                if (index > 0) {
                    System.arraycopy(args, 0, nArgs, 0, index);
                }
                System.arraycopy(args, index + 2, nArgs, index, nArgs.length - index);
                joinPoint.proceed(nArgs);
            } else {
                LogHelper.warning("args error!!!");
            }
        }
    } catch (Throwable e) {
        e.printStackTrace();
    }

    joinPoint.proceed(joinPoint.getArgs());
}

From source file:com.rover12421.shaka.smali.util.StringUtilsAj.java

License:Apache License

@Around("execution(* org.jf.util.StringUtils.writeEscapedChar(..))" + "&& args(writer, c)")
public void writeEscapedChar(ProceedingJoinPoint joinPoint, Writer writer, char c) throws Throwable {

    if (!ShakaDecodeOption.getInstance().isShowMoreRecognizableCharacters()) {
        joinPoint.proceed(joinPoint.getArgs());
        return;//  w  w  w. ja v  a  2s.  c  o m
    }

    writer.write(ShakaStringUtil.escaped(c));
}