mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 14:16:02 +00:00
docs: update business delegate
This commit is contained in:
1 parent
3a38e2be6b
commit
3812d22392
1 file changed
+12
-12
+12
-12
@@ -116,20 +116,20 @@ public class MobileClient {
|
|||||||
Finally, we can demonstrate the complete example in action.
|
Finally, we can demonstrate the complete example in action.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public static void main(String[]args){
|
public static void main(String[] args) {
|
||||||
|
|
||||||
// prepare the objects
|
// prepare the objects
|
||||||
var businessDelegate=new BusinessDelegate();
|
var businessDelegate = new BusinessDelegate();
|
||||||
var businessLookup=new BusinessLookup();
|
var businessLookup = new BusinessLookup();
|
||||||
businessLookup.setNetflixService(new NetflixService());
|
businessLookup.setNetflixService(new NetflixService());
|
||||||
businessLookup.setYouTubeService(new YouTubeService());
|
businessLookup.setYouTubeService(new YouTubeService());
|
||||||
businessDelegate.setLookupService(businessLookup);
|
businessDelegate.setLookupService(businessLookup);
|
||||||
|
|
||||||
// create the client and use the Business Delegate
|
// create the client and use the business delegate
|
||||||
var client=new MobileClient(businessDelegate);
|
var client = new MobileClient(businessDelegate);
|
||||||
client.playbackMovie("Die Hard 2");
|
client.playbackMovie("Die Hard 2");
|
||||||
client.playbackMovie("Maradona: The Greatest Ever");
|
client.playbackMovie("Maradona: The Greatest Ever");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Here is the console output.
|
Here is the console output.
|
||||||
|
|||||||
Reference in new issue
Block a user