August 2018
Intermediate to advanced
314 pages
8h 9m
English
The EmployeeStoreManager class is responsible for connecting with the data source as well as reading and writing employee data:
import com.packt.javaee8.entity.Employee;import java.util.HashMap;import java.util.Map;public class EmployeeStoreManager { private Map<Object, Employee> dataSource = new HashMap<>(); public void storeNew ( Employee employee ) throws Exception { if( dataSource.containsKey( employee.getId() ) ) throw new Exception( "Data already exist" ); dataSource.put( employee.getId(), employee ); } public void update ( Employee employee ) throws Exception { if( !dataSource.containsKey( employee.getId() ) ) throw new Exception( "Data not exist" ); dataSource.put( employee.getId(), employee ...
Read now
Unlock full access