Java Utililty Methods Aspectj Usage

List of utility methods to do Aspectj Usage

Description

The list of methods to do Aspectj Usage are organized into topic(s).

Method

StringresolveFileName(final String fileName)
In the repository.xml class the file names of the fixed files are given, whereas cobertura prints the real java class names into the XML file.
final String[] prefixes = new String[] { "org.aspectj/modules/weaver/src/",
        "org.aspectj/modules/org.aspectj.ajdt.core/src/", "org.aspectj/modules/tests/src/", };
String file = null;
for (final String prefix : prefixes) {
    if (fileName.startsWith(prefix)) {
        file = fileName.substring(prefix.length());
if (file == null && fileName.startsWith("org/aspectj/")) {
    file = fileName;
if (file == null) {
    throw new RuntimeException("Filename cannot be resolved to a class name: " + fileName);
if (!file.endsWith(".java")) {
    throw new RuntimeException("Expected filename to resolve to end with .java, but found: " + fileName);
file = file.substring(0, file.length() - 5);
return file.replace("/", ".");
voidsetSourceLine(InstructionHandle ih, int lineNumber)
set Source Line
ih.addTargeter(new LineNumberTag(lineNumber));
String[]strip(String[] src, String[] toStrip)
strip
if (null == toStrip) {
    return strip(src, NONE);
} else if (null == src) {
    return strip(NONE, toStrip);
List slist = org.aspectj.util.LangUtil.arrayAsList(src);
List tlist = org.aspectj.util.LangUtil.arrayAsList(toStrip);
slist.removeAll(tlist);
...
Classtype(final JoinPoint joinPoint)
type
return joinPoint.getTarget().getClass();
StringtypeName(final JoinPoint joinPoint)
type Name
final Class<?> type = type(joinPoint);
if (type != null) {
    return type.getName();
return null;
JoinPointunWrapJoinPoint(final JoinPoint point)
Unwraps a join point that may be nested due to layered proxies.
JoinPoint naked = point;
while (naked.getArgs().length > 0 && naked.getArgs()[0] instanceof JoinPoint) {
    naked = (JoinPoint) naked.getArgs()[0];
return naked;