Skip to content

Commit cca57bf

Browse files
committed
docs: update virtual proxy
1 parent 3eb5813 commit cca57bf

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

virtual-proxy/README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ The `VideoObjectProxy` serves as a stand-in for `RealExpensiveObject`.
7474
```java
7575
@Getter
7676
public class VideoObjectProxy implements ExpensiveObject {
77+
7778
private RealVideoObject realVideoObject;
7879

7980
public void setRealVideoObject(RealVideoObject realVideoObject) {
@@ -93,23 +94,21 @@ public class VideoObjectProxy implements ExpensiveObject {
9394
And here’s how the proxy is used in the system.
9495

9596
```java
96-
ExpensiveObject object = new VirtualProxy();
97-
object.process(); // The real object is created at this point
98-
object.process(); // Uses the already created object
97+
public static void main(String[] args) {
98+
ExpensiveObject videoObject = new VideoObjectProxy();
99+
videoObject.process(); // The first call creates and plays the video
100+
videoObject.process(); // Subsequent call uses the already created object
101+
}
99102
```
100103

101104
Program output:
102105

103106
```
104-
13:11:13.583 [main] INFO com.iluwatar.virtual.proxy.RealVideoObject -- Loading initial video configurations...
105-
13:11:13.585 [main] INFO com.iluwatar.virtual.proxy.RealVideoObject -- Processing and playing video content...
106-
13:11:13.585 [main] INFO com.iluwatar.virtual.proxy.RealVideoObject -- Processing and playing video content...
107+
14:54:30.602 [main] INFO com.iluwatar.virtual.proxy.RealVideoObject -- Loading initial video configurations...
108+
14:54:30.604 [main] INFO com.iluwatar.virtual.proxy.RealVideoObject -- Processing and playing video content...
109+
14:54:30.604 [main] INFO com.iluwatar.virtual.proxy.RealVideoObject -- Processing and playing video content...
107110
```
108111

109-
## Class diagram
110-
111-
![Virtual Proxy](./etc/virtual.proxy.urm.png "Virtual Proxy pattern class diagram")
112-
113112
## Applicability
114113

115114
Use the Virtual Proxy pattern when:
@@ -120,7 +119,7 @@ Use the Virtual Proxy pattern when:
120119

121120
## Tutorials
122121

123-
* [The Proxy Pattern in Java - Baeldung](https://www.baeldung.com/java-proxy-pattern)
122+
* [The Proxy Pattern in Java (Baeldung)](https://www.baeldung.com/java-proxy-pattern)
124123

125124
## Known Uses
126125

0 commit comments

Comments
 (0)