File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
view-helper/src/main/java/com/iluwatar/viewhelper Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments