浏览代码

AOPAlliance adapter sample

tags/V1_2_0
acolyer 20 年前
父节点
当前提交
f0e7118cd2
共有 24 个文件被更改,包括 720 次插入1 次删除
  1. 1
    1
      docs/developer/ajdt/ajdt.core.workitems.txt
  2. 1
    0
      docs/sandbox/aopalliance/.cvsignore
  3. 二进制
      docs/sandbox/aopalliance/aopalliance.jar
  4. 二进制
      docs/sandbox/aopalliance/lib/aj-aopalliance.jar
  5. 21
    0
      docs/sandbox/aopalliance/readme.txt
  6. 72
    0
      docs/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj
  7. 32
    0
      docs/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java
  8. 54
    0
      docs/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java
  9. 50
    0
      docs/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java
  10. 33
    0
      docs/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java
  11. 19
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AOPAllianceAdapterTest.java
  12. 19
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AllTests.java
  13. 39
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/ConstructorInvocationClosureTest.java
  14. 24
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/Hello.java
  15. 28
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloAOPAllianceAdapter.aj
  16. 21
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloConstructionInterceptor.java
  17. 20
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloMethodInterceptor.java
  18. 76
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/InvocationJoinPointClosureTest.java
  19. 45
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/JoinPointClosureTest.java
  20. 27
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MethodInvocationClosureTest.java
  21. 16
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockConstructorSignature.java
  22. 53
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockJoinPoint.java
  23. 18
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockMethodSignature.java
  24. 51
    0
      docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockSignature.java

+ 1
- 1
docs/developer/ajdt/ajdt.core.workitems.txt 查看文件

@@ -248,7 +248,7 @@ I'm not sure what user interface features need this...
17) Version upgrade
=============================================================================
17.1) port to Eclipse 3.0 M9
17.2) port to Eclipse 2.0 final
17.2) port to Eclipse 3.0 final

18) JDT DEBUG
=============================================================================

+ 1
- 0
docs/sandbox/aopalliance/.cvsignore 查看文件

@@ -0,0 +1 @@
bin

二进制
docs/sandbox/aopalliance/aopalliance.jar 查看文件


二进制
docs/sandbox/aopalliance/lib/aj-aopalliance.jar 查看文件


+ 21
- 0
docs/sandbox/aopalliance/readme.txt 查看文件

@@ -0,0 +1,21 @@
This example shows how to call an AOP Alliance aspect (interceptor) from
within AspectJ.

The contents of the src directory comprise some library classes plus an
abstract aspect that can be extended to create AOP Alliance invoking concrete
aspects (provide an implementation of getMethodInterceptor() and the
targetJP() pointcut in your concrete subaspect).

The contents of the testsrc directory supply test cases, and in so doing a
sample of using the AOPAllianceAdapter aspect (HelloAOPAllianceAdapter aspect).

With the docs module checked out of the AspectJ CVS tree, I build and test
these AOPAlliance samples as follows:

Create an AJDT project, "AOPAlliance" (you can call it whatever you like).
Add the file lib/aopalliance.jar to the build path. Remove the default source
directory that will have been set up for the project, and add a "src" directory.
When doing this click "advanced" and set it up as a link to the src folder in
this directory. Do the same for "testsrc". Now you have an AJDT project that
should build and take its source from this directory. To run the tests, select
the "AllTests.java" file in the AJDT project and choose "run as junit."

+ 72
- 0
docs/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj 查看文件

@@ -0,0 +1,72 @@
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.aspectj.aopalliance;
import org.aspectj.lang.SoftException;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.ConstructorInterceptor;
public abstract aspect AOPAllianceAdapter {
/**
* Return the interceptor to use at method execution join points.
* Must be overriden by subclasses.
* @return MethodInterceptor, or null if no method advice required
*/
protected abstract MethodInterceptor getMethodInterceptor();
/**
* Return the interceptor to use at constructor execution join points.
* May be overriden by subclasses.
* @return ConstructorInterceptor, or null if no constructor advice required
*/
protected ConstructorInterceptor getConstructorInterceptor() {
return null;
}
protected abstract pointcut targetJoinPoint();
pointcut methodExecution() : execution(* *(..));
pointcut constructorExecution() : execution(new(..));
Object around() : targetJoinPoint() && methodExecution() {
MethodInvocationClosure mic = new MethodInvocationClosure(thisJoinPoint) {
public Object execute() { return proceed();}
};
MethodInterceptor mInt = getMethodInterceptor();
if (mInt != null) {
try {
return mInt.invoke(mic);
} catch (Throwable t) {
throw new SoftException(t);
}
} else {
return proceed();
}
}
Object around() : targetJoinPoint() && constructorExecution() {
ConstructorInvocationClosure cic = new ConstructorInvocationClosure(thisJoinPoint) {
public Object execute() { proceed(); return thisJoinPoint.getThis();}
};
ConstructorInterceptor cInt = getConstructorInterceptor();
if (cInt != null) {
try {
return cInt.construct(cic);
} catch (Throwable t) {
throw new SoftException(t);
}
} else {
return proceed();
}
}
}

