private EmployeeBean prepareEmployeeBean(Employee employee) { EmployeeBean bean = new EmployeeBean(); bean.setAddress(employee.getEmpAddress()); bean.setAge(employee.getEmpAge()); bean.setName(employee.getEmpName()); bean.setSalary(employee.getSalary()); bean.setId(employee.getEmpId()); return bean; }
private Employee prepareModel(EmployeeBean employeeBean) { Employee employee = new Employee(); employee.setEmpAddress(employeeBean.getAddress()); employee.setEmpAge(employeeBean.getAge()); employee.setEmpName(employeeBean.getName()); employee.setSalary(employeeBean.getSalary()); employee.setEmpId(employeeBean.getId()); employeeBean.setId(null); return employee; }
private List<EmployeeBean> prepareListofBean(List<Employee> employees) { List<EmployeeBean> beans = null; if (employees != null && !employees.isEmpty()) { beans = new ArrayList<EmployeeBean>(); EmployeeBean bean = null; for (Employee employee : employees) { bean = new EmployeeBean(); bean.setName(employee.getEmpName()); bean.setId(employee.getEmpId()); bean.setAddress(employee.getEmpAddress()); bean.setSalary(employee.getSalary()); bean.setAge(employee.getEmpAge()); beans.add(bean); } } return beans; }