[JAVA-14174] Renamed paterns to paterns-module (#12718)
* [JAVA-14174] Renamed paterns to paterns-module * [JAVA-14174] naming fixes Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.baeldung.dip.daoimplementations;
|
||||
|
||||
import com.baeldung.dip.daos.CustomerDao;
|
||||
import com.baeldung.dip.entities.Customer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class SimpleCustomerDao implements CustomerDao {
|
||||
|
||||
private Map<Integer, Customer> customers = new HashMap<>();
|
||||
|
||||
public SimpleCustomerDao() {
|
||||
|
||||
}
|
||||
|
||||
public SimpleCustomerDao(Map<Integer, Customer> customers) {
|
||||
this.customers = customers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Customer> findById(int id) {
|
||||
return Optional.ofNullable(customers.get(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Customer> findAll() {
|
||||
return new ArrayList<>(customers.values());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
module com.baeldung.dip.daoimplementations {
|
||||
requires com.baeldung.dip.entities;
|
||||
requires com.baeldung.dip.daos;
|
||||
provides com.baeldung.dip.daos.CustomerDao with com.baeldung.dip.daoimplementations.SimpleCustomerDao;
|
||||
exports com.baeldung.dip.daoimplementations;
|
||||
}
|
||||
Reference in New Issue
Block a user