[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:
panos-kakos
2022-09-19 07:44:14 +01:00
committed by GitHub
parent 368dd6de19
commit b153cff200
518 changed files with 32 additions and 32 deletions

View File

@@ -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());
}
}

View File

@@ -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;
}