We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 442e1f8 commit bf56994Copy full SHA for bf56994
view-helper/src/main/java/com/iluwatar/viewhelper/ProductController.java
@@ -0,0 +1,21 @@
1
+package com.iluwatar.viewhelper;
2
+
3
+/**
4
+ * Controller delegates a {@link Product} to {@link ProductViewHelper} and then to {@link ConsoleProductView}.
5
+ */
6
+public class ProductController {
7
8
+ private final ViewHelper<Product, ProductViewModel> viewHelper;
9
+ private final View<ProductViewModel> view;
10
11
+ public ProductController(ViewHelper<Product, ProductViewModel> viewHelper,
12
+ View<ProductViewModel> view) {
13
+ this.viewHelper = viewHelper;
14
+ this.view = view;
15
+ }
16
17
+ /** Passes the product to the helper for formatting and then forwards formatted product to the view. */
18
+ public void handle(Product product) {
19
+ view.render(viewHelper.prepare(product));
20
21
+}
0 commit comments