aboutsummaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-12-02 14:12:18 +0000
committeracolyer <acolyer>2004-12-02 14:12:18 +0000
commit09ba8cb317e7273a0f8dbb3323ba85b2414f702c (patch)
tree08418427c6236b241c68816904e6f873ade20255 /runtime
parent4d2da2c1799a3bc2a1dae42273880ada7b8d4152 (diff)
downloadaspectj-09ba8cb317e7273a0f8dbb3323ba85b2414f702c.tar.gz
aspectj-09ba8cb317e7273a0f8dbb3323ba85b2414f702c.zip
APIs allowing 3rd parties to integrate with AspectJ's pointcut parsing and matching
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/org/aspectj/runtime/reflect/Factory.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/runtime/src/org/aspectj/runtime/reflect/Factory.java b/runtime/src/org/aspectj/runtime/reflect/Factory.java
index 01bc8eff3..3ee924f99 100644
--- a/runtime/src/org/aspectj/runtime/reflect/Factory.java
+++ b/runtime/src/org/aspectj/runtime/reflect/Factory.java
@@ -14,6 +14,10 @@
package org.aspectj.runtime.reflect;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
import org.aspectj.lang.*;
import org.aspectj.lang.reflect.*;
@@ -23,7 +27,7 @@ public final class Factory {
String filename;
public Factory(String filename, Class lexicalClass) {
//System.out.println("making
- this.filename = filename;
+ this.filename = filename;
this.lexicalClass = lexicalClass;
lookupClassLoader = lexicalClass.getClassLoader();
}
@@ -40,6 +44,29 @@ public final class Factory {
return new JoinPointImpl.StaticPartImpl(kind, sig, makeSourceLoc(l, -1));
}
+ public static JoinPoint.StaticPart makeEncSJP(Member member) {
+ Signature sig = null;
+ String kind = null;
+ if (member instanceof Method) {
+ Method method = (Method) member;
+ sig = new MethodSignatureImpl(method.getModifiers(),method.getName(),
+ method.getDeclaringClass(),method.getParameterTypes(),
+ new String[method.getParameterTypes().length],
+ method.getExceptionTypes(),method.getReturnType());
+ kind = JoinPoint.METHOD_EXECUTION;
+ } else if (member instanceof Constructor) {
+ Constructor cons = (Constructor) member;
+ sig = new ConstructorSignatureImpl(cons.getModifiers(),cons.getDeclaringClass(),
+ cons.getParameterTypes(),
+ new String[cons.getParameterTypes().length],
+ cons.getExceptionTypes());
+ kind = JoinPoint.CONSTRUCTOR_EXECUTION;
+ } else {
+ throw new IllegalArgumentException("member must be either a method or constructor");
+ }
+ return new JoinPointImpl.StaticPartImpl(kind,sig,null);
+ }
+
private static Object[] NO_ARGS = new Object[0];
public static JoinPoint makeJP(JoinPoint.StaticPart staticPart,
Object _this, Object target)