+ 32
- 0
docs/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java 查看文件

@@ -0,0 +1,32 @@
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.aspectj.aopalliance;
import java.lang.reflect.Constructor;
import org.aopalliance.intercept.ConstructorInvocation;
import org.aspectj.lang.JoinPoint;
public abstract class ConstructorInvocationClosure extends InvocationJoinPointClosure
implements ConstructorInvocation {
public ConstructorInvocationClosure(JoinPoint jp) {
super(jp);
}
/* (non-Javadoc)
* @see org.aopalliance.intercept.MethodInvocation#getMethod()
*/
public Constructor getConstructor() {
return (Constructor) getStaticPart();
}
}

+ 54
- 0
docs/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java 查看文件

@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.aspectj.aopalliance;
import java.lang.reflect.AccessibleObject;
import org.aopalliance.intercept.Invocation;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.CodeSignature;
import org.aspectj.lang.reflect.ConstructorSignature;
import org.aspectj.lang.reflect.MethodSignature;
public abstract class InvocationJoinPointClosure extends JoinPointClosure implements Invocation {
public InvocationJoinPointClosure(JoinPoint jp) {
super(jp);
}
/* (non-Javadoc)
* @see org.aopalliance.intercept.Joinpoint#getStaticPart()
*/
public AccessibleObject getStaticPart() {
CodeSignature cSig = (CodeSignature)jp.getSignature();
Class clazz = cSig.getDeclaringType();
AccessibleObject ret = null;
try {
if (cSig instanceof MethodSignature) {
ret = clazz.getMethod(cSig.getName(),cSig.getParameterTypes());
} else if (cSig instanceof ConstructorSignature) {
ret = clazz.getConstructor(cSig.getParameterTypes());
}
} catch (NoSuchMethodException mEx) {
throw new UnsupportedOperationException(
"Can't find member " + cSig.toLongString());
}
return ret;
}
/* (non-Javadoc)
* @see org.aopalliance.intercept.Invocation#getArguments()
*/
public Object[] getArguments() {
return jp.getArgs();
}
}

+ 50
- 0
docs/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java 查看文件

@@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.aspectj.aopalliance;
import java.lang.reflect.AccessibleObject;
import org.aopalliance.intercept.Joinpoint;
import org.aspectj.lang.JoinPoint;
public abstract class JoinPointClosure implements Joinpoint {
protected JoinPoint jp;
public JoinPointClosure(JoinPoint joinPoint) {
this.jp = joinPoint;
}
/* (non-Javadoc)
* @see org.aopalliance.intercept.Joinpoint#proceed()
*/
public Object proceed() throws Throwable {
return execute();
}
// for subclasses, renamed from proceed to avoid confusion in
// AspectJ around advice.
public abstract Object execute();
/* (non-Javadoc)
* @see org.aopalliance.intercept.Joinpoint#getThis()
*/
public Object getThis() {
return jp.getThis();
}
/* (non-Javadoc)
* @see org.aopalliance.intercept.Joinpoint#getStaticPart()
* Must return either a Field, Method or Constructor representing the entity
* at the joinpoint.
*/
public abstract AccessibleObject getStaticPart();
}

+ 33
- 0
docs/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java 查看文件

@@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.aspectj.aopalliance;
import java.lang.reflect.Method;
import org.aopalliance.intercept.MethodInvocation;
import org.aspectj.lang.JoinPoint;
public abstract class MethodInvocationClosure extends InvocationJoinPointClosure
implements
MethodInvocation {
public MethodInvocationClosure(JoinPoint jp) {
super(jp);
}
/* (non-Javadoc)
* @see org.aopalliance.intercept.MethodInvocation#getMethod()
*/
public Method getMethod() {
return (Method) getStaticPart();
}
}

