瀏覽代碼

APIs allowing 3rd parties to integrate with AspectJ's pointcut parsing and matching

tags/Root_AspectJ5_Development
acolyer 19 年之前
父節點
當前提交
09ba8cb317
共有 1 個文件被更改,包括 28 次插入1 次删除
  1. 28
    1
      runtime/src/org/aspectj/runtime/reflect/Factory.java

+ 28
- 1
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)

Loading…
取消
儲存