Java Development Kit 11+
Apache Maven 3.6.0+
Git 2.24+
(1-2 stars)
- Create maven project with 5 modules (see Java 9 modules) :
- jmp-bank-api
- jmp-service-api
- jmp-cloud-bank-impl
- jmp-cloud-service-impl
- jmp-dto
- Create the fallowing classes under jmp-dto module :
- [User]
String name;
String surname;
LocalDate birthday;
- [BankCard]
String number;
User user;
- [Subscription]
String bankcard;
LocalDate startDate;
- Extend BankCard class with :
- CreditBankCard
- DebitBankCard
- Create enum :
- [BankCardType]
CREDIT
DEBIT
- Add Bank interface to jmp-bank-api with :
- BankCard createBankCard(User, BankCardType);
- Add module-info.java which :
- requires jmp-dto
- export Bank interface
- Implement Bank into jmp-cloud-bank-impl. Method should create a new class depending on the type:
- Add module-info.java which :
- requires transitive module with Bank interface
- requires jmp-dto
- exports implementation of Bank interface
- Add Service interface to jmp-service-api with :
- void subscribe(BankCard)
- Optional<Subscription> getSubscriptionByBankCardNumber(String)
- List<User> getAllUsers();
- Add module-info.java which :
- requires jmp-dto
- export Service interface
- Implement Service into jmp-cloud-service-impl. User Stream API, You can use Memory/DB for data storing :
- Add module-info.java which :
- requires transitive module with Service interface
- requires jmp-dto
- exports implementation of Service interface
- Use var for definition of local variables wherever it’s applicable.
- Use lambdas and Java 8 features wherever it’s applicable.
- Create application module.
- Add module-info.java which :
- use interfaces
- requires module with Bank implementation
- requires module with Service implementation
- requires jmp.dto;
- Demonstrate functionality of created classes. (3-4 stars)
- Add a new default method for Service interface, which uses getAllUsers. Use LocalDate.now(), ChronoUnit и mapToLong.
- double getAverageUsersAge();
- Add a new static method for Service interface, which returns true, if the user is over 18 years old.
- boolean isPayableUser(User);
- Use Collectors.toUnmodifiableList() and method reference it’s applicable. (5 stars)
- Create Exception class which will be used into orElseThrow for Optional from getSubscriptionByBankCardNumber().
- Add a new method for Service interface and implement it. Demonstrate this method ino application module:
- List<Subscription> getAllSubscriptionsByCondition(Predicate<Subscription>);
- Reimplement createBankCard with method reference (ex: CreditBankCard::new).
- Add to module-info jar for each implementation module :
- provides [interface] with [implementation]
- Add a module with Service implementation. Try to use ServiceLoader.load() for module loading.