+ 19
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AOPAllianceAdapterTest.java 查看文件

@@ -0,0 +1,19 @@
package org.aspectj.aopalliance.tests;
import junit.framework.TestCase;
public class AOPAllianceAdapterTest extends TestCase {
public void testHello() {
Hello h = new Hello();
h.sayHello();
Hello h2 = new Hello("Hello AOP Alliance");
h2.sayHello();
assertTrue("Constructor executed", Hello.defaultConsExecuted);
assertTrue("2nd Constructor executed", Hello.paramConsExecuted);
assertEquals("sayHello invoked twice",2,Hello.sayHelloCount);
assertEquals("Constructor interceptor ran twice",2,HelloConstructionInterceptor.runCount);
assertEquals("Method interceptor ran twice",2,HelloMethodInterceptor.runCount);
}
}

+ 19
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AllTests.java 查看文件

@@ -0,0 +1,19 @@
package org.aspectj.aopalliance.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite(
"Test for org.aspectj.aopalliance.tests");
//$JUnit-BEGIN$
suite.addTestSuite(JoinPointClosureTest.class);
suite.addTestSuite(InvocationJoinPointClosureTest.class);
suite.addTestSuite(MethodInvocationClosureTest.class);
suite.addTestSuite(ConstructorInvocationClosureTest.class);
suite.addTestSuite(AOPAllianceAdapterTest.class);
//$JUnit-END$
return suite;
}
}

+ 39
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/ConstructorInvocationClosureTest.java 查看文件

@@ -0,0 +1,39 @@
package org.aspectj.aopalliance.tests;
import java.lang.reflect.Constructor;
import org.aspectj.aopalliance.ConstructorInvocationClosure;
import junit.framework.TestCase;
public class ConstructorInvocationClosureTest extends TestCase {
public void testGetArguments() {
MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
new Class[] {});
Object[] args = new Object[] {this};
MockJoinPoint jp = new MockJoinPoint(this,sig,args);
ConstructorInvocationClosure cic = new ConstructorInvocationClosure(jp) {
public Object execute() {return null;}
};
assertEquals(args,cic.getArguments());
}
public void testGetConstructor() {
MockConstructorSignature sig = new MockConstructorSignature("new",StringBuffer.class,
new Class[] {String.class});
MockJoinPoint jp = new MockJoinPoint(this,sig,null);
ConstructorInvocationClosure cic = new ConstructorInvocationClosure(jp) {
public Object execute() {return null;}
};
Constructor c = cic.getConstructor();
try {
assertEquals("Should find StringBuffer constructor",StringBuffer.class.getConstructor(new Class[]{String.class}),
c);
} catch (NoSuchMethodException e) {
fail("Duff test:" + e);
}
}
}

+ 24
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/Hello.java 查看文件

@@ -0,0 +1,24 @@
package org.aspectj.aopalliance.tests;
public class Hello {
public static boolean defaultConsExecuted = false;
public static boolean paramConsExecuted = false;
public static int sayHelloCount = 0;
private String msg = "Hello";
public Hello() { defaultConsExecuted = true;}
public Hello(String s) {
msg = s;
paramConsExecuted = true;
}
public String sayHello() {
sayHelloCount++;
return msg;
}
}

+ 28
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloAOPAllianceAdapter.aj 查看文件

@@ -0,0 +1,28 @@
package org.aspectj.aopalliance.tests;
import org.aspectj.aopalliance.AOPAllianceAdapter;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.ConstructorInterceptor;
public aspect HelloAOPAllianceAdapter extends AOPAllianceAdapter {
private MethodInterceptor mInt;
private ConstructorInterceptor cInt;
public pointcut targetJoinPoint() : within(Hello);
protected MethodInterceptor getMethodInterceptor() {
return mInt;
}
protected ConstructorInterceptor getConstructorInterceptor() {
return cInt;
}
public HelloAOPAllianceAdapter() {
mInt = new HelloMethodInterceptor();
cInt = new HelloConstructionInterceptor();
}
}

+ 21
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloConstructionInterceptor.java 查看文件

@@ -0,0 +1,21 @@
package org.aspectj.aopalliance.tests;
import org.aopalliance.intercept.ConstructorInterceptor;
import org.aopalliance.intercept.ConstructorInvocation;
public class HelloConstructionInterceptor implements ConstructorInterceptor {
public static int runCount = 0;
/* (non-Javadoc)
* @see org.aopalliance.intercept.ConstructorInterceptor#construct(org.aopalliance.intercept.ConstructorInvocation)
*/
public Object construct(ConstructorInvocation jp) throws Throwable {
System.out.println("About to invoke AOP Alliance constructor interceptor");
Object ret = jp.proceed();
System.out.println("Invoked AOP Alliance constructor interceptor, return = " +
(ret != null ? ret.toString() : "null"));
runCount++;
return ret;
}
}

+ 20
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloMethodInterceptor.java 查看文件

@@ -0,0 +1,20 @@
package org.aspectj.aopalliance.tests;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
public class HelloMethodInterceptor implements MethodInterceptor {
public static int runCount = 0;
/* (non-Javadoc)
* @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
*/
public Object invoke(MethodInvocation jp) throws Throwable {
System.out.println("About to invoke AOP Alliance method interceptor");
Object ret = jp.proceed();
System.out.println("Invoked AOP Alliance method interceptor, return = " + ret.toString());
runCount++;
return ret;
}
}

+ 76
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/InvocationJoinPointClosureTest.java 查看文件

