-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35390ab
Showing
91 changed files
with
2,326 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>miniSpring</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src/main/sources"/> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>miniSpring-aop</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/main/java=UTF-8 | ||
encoding//src/test/java=UTF-8 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.Howie</groupId> | ||
<artifactId>miniSpring</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<groupId>com.Howie</groupId> | ||
<artifactId>miniSpring-aop</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>miniSpring-aop</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>3.8.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.Howie</groupId> | ||
<artifactId>miniSpring-ioc</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.Howie</groupId> | ||
<artifactId>miniSpring-utils</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
10 changes: 10 additions & 0 deletions
10
miniSpring-aop/src/main/java/org/miniSpring/aop/Adapter/AdviceAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.miniSpring.aop.Adapter; | ||
|
||
import org.miniSpring.aop.Advisor.Advisor; | ||
import org.miniSpring.aop.Interceptor.AopMethodInterceptor; | ||
|
||
public interface AdviceAdapter { | ||
|
||
AopMethodInterceptor getInterceptor(Advisor advisor); | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
miniSpring-aop/src/main/java/org/miniSpring/aop/Adapter/AfterRunningAdviceAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.miniSpring.aop.Adapter; | ||
|
||
import org.miniSpring.aop.Advisor.Advisor; | ||
import org.miniSpring.aop.Advisor.AfterRunningAdvice; | ||
import org.miniSpring.aop.Interceptor.AfterRunningAdviceInterceptor; | ||
import org.miniSpring.aop.Interceptor.AopMethodInterceptor; | ||
|
||
public class AfterRunningAdviceAdapter implements AdviceAdapter { | ||
|
||
private AfterRunningAdviceAdapter(){ | ||
|
||
} | ||
|
||
private static final AfterRunningAdviceAdapter INSTANTS = | ||
new AfterRunningAdviceAdapter(); | ||
|
||
public static AfterRunningAdviceAdapter getInstants(){ | ||
return INSTANTS; | ||
} | ||
|
||
public AopMethodInterceptor getInterceptor(Advisor advisor) { | ||
AfterRunningAdvice advice = (AfterRunningAdvice) advisor.getAdvice(); | ||
return new AfterRunningAdviceInterceptor(advice); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
miniSpring-aop/src/main/java/org/miniSpring/aop/Adapter/BeforeMethodAdviceAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.miniSpring.aop.Adapter; | ||
|
||
import org.miniSpring.aop.Advisor.Advisor; | ||
import org.miniSpring.aop.Advisor.BeforeMethodAdvice; | ||
import org.miniSpring.aop.Interceptor.AopMethodInterceptor; | ||
import org.miniSpring.aop.Interceptor.BeforeMethodAdviceInterceptor; | ||
|
||
public class BeforeMethodAdviceAdapter implements AdviceAdapter { | ||
|
||
public BeforeMethodAdviceAdapter() { | ||
|
||
} | ||
|
||
private static final BeforeMethodAdviceAdapter INSTANTS = | ||
new BeforeMethodAdviceAdapter(); | ||
|
||
public static BeforeMethodAdviceAdapter getInstants(){ | ||
return INSTANTS; | ||
} | ||
|
||
public AopMethodInterceptor getInterceptor(Advisor advisor) { | ||
// TODO Auto-generated method stub | ||
BeforeMethodAdvice advice = (BeforeMethodAdvice) advisor.getAdvice(); | ||
return new BeforeMethodAdviceInterceptor(advice); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
miniSpring-aop/src/main/java/org/miniSpring/aop/Advisor/Advice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.miniSpring.aop.Advisor; | ||
|
||
/** | ||
* | ||
* @author hongyang.jiang | ||
* | ||
*/ | ||
public interface Advice { | ||
|
||
|
||
|
||
} |
40 changes: 40 additions & 0 deletions
40
miniSpring-aop/src/main/java/org/miniSpring/aop/Advisor/AdvisedSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.miniSpring.aop.Advisor; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import org.miniSpring.aop.Interceptor.AopMethodInterceptor; | ||
|
||
public class AdvisedSupport extends Advisor { | ||
|
||
//目标对象 | ||
private TargetSource targetSource; | ||
//拦截器列表 | ||
private List<AopMethodInterceptor> list = | ||
new LinkedList<AopMethodInterceptor>(); | ||
|
||
public TargetSource getTargetSource() { | ||
return targetSource; | ||
} | ||
|
||
public void setTargetSource(TargetSource targetSource) { | ||
this.targetSource = targetSource; | ||
} | ||
|
||
public List<AopMethodInterceptor> getList() { | ||
return list; | ||
} | ||
|
||
public void setList(List<AopMethodInterceptor> list) { | ||
this.list = list; | ||
} | ||
|
||
public void addAopMethodInterceptor(AopMethodInterceptor interceptor){ | ||
list.add(interceptor); | ||
} | ||
|
||
public void addAopMethodInterceptors(List<AopMethodInterceptor> interceptors){ | ||
list.addAll(interceptors); | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
miniSpring-aop/src/main/java/org/miniSpring/aop/Advisor/Advisor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.miniSpring.aop.Advisor; | ||
|
||
/** | ||
* 描述切面的数据结构 | ||
* @author hongyang.jiang | ||
*/ | ||
public class Advisor { | ||
|
||
//干什么 | ||
private Advice advice; | ||
//在哪里 | ||
private PointCut pointCut; | ||
|
||
public Advice getAdvice() { | ||
return advice; | ||
} | ||
public void setAdvice(Advice advice) { | ||
this.advice = advice; | ||
} | ||
public PointCut getPointCut() { | ||
return pointCut; | ||
} | ||
public void setPointCut(PointCut pointCut) { | ||
this.pointCut = pointCut; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
miniSpring-aop/src/main/java/org/miniSpring/aop/Advisor/AfterRunningAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.miniSpring.aop.Advisor; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
public interface AfterRunningAdvice extends Advice { | ||
|
||
Object after(Object returnVal,Method method,Object[] args,Object targer); | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
miniSpring-aop/src/main/java/org/miniSpring/aop/Advisor/BeforeMethodAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.miniSpring.aop.Advisor; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
public interface BeforeMethodAdvice extends Advice { | ||
|
||
void before(Method method,Object[] args,Object target); | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
miniSpring-aop/src/main/java/org/miniSpring/aop/Advisor/PointCut.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.miniSpring.aop.Advisor; | ||
|
||
/** | ||
* @author hongyang.jiang | ||
*/ | ||
public interface PointCut { | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
miniSpring-aop/src/main/java/org/miniSpring/aop/Advisor/TargetSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.miniSpring.aop.Advisor; | ||
|
||
public class TargetSource { | ||
|
||
private Class<?> targetClass; | ||
|
||
private Object targetObject; | ||
|
||
public Class<?> getTargetClass() { | ||
return targetClass; | ||
} | ||
|
||
public void setTargetClass(Class<?> targetClass) { | ||
this.targetClass = targetClass; | ||
} | ||
|
||
public Object getTargetObject() { | ||
return targetObject; | ||
} | ||
|
||
public void setTargetObject(Object targetObject) { | ||
this.targetObject = targetObject; | ||
} | ||
|
||
|
||
|
||
} |
32 changes: 32 additions & 0 deletions
32
miniSpring-aop/src/main/java/org/miniSpring/aop/Bean/AopBeanDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.miniSpring.aop.Bean; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 适用于AOP的数据结构 | ||
*/ | ||
import org.miniSpring.ioc.Bean.BeanDefinition; | ||
|
||
public class AopBeanDefinition extends BeanDefinition { | ||
//目标类名 | ||
private String target; | ||
//拦截器名 | ||
private List<String> interceptorName; | ||
|
||
public String getTarget() { | ||
return target; | ||
} | ||
|
||
public void setTarget(String target) { | ||
this.target = target; | ||
} | ||
|
||
public List<String> getInterceptorName() { | ||
return interceptorName; | ||
} | ||
|
||
public void setInterceptorName(List<String> interceptorName) { | ||
this.interceptorName = interceptorName; | ||
} | ||
|
||
} |
Oops, something went wrong.