diff options
author | aclement <aclement> | 2005-04-19 12:20:49 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-04-19 12:20:49 +0000 |
commit | e2e4adc3655a9c69ba9e3f2050c83e38d1a0c17e (patch) | |
tree | db5665924c92764eb0be2d120828a03b8810a830 /weaver/src/org/aspectj | |
parent | 25f27750e1a08d1cb0b1242de4cc5321d830ca3a (diff) | |
download | aspectj-e2e4adc3655a9c69ba9e3f2050c83e38d1a0c17e.tar.gz aspectj-e2e4adc3655a9c69ba9e3f2050c83e38d1a0c17e.zip |
from branch: extra perclause support for @AJ
Diffstat (limited to 'weaver/src/org/aspectj')
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/PerClause.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/PerClause.java b/weaver/src/org/aspectj/weaver/patterns/PerClause.java index 8b59094d1..e8fbc834a 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PerClause.java +++ b/weaver/src/org/aspectj/weaver/patterns/PerClause.java @@ -66,4 +66,28 @@ public abstract class PerClause extends Pointcut { public static final Kind PEROBJECT = new Kind("perobject", 3); public static final Kind FROMSUPER = new Kind("fromsuper", 4); public static final Kind PERTYPEWITHIN = new Kind("pertypewithin",5); + + public static class KindAnnotationPrefix extends TypeSafeEnum { + private KindAnnotationPrefix(String name, int key) { + super(name, key); + } + + public String extractPointcut(String perClause) { + int from = getName().length(); + int to = perClause.length()-1; + if (!perClause.startsWith(getName()) + || !perClause.endsWith(")") + || from > perClause.length()) { + throw new RuntimeException("cannot read perclause " + perClause); + } + + return perClause.substring(from, to); + } + + public static final KindAnnotationPrefix PERCFLOW = new KindAnnotationPrefix("percflow(", 1); + public static final KindAnnotationPrefix PERCFLOWBELOW = new KindAnnotationPrefix("percflowbelow(", 2); + public static final KindAnnotationPrefix PERTHIS = new KindAnnotationPrefix("perthis(", 3); + public static final KindAnnotationPrefix PERTARGET = new KindAnnotationPrefix("pertarget(", 4); + public static final KindAnnotationPrefix PERTYPEWITHIN = new KindAnnotationPrefix("pertypewithin(", 5); + } } |