@@ -0,0 +1,76 @@
/*
* Created on 07-May-2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package org.aspectj.aopalliance.tests;
import java.lang.reflect.AccessibleObject;
import junit.framework.TestCase;
import org.aspectj.aopalliance.InvocationJoinPointClosure;
public class InvocationJoinPointClosureTest extends TestCase {
public void testGetStaticPartMethod() {
MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
new Class[] {});
MockJoinPoint jp = new MockJoinPoint(this,sig,null);
InvocationJoinPointClosure mejpc = new InvocationJoinPointClosure(jp) {
public Object execute() {return null;}
};
AccessibleObject ao = mejpc.getStaticPart();
try {
assertEquals("Should find toString method",Object.class.getMethod("toString",new Class[]{}),
ao);
} catch (NoSuchMethodException e) {
fail("Duff test:" + e);
}
}
public void testGetStaticPartConstructor() {
MockConstructorSignature sig = new MockConstructorSignature("new",StringBuffer.class,
new Class[] {String.class});
MockJoinPoint jp = new MockJoinPoint(this,sig,null);
InvocationJoinPointClosure mejpc = new InvocationJoinPointClosure(jp) {
public Object execute() {return null;}
};
AccessibleObject ao = mejpc.getStaticPart();
try {
assertEquals("Should find StringBuffer constructor",StringBuffer.class.getConstructor(new Class[]{String.class}),
ao);
} catch (NoSuchMethodException e) {
fail("Duff test:" + e);
}
}
public void testGetStaticPartException() {
try {
MockMethodSignature sig = new MockMethodSignature("toKettle",Object.class,
new Class[] {});
MockJoinPoint jp = new MockJoinPoint(this,sig,null);
InvocationJoinPointClosure mejpc = new InvocationJoinPointClosure(jp) {
public Object execute() {return null;}
};
AccessibleObject ao = mejpc.getStaticPart();
fail("UnsupportedOperationException expected");
} catch (UnsupportedOperationException unEx) {
assertEquals("Can't find member long string",unEx.getMessage());
}
}
public void testGetArguments() {
MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
new Class[] {});
Object[] args = new Object[] {this};
MockJoinPoint jp = new MockJoinPoint(this,sig,args);
InvocationJoinPointClosure mic = new InvocationJoinPointClosure(jp) {
public Object execute() {return null;}
};
assertEquals(args,mic.getArguments());
}
}

+ 45
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/JoinPointClosureTest.java 查看文件

@@ -0,0 +1,45 @@
/*
* Created on 07-May-2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package org.aspectj.aopalliance.tests;
import java.lang.reflect.AccessibleObject;
import junit.framework.TestCase;
import org.aspectj.aopalliance.JoinPointClosure;
import org.aspectj.lang.JoinPoint;
/**
* @author colyer
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class JoinPointClosureTest extends TestCase {
public void testGetThis() {
JoinPoint jp = new MockJoinPoint(this,null,null);
JoinPointClosure jpc = new JoinPointClosure(jp) {
public Object execute() {return null;}
public AccessibleObject getStaticPart() {return null;}};
assertEquals("getThis returns join point 'this'",this,jpc.getThis());
}
public void testProceed() {
JoinPoint jp = new MockJoinPoint(this,null,null);
JoinPointClosure jpc = new JoinPointClosure(jp) {
public Object execute() {return this;}
public AccessibleObject getStaticPart() {return null;}};
try {
Object ret = jpc.proceed();
assertTrue("should return value from execute",ret instanceof JoinPointClosure);
} catch (Throwable e) {
fail("Exception proceeding on join point : " + e);
}
}
}

+ 27
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MethodInvocationClosureTest.java 查看文件

@@ -0,0 +1,27 @@
package org.aspectj.aopalliance.tests;
import java.lang.reflect.Method;
import org.aspectj.aopalliance.MethodInvocationClosure;
import junit.framework.TestCase;
public class MethodInvocationClosureTest extends TestCase {
public void testGetMethod() {
MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
new Class[] {});
MockJoinPoint jp = new MockJoinPoint(this,sig,null);
MethodInvocationClosure mic = new MethodInvocationClosure(jp) {
public Object execute() {return null;}
};
Method m = mic.getMethod();
try {
assertEquals("Should find toString method",Object.class.getMethod("toString",new Class[]{}),
m);
} catch (NoSuchMethodException e) {
fail("Duff test:" + e);
}
}
}

+ 16
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockConstructorSignature.java 查看文件

@@ -0,0 +1,16 @@
/*
* Created on 07-May-2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package org.aspectj.aopalliance.tests;
import org.aspectj.lang.reflect.ConstructorSignature;
class MockConstructorSignature extends MockSignature implements ConstructorSignature {
public MockConstructorSignature(String name,Class decClass, Class[] paramTypes) {
super(name,decClass,paramTypes);
}
}

+ 53
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockJoinPoint.java 查看文件

@@ -0,0 +1,53 @@
/*
* Created on 07-May-2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package org.aspectj.aopalliance.tests;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.SourceLocation;
class MockJoinPoint implements JoinPoint {
private Object me;
private Signature sig;
private Object[] args;
public MockJoinPoint(Object me, Signature sig, Object[] args) {
this.me = me;
this.sig = sig;
this.args = args;
}
public Object[] getArgs() {
return args;
}
public String getKind() {
return null;
}
public Signature getSignature() {
return sig;
}
public SourceLocation getSourceLocation() {
return null;
}
public StaticPart getStaticPart() {
return null;
}
public Object getTarget() {
return null;
}
public Object getThis() {
return me;
}
public String toLongString() {
return null;
}
public String toShortString() {
return null;
}
}

+ 18
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockMethodSignature.java 查看文件

@@ -0,0 +1,18 @@
/*
* Created on 07-May-2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package org.aspectj.aopalliance.tests;
import org.aspectj.lang.reflect.MethodSignature;
class MockMethodSignature extends MockSignature implements MethodSignature {
public MockMethodSignature(String name,Class decClass, Class[] paramTypes) {
super(name,decClass,paramTypes);
}
public Class getReturnType() {return null;}
}

+ 51
- 0
docs/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockSignature.java 查看文件

@@ -0,0 +1,51 @@
/*
* Created on 07-May-2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package org.aspectj.aopalliance.tests;
import org.aspectj.lang.reflect.CodeSignature;
class MockSignature implements CodeSignature {
private String name;
private Class decClass;
private Class[] paramTypes;
public MockSignature(String name,Class decClass, Class[] paramTypes) {
this.name = name;
this.decClass = decClass;
this.paramTypes = paramTypes;
}
public Class[] getExceptionTypes() {
return null;
}
public String[] getParameterNames() {
return null;
}
public Class[] getParameterTypes() {
return paramTypes;
}
public Class getDeclaringType() {
return decClass;
}
public String getDeclaringTypeName() {
return null;
}
public int getModifiers() {
return 0;
}
public String getName() {
return name;
}
public String toLongString() {
return "long string";
}
public String toShortString() {
return null;
}
}

正在加载...
取消
保存