-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuFactory.java
More file actions
35 lines (32 loc) · 853 Bytes
/
MenuFactory.java
File metadata and controls
35 lines (32 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.hexaware.MLP156.factory;
import com.hexaware.MLP156.persistence.MenuDAO;
import com.hexaware.MLP156.persistence.DbConnection;
import java.util.List;
import com.hexaware.MLP156.model.Menu;
/**
* MenuFactory class used to fetch menu data from database.
* @author hexware
*/
public class MenuFactory {
/**
* Protected constructor.
*/
protected MenuFactory() {
}
/**
* Call the data base connection.
* @return the connection object.
*/
private static MenuDAO dao() {
DbConnection db = new DbConnection();
return db.getConnect().onDemand(MenuDAO.class);
}
/**
* Call the data base connection.
* @return the array of menu object.
*/
public static Menu[] showMenu() {
List<Menu> menu = dao().show();
return menu.toArray(new Menu[menu.size()]);
}
}