List of utility methods to do Aspectj Usage
String | resolveFileName(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("/", "."); |
void | setSourceLine(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); ... |
Class> | type(final JoinPoint joinPoint) type return joinPoint.getTarget().getClass();
|
String | typeName(final JoinPoint joinPoint) type Name final Class<?> type = type(joinPoint); if (type != null) { return type.getName(); return null; |
JoinPoint | unWrapJoinPoint(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; |