Create a class hierarchy. Topic for your hierarchy will be provided by your mentors. please request it in your chat with a mentor.
Home Task Requirements #3 #4 #5 #6 #7 #8 #9 #10 #11 #12
SUBJECT: Phone
Home Task #3
Requirements | Implementation |
---|---|
Create at least 10 classes | Created different types of phone brands |
All classes must contain properties | Each phone brand contains unique feature |
Create at least 10 classes | Created different types of phone brands |
At least 5 private properties | Each phone brand has private variables ex: phoneMotto for brand slogan |
All private variable must have getters and setter methods | All classes contain getters and setters methods |
All classes should have at least one custom constructor | Constructors for each class call different variables |
Create separate class with main() which will instantiate objects of implemented classes.
Home Task #4
Requirements | Implementation |
---|---|
Use polymorphism with at least one abstract class | Apple class with Phone class multiple methods |
Create and override at least one abstract method | method showFeature() is abstract and overrides on Samsung |
Use protected modifier at least 5 | Phone class uses 5 protected modifiers in its variables |
Override methods from class Object (toString(), hashcode(), equals()) for at least 3 classes from the hierarchy. | Classes Samsung, Xiaomi, Motorola uses the toString() to override a method |
Home Task #5
Requirements | Implementation |
---|---|
Add 5 interfaces to the existing hierarchy | apple, lg, nokia, sony, & phone classes |
Use polymorphism with the abstract class and interface from the hierarchy. | connectToWifi() -> Apple -> Phone -> interfaces.com.solvd.laba.Connectivity |
Create final class, method, variable | Xiaomi class |
Create a static block, method, variable | Huawei class |
Home Task #6
Requirements | Implementation |
---|---|
Create 5 custom exceptions | Created a PhoneExceptions class with 5 custom exceptions under exceptions package |
Handle exceptions in 2 ways |
|
Use try-catch with resources | Used the InputSelectionException and try-with-resources to end program |
Log messages to the console, file | Used LOGGER.info.severe.warning to prompt multiple statements |
Home Task #7
Requirements | Implementation |
---|---|
Add 5 collections to the hierarchy |
|
Use polymorphism with the abstract class and interface from the hierarchy | connectToWifi() -> Apple -> Phone -> interfaces.com.solvd.laba.Connectivity |
Create custom implementation of LinkedList with generic and use it in your project | Added the generic class CustomLinkedList and use it to implement a LinkedList in the com.solvd.laba.PhoneMenu class |
Home Task #8
Requirements | Implementation |
---|---|
Move all projects to Maven | moved project into maven repository |
Build jar file and deploy to the local repository | SNAPSHOT.jar file in the target folder |
Add and use 2 Plugins | Added log4j-core & log4j-api and then commons-lang3 & commons-io |
Run mvn for different phases from the Maven lifecycle. Check the result. | Used clean, validate and deploy |
Home Task #9
Requirements | Implementation |
---|---|
Read text from the file and calculate the numbers of the unique words | Created a text file phone_Information.txt |
Write the result to the file | Output file is called phone_colors_unique_words.txt |
com.solvd.laba.Main requirement is: using StringUtils and FileUtils to implement it with minimum lines of code |
|
|
Home Task #10
Requirements | Implementation |
---|---|
Use at least 5 lambda functions from the java.util.function package |
|
Create 3 custom Lambda functions with generics |
|
Create 5 complex Enums(with fields, methods, blocks |
|
Home Task #11
Requirements | Implementation |
---|---|
Add 7 collection streaming in the hierarchy with terminal and non-terminal operations |
|
Handle exceptions in 2 ways |
|
Using reflection extract information(modifiers, return types, parameters, etc) about fields, constructors, methods. Create object and call method using the only reflection | Created a reflection class PhoneReflection to extract information from constructors fields and methods from Samsung class |
Log messages to the console, file | Used LOGGER.info.severe.warning to prompt multiple statements |
Home Task #12
Requirements | Implementation |
---|---|
Create 2 Threads using Runnable and Thread | Package thread 2 threads PhoneThread and PhoneRunnable to implement threads |
Create Connection Pool. Use collection from java.util.concurrent package. Connection class may be mocked. The pool should be threadsafe and lazy initialized. | ConnectionPool has a size of 5 and uses singlenton thread |
Initialize Connection Pool object of size 5. Load Connection Pool using single threads and Java Thread Pool (7 threads in total) | Connection class and also created the DemoConnectionPool class to demonstrate usage |
5 threads should be able to get the connection. 2 Threads should wait for the next available connection. The program should wait as well | Connection class and also created the DemoConnectionPool class to demonstrate usage |
Implement previous point but with interfaces Future and CompletableStage | ConnectionPool class as well as DemoConnectionPool class implement all three tasks on Connection pool, refer to comments in both classes |
Home Task #13
Requirements | Implementation |
---|---|
Build hierarchy for Schema from the below course | DAO and Model hierarchy classes have been created |
Create DAO classes with necessary interfaces, abstract classes, and Generics. DAO should be scalable and flexible to support another framework and another database as well. All CRUD operations should be supported using JDBC. Use connection pool from the below block | dao, model, and services packages; dao contains jdbc package with DAO implementaion class with a generic DAO interface, model package contains all Model classes, and services contains implementations package has well has Generic Services |
Implement Service layer with necessary abstraction to be able to switch between databases and frameworks | Service package -> Generic Services interface & implementation package with Services for classes. |
Home Task #14
Requirements | Implementation |
---|---|
Create one XML file and XSD schema for at least 5 classes from the below hierarchy | Added XML and XSD that contains 5 classes: Brands,Countries,OperatingSystem,Phones,and UserAccounts |
Validate XML file using XSD schema and assigned parser | Used validateXMLAgainstXSD, SchemaFactory, and the validator classes to perform the validation process |
Parse XML file using one of the parsers from the title | The com.solvd.laba.ParserRunner clas parsers the XML file using the DocumentBuilder class. |
Home Task #15
Requirements | Implementation |
---|---|
Add JAXB annotations to the hierarchy. Date, List, and complex objects should be covered | Added JAXB annotations to the model hierarchy date is being handle by Brand Model as Phone Brand Foundation Date and list is handle by Phone Model for Phone Features every other complex objects is from other classes |
Parse XML using JAXB | The JAXBParserRunner class uses the JAXBContext class to create a JAXB context for the PhoneData class: JAXBContext and other methods such as unmarshall; Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); |
Home Task #16
Requirements | Implementation |
---|---|
Create one Json file for at least 5 classes from the hierarchy. | phone.json file is under resources with 5 classes: Brand, Country, OperatingSystem, Phone, User Accounts |
Add Jackson’s annotation to the hierarchy. Date, List, and complex objects should be covered. | Model classes have Jackson's annotation in the hierarchy. Brand covers dates, Phone covers list by phone features |
Parse JSON using Jackson | JSONParserRunner parse the JSON file by using Jackson by using object mapper |
Home Task #17
Requirements | Implementation |
---|---|
Add MyBatis DAOs to the existing hierarchy with the same requirements. Choose any XML or interface mapping. | Implementation here |
Switch service classes to MyBatis. | Implementation here |
This is an attempt by Ella to make minor changes and perform a pull request. Please make sure the changes are visible on your side, and merge if no conflicts