diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index def6a6a..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,7 +1,6 @@
-
+
-
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 77f4250..e99ca21 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,7 +1,14 @@
-
+
+
+
+
+
+
+
+
@@ -12,21 +19,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -35,8 +32,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -46,7 +63,7 @@
-
+
@@ -72,6 +89,9 @@
+
+
+
+
+
@@ -99,6 +121,9 @@
+
+
+
@@ -133,6 +158,13 @@
+
+
+
+
+
+
+
@@ -146,6 +178,11 @@
+
+
+
+
+
-
+
@@ -251,8 +288,8 @@
-
-
+
+
@@ -283,14 +320,6 @@
-
-
-
-
-
-
-
-
@@ -302,15 +331,23 @@
-
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -318,15 +355,31 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/out/production/JavaBase/com/fjy/proxy/StaticProxy/Client.class b/out/production/JavaBase/com/fjy/proxy/StaticProxy/Client.class
index f4ceae5..475e7b3 100644
Binary files a/out/production/JavaBase/com/fjy/proxy/StaticProxy/Client.class and b/out/production/JavaBase/com/fjy/proxy/StaticProxy/Client.class differ
diff --git a/src/com/fjy/proxy/StaticProxy/CarLogProxy.java b/src/com/fjy/proxy/StaticProxy/CarLogProxy.java
new file mode 100644
index 0000000..3d1a402
--- /dev/null
+++ b/src/com/fjy/proxy/StaticProxy/CarLogProxy.java
@@ -0,0 +1,17 @@
+package com.fjy.proxy.StaticProxy;
+
+public class CarLogProxy implements MoveAble{
+ private MoveAble moveAble;
+
+ public CarLogProxy(MoveAble moveAble) {
+ super();
+ this.moveAble=moveAble;
+ }
+
+ @Override
+ public void run() {
+ System.out.println("日志开始....");
+ moveAble.run();
+ System.out.println("日志结束....");
+ }
+}
diff --git a/src/com/fjy/proxy/StaticProxy/CarTimeProxy.java b/src/com/fjy/proxy/StaticProxy/CarTimeProxy.java
new file mode 100644
index 0000000..af02140
--- /dev/null
+++ b/src/com/fjy/proxy/StaticProxy/CarTimeProxy.java
@@ -0,0 +1,21 @@
+package com.fjy.proxy.StaticProxy;
+
+public class CarTimeProxy implements MoveAble{
+
+ private MoveAble moveAble;
+
+ public CarTimeProxy(MoveAble moveAble) {
+ super();
+ this.moveAble=moveAble;
+ }
+
+ @Override
+ public void run() {
+ long startTime = System.currentTimeMillis();
+ System.out.println("汽车开始行驶...");
+ moveAble.run();
+ long endTime = System.currentTimeMillis();
+ System.out.println("汽车结束行驶.... 汽车行驶时间:"
+ + (endTime - startTime) + "毫秒!");
+ }
+}
diff --git a/src/com/fjy/proxy/StaticProxy/Client.java b/src/com/fjy/proxy/StaticProxy/Client.java
index 6257fae..2ec46b7 100644
--- a/src/com/fjy/proxy/StaticProxy/Client.java
+++ b/src/com/fjy/proxy/StaticProxy/Client.java
@@ -7,26 +7,38 @@ public class Client {
*/
public static void main(String[] args) {
RunByCarProxy();
- System.out.println("===========");
RunByCarAggregationProxy();
+ RunByModulProxy();
}
//直接运行
private static void RunByCar(){
- System.out.println("不使用代理开车");
+ System.out.println("===========不使用代理开车===========");
Car car = new Car();
car.run();
}
//使用集成代理
private static void RunByCarProxy(){
- System.out.println("使用集成代理开车");
+ System.out.println("===========使用集成代理开车===========");
CarIntegration carIntegration = new CarIntegration();
carIntegration.run();
}
//使用聚合代理
private static void RunByCarAggregationProxy(){
- System.out.println("使用聚合代理开车");
+ System.out.println("===========使用聚合代理开车===========");
Car car = new Car();
MoveAble moveAble = new CarAggregation(car);
moveAble.run();
}
+
+ //模组化代理
+ private static void RunByModulProxy(){
+ System.out.println("===========使用模组化代理开车===========");
+ Car car = new Car();
+ CarLogProxy carLogProxy = new CarLogProxy(car);
+ CarTimeProxy carTimeProxy = new CarTimeProxy(carLogProxy);
+ carTimeProxy.run();
+
+ }
+
+
}