From c32a01923cf16fd7a50f5a3ce9812927d022cbfd Mon Sep 17 00:00:00 2001 From: Mughees Qasim <45170085+MugheesQasim@users.noreply.github.com> Date: Tue, 11 Apr 2023 04:12:00 +0500 Subject: [PATCH 1/4] Issue #2377: The repository code has been refactored to use the record class --- .../main/java/com/iluwatar/builder/Hero.java | 42 ++------------ .../java/com/iluwatar/builder/HeroTest.java | 12 ++-- .../src/main/java/com/iluwatar/monad/App.java | 8 +-- .../main/java/com/iluwatar/monad/User.java | 47 ++++------------ .../java/com/iluwatar/monad/MonadTest.java | 14 ++--- .../com/iluwatar/nullobject/NodeImpl.java | 28 +++------- .../com/iluwatar/partialresponse/Video.java | 56 +++++-------------- .../partialresponse/VideoResource.java | 22 +++----- .../privateclassdata/ImmutableStew.java | 2 +- .../iluwatar/privateclassdata/StewData.java | 35 ++---------- .../iluwatar/producer/consumer/Consumer.java | 2 +- .../com/iluwatar/producer/consumer/Item.java | 23 +------- .../java/com/iluwatar/registry/Customer.java | 18 +----- .../iluwatar/registry/CustomerRegistry.java | 2 +- .../registry/CustomerRegistryTest.java | 8 +-- .../java/com/iluwatar/retry/FindCustomer.java | 27 ++++----- .../invoice/InvoiceGenerator.java | 28 ++++------ .../com/iluwatar/servicetoworker/Action.java | 6 +- .../com/iluwatar/servicetoworker/Command.java | 30 +++------- 19 files changed, 113 insertions(+), 297 deletions(-) diff --git a/builder/src/main/java/com/iluwatar/builder/Hero.java b/builder/src/main/java/com/iluwatar/builder/Hero.java index ecc6ec711719..c36a0d53251b 100644 --- a/builder/src/main/java/com/iluwatar/builder/Hero.java +++ b/builder/src/main/java/com/iluwatar/builder/Hero.java @@ -25,48 +25,14 @@ package com.iluwatar.builder; /** - * Hero, the class with many parameters. + * Hero, the record class */ -public final class Hero { - private final Profession profession; - private final String name; - private final HairType hairType; - private final HairColor hairColor; - private final Armor armor; - private final Weapon weapon; +public record Hero(Profession profession,String name,HairType hairType,HairColor hairColor,Armor armor,Weapon weapon) +{ private Hero(Builder builder) { - this.profession = builder.profession; - this.name = builder.name; - this.hairColor = builder.hairColor; - this.hairType = builder.hairType; - this.weapon = builder.weapon; - this.armor = builder.armor; - } - - public Profession getProfession() { - return profession; - } - - public String getName() { - return name; - } - - public HairType getHairType() { - return hairType; - } - - public HairColor getHairColor() { - return hairColor; - } - - public Armor getArmor() { - return armor; - } - - public Weapon getWeapon() { - return weapon; + this(builder.profession,builder.name,builder.hairType,builder.hairColor,builder.armor,builder.weapon); } @Override diff --git a/builder/src/test/java/com/iluwatar/builder/HeroTest.java b/builder/src/test/java/com/iluwatar/builder/HeroTest.java index 27f7fb931dab..fe70d1547b88 100644 --- a/builder/src/test/java/com/iluwatar/builder/HeroTest.java +++ b/builder/src/test/java/com/iluwatar/builder/HeroTest.java @@ -69,12 +69,12 @@ void testBuildHero() { assertNotNull(hero); assertNotNull(hero.toString()); - assertEquals(Profession.WARRIOR, hero.getProfession()); - assertEquals(heroName, hero.getName()); - assertEquals(Armor.CHAIN_MAIL, hero.getArmor()); - assertEquals(Weapon.SWORD, hero.getWeapon()); - assertEquals(HairType.LONG_CURLY, hero.getHairType()); - assertEquals(HairColor.BLOND, hero.getHairColor()); + assertEquals(Profession.WARRIOR, hero.profession()); + assertEquals(heroName, hero.name()); + assertEquals(Armor.CHAIN_MAIL, hero.armor()); + assertEquals(Weapon.SWORD, hero.weapon()); + assertEquals(HairType.LONG_CURLY, hero.hairType()); + assertEquals(HairColor.BLOND, hero.hairColor()); } diff --git a/monad/src/main/java/com/iluwatar/monad/App.java b/monad/src/main/java/com/iluwatar/monad/App.java index 680bf8c9e3e4..7ee04f1b8c31 100644 --- a/monad/src/main/java/com/iluwatar/monad/App.java +++ b/monad/src/main/java/com/iluwatar/monad/App.java @@ -54,10 +54,10 @@ public class App { */ public static void main(String[] args) { var user = new User("user", 24, Sex.FEMALE, "foobar.com"); - LOGGER.info(Validator.of(user).validate(User::getName, Objects::nonNull, "name is null") - .validate(User::getName, name -> !name.isEmpty(), "name is empty") - .validate(User::getEmail, email -> !email.contains("@"), "email doesn't contains '@'") - .validate(User::getAge, age -> age > 20 && age < 30, "age isn't between...").get() + LOGGER.info(Validator.of(user).validate(User::name, Objects::nonNull, "name is null") + .validate(User::name, name -> !name.isEmpty(), "name is empty") + .validate(User::email, email -> !email.contains("@"), "email doesn't contains '@'") + .validate(User::age, age -> age > 20 && age < 30, "age isn't between...").get() .toString()); } } diff --git a/monad/src/main/java/com/iluwatar/monad/User.java b/monad/src/main/java/com/iluwatar/monad/User.java index d6647d03209f..b72da017574c 100644 --- a/monad/src/main/java/com/iluwatar/monad/User.java +++ b/monad/src/main/java/com/iluwatar/monad/User.java @@ -27,41 +27,16 @@ /** * User Definition. */ -public class User { - private final String name; - private final int age; - private final Sex sex; - private final String email; - - /** - * Constructor. - * - * @param name - name - * @param age - age - * @param sex - sex - * @param email - email address - */ - public User(String name, int age, Sex sex, String email) { - this.name = name; - this.age = age; - this.sex = sex; - this.email = email; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public Sex getSex() { - return sex; - } - - public String getEmail() { - return email; - } +/** + * Record class + * + * @param name - name + * @param age - age + * @param sex - sex + * @param email - email address + */ +public record User(String name, int age, Sex sex, String email) +{ } + diff --git a/monad/src/test/java/com/iluwatar/monad/MonadTest.java b/monad/src/test/java/com/iluwatar/monad/MonadTest.java index 44d587b087ed..1eed42b12bc4 100644 --- a/monad/src/test/java/com/iluwatar/monad/MonadTest.java +++ b/monad/src/test/java/com/iluwatar/monad/MonadTest.java @@ -41,7 +41,7 @@ void testForInvalidName() { assertThrows( IllegalStateException.class, () -> Validator.of(tom) - .validate(User::getName, Objects::nonNull, "name cannot be null") + .validate(User::name, Objects::nonNull, "name cannot be null") .get() ); } @@ -52,8 +52,8 @@ void testForInvalidAge() { assertThrows( IllegalStateException.class, () -> Validator.of(john) - .validate(User::getName, Objects::nonNull, "name cannot be null") - .validate(User::getAge, age -> age > 21, "user is underage") + .validate(User::name, Objects::nonNull, "name cannot be null") + .validate(User::age, age -> age > 21, "user is underage") .get() ); } @@ -62,10 +62,10 @@ void testForInvalidAge() { void testForValid() { var sarah = new User("Sarah", 42, Sex.FEMALE, "sarah@det.org"); var validated = Validator.of(sarah) - .validate(User::getName, Objects::nonNull, "name cannot be null") - .validate(User::getAge, age -> age > 21, "user is underage") - .validate(User::getSex, sex -> sex == Sex.FEMALE, "user is not female") - .validate(User::getEmail, email -> email.contains("@"), "email does not contain @ sign") + .validate(User::name, Objects::nonNull, "name cannot be null") + .validate(User::age, age -> age > 21, "user is underage") + .validate(User::sex, sex -> sex == Sex.FEMALE, "user is not female") + .validate(User::email, email -> email.contains("@"), "email does not contain @ sign") .get(); assertSame(validated, sarah); } diff --git a/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java b/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java index c35f4afb9edf..db7b73f86196 100644 --- a/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java +++ b/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java @@ -29,27 +29,10 @@ /** * Implementation for binary tree's normal nodes. */ -@Slf4j -public class NodeImpl implements Node { - - private final String name; - private final Node left; - private final Node right; - - /** - * Constructor. - */ - public NodeImpl(String name, Node left, Node right) { - this.name = name; - this.left = left; - this.right = right; - } - - @Override - public int getTreeSize() { - return 1 + left.getTreeSize() + right.getTreeSize(); - } +@Slf4j +public record NodeImpl(String name,Node left,Node right) implements Node +{ @Override public Node getLeft() { return left; @@ -64,7 +47,10 @@ public Node getRight() { public String getName() { return name; } - + @Override + public int getTreeSize() { + return 1 + left.getTreeSize() + right.getTreeSize(); + } @Override public void walk() { LOGGER.info(name); diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 98322c4fab0d..4ff90e84db46 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -26,48 +26,20 @@ /** * {@link Video} is a entity to serve from server.It contains all video related information. + * Video is a record class */ -public class Video { - private final Integer id; - private final String title; - private final Integer length; - private final String description; - private final String director; - private final String language; - /** - * Constructor. - * - * @param id video unique id - * @param title video title - * @param len video length in minutes - * @param desc video description by publisher - * @param director video director name - * @param lang video language {private, public} - */ - public Video(Integer id, String title, Integer len, String desc, String director, String lang) { - this.id = id; - this.title = title; - this.length = len; - this.description = desc; - this.director = director; - this.language = lang; - } - - /** - * ToString. - * - * @return json representaion of video - */ - @Override - public String toString() { - return "{" - + "\"id\": " + id + "," - + "\"title\": \"" + title + "\"," - + "\"length\": " + length + "," - + "\"description\": \"" + description + "\"," - + "\"director\": \"" + director + "\"," - + "\"language\": \"" + language + "\"," - + "}"; - } +public record Video(Integer id, String title, Integer length, String description, String director, String language) +{ + @Override + public String toString() { + return "{" + + "\"id\": " + id + "," + + "\"title\": \"" + title + "\"," + + "\"length\": " + length + "," + + "\"description\": \"" + description + "\"," + + "\"director\": \"" + director + "\"," + + "\"language\": \"" + language + "\"," + + "}"; + } } diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index 9289857bede4..02ce392f67f3 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -27,24 +27,18 @@ import java.util.Map; /** - * The resource class which serves video information. This class act as server in the demo. Which + * The resource record class which serves video information. This class act as server in the demo. Which * has all video details. */ -public class VideoResource { - private final FieldJsonMapper fieldJsonMapper; - private final Map videos; - /** - * Constructor. - * - * @param fieldJsonMapper map object to json. - * @param videos initialize resource with existing videos. Act as database. - */ - public VideoResource(FieldJsonMapper fieldJsonMapper, Map videos) { - this.fieldJsonMapper = fieldJsonMapper; - this.videos = videos; - } +/** + * + * @param fieldJsonMapper map object to json. + * @param videos initialize resource with existing videos. Act as database. + */ +public record VideoResource(FieldJsonMapper fieldJsonMapper, Map videos) +{ /** * Get Details. * diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java index 34d0875c254d..e13577911eb5 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java @@ -44,6 +44,6 @@ public ImmutableStew(int numPotatoes, int numCarrots, int numMeat, int numPepper public void mix() { LOGGER .info("Mixing the immutable stew we find: {} potatoes, {} carrots, {} meat and {} peppers", - data.getNumPotatoes(), data.getNumCarrots(), data.getNumMeat(), data.getNumPeppers()); + data.numPotatoes(), data.numCarrots(), data.numMeat(), data.numPeppers()); } } diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java index e3900f175ba7..98888be77407 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java @@ -27,36 +27,11 @@ /** * Stew ingredients. */ -public class StewData { - private final int numPotatoes; - private final int numCarrots; - private final int numMeat; - private final int numPeppers; - - /** - * Constructor. - */ - public StewData(int numPotatoes, int numCarrots, int numMeat, int numPeppers) { - this.numPotatoes = numPotatoes; - this.numCarrots = numCarrots; - this.numMeat = numMeat; - this.numPeppers = numPeppers; - } - - public int getNumPotatoes() { - return numPotatoes; - } - - public int getNumCarrots() { - return numCarrots; - } - - public int getNumMeat() { - return numMeat; - } +/** + * Record class + */ - public int getNumPeppers() { - return numPeppers; - } +public record StewData(int numPotatoes, int numCarrots, int numMeat, int numPeppers) +{ } diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java index e3879214c1c1..1d26f2b4a5fa 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java @@ -47,7 +47,7 @@ public Consumer(String name, ItemQueue queue) { public void consume() throws InterruptedException { var item = queue.take(); LOGGER.info("Consumer [{}] consume item [{}] produced by [{}]", name, - item.getId(), item.getProducer()); + item.id(), item.producer()); } } diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java index e7b79bdfde6e..f9ad4cc64447 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java @@ -27,25 +27,6 @@ /** * Class take part of an {@link Producer}-{@link Consumer} exchange. */ -public class Item { - - private final String producer; - - private final int id; - - public Item(String producer, int id) { - this.id = id; - this.producer = producer; - } - - public int getId() { - - return id; - } - - public String getProducer() { - - return producer; - } - +public record Item(String producer,int id) +{ } diff --git a/registry/src/main/java/com/iluwatar/registry/Customer.java b/registry/src/main/java/com/iluwatar/registry/Customer.java index b544ed63bab2..682589ae1d32 100644 --- a/registry/src/main/java/com/iluwatar/registry/Customer.java +++ b/registry/src/main/java/com/iluwatar/registry/Customer.java @@ -27,23 +27,7 @@ /** * Customer entity used in registry pattern example. */ -public class Customer { - - private final String id; - private final String name; - - public Customer(String id, String name) { - this.id = id; - this.name = name; - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } +public record Customer(String id,String name) { @Override public String toString() { diff --git a/registry/src/main/java/com/iluwatar/registry/CustomerRegistry.java b/registry/src/main/java/com/iluwatar/registry/CustomerRegistry.java index f1e8bbf217d4..14039ca8b5a7 100644 --- a/registry/src/main/java/com/iluwatar/registry/CustomerRegistry.java +++ b/registry/src/main/java/com/iluwatar/registry/CustomerRegistry.java @@ -45,7 +45,7 @@ private CustomerRegistry() { } public Customer addCustomer(Customer customer) { - return customerMap.put(customer.getId(), customer); + return customerMap.put(customer.id(), customer); } public Customer getCustomer(String id) { diff --git a/registry/src/test/java/com/iluwatar/registry/CustomerRegistryTest.java b/registry/src/test/java/com/iluwatar/registry/CustomerRegistryTest.java index c39c03654f4d..af0697c458c9 100644 --- a/registry/src/test/java/com/iluwatar/registry/CustomerRegistryTest.java +++ b/registry/src/test/java/com/iluwatar/registry/CustomerRegistryTest.java @@ -50,13 +50,13 @@ void shouldBeAbleToAddAndQueryCustomerObjectFromRegistry() { Customer customerWithId1 = customerRegistry.getCustomer("1"); assertNotNull(customerWithId1); - assertEquals("1", customerWithId1.getId()); - assertEquals("john", customerWithId1.getName()); + assertEquals("1", customerWithId1.id()); + assertEquals("john", customerWithId1.name()); Customer customerWithId2 = customerRegistry.getCustomer("2"); assertNotNull(customerWithId2); - assertEquals("2", customerWithId2.getId()); - assertEquals("julia", customerWithId2.getName()); + assertEquals("2", customerWithId2.id()); + assertEquals("julia", customerWithId2.name()); } @Test diff --git a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java index b11af29b242e..391c7374dfea 100644 --- a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java +++ b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java @@ -25,6 +25,7 @@ package com.iluwatar.retry; import java.util.ArrayDeque; +import java.util.ArrayList; import java.util.Deque; import java.util.List; @@ -37,21 +38,21 @@ * * @author George Aristy (george.aristy@gmail.com) */ -public final class FindCustomer implements BusinessOperation { - private final String customerId; - private final Deque errors; - /** - * Ctor. - * - * @param customerId the final result of the remote operation - * @param errors the errors to throw before returning {@code customerId} - */ - public FindCustomer(String customerId, BusinessException... errors) { - this.customerId = customerId; - this.errors = new ArrayDeque<>(List.of(errors)); - } +/** + * Record class. + * + * @param customerId the final result of the remote operation + * @param errors the errors to throw before returning {@code customerId} + */ + +public record FindCustomer(String customerId, Deque errors) implements BusinessOperation +{ + public FindCustomer(String customerId, BusinessException... errors) + { + this(customerId,new ArrayDeque<>(List.of(errors))); + } @Override public String perform() throws BusinessException { if (!this.errors.isEmpty()) { diff --git a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java index 06231f81b0ad..c698e5a9db3b 100644 --- a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java +++ b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java @@ -28,25 +28,19 @@ * InvoiceGenerator class generates an invoice, accepting the product cost and calculating the total * price payable inclusive tax (calculated by {@link TaxCalculator}). */ -public class InvoiceGenerator { - /** - * The TaxCalculator interface to calculate the payable tax. - */ - private final TaxCalculator taxCalculator; - - /** - * The base product amount without tax. - */ - private final double amount; - - public InvoiceGenerator(double amount, TaxCalculator taxCalculator) { - this.amount = amount; - this.taxCalculator = taxCalculator; - } +/** + * TaxCalculator description: + * The TaxCalculator interface to calculate the payable tax. + */ +/** + * Amount description: + * The base product amount without tax. + */ +public record InvoiceGenerator(double amount,TaxCalculator taxCalculator) +{ public double getAmountWithTax() { return amount + taxCalculator.calculate(amount); } - -} \ No newline at end of file +} diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java index 9f885757a851..0cbd4075542f 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java @@ -27,9 +27,9 @@ public Action(GiantModel giant) { * @param command the command */ public void updateModel(Command command) { - setFatigue(command.getFatigue()); - setHealth(command.getHealth()); - setNourishment(command.getNourishment()); + setFatigue(command.fatigue()); + setHealth(command.health()); + setNourishment(command.nourishment()); } /** diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java index e58cf85cb331..5cc0e8030bcb 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java @@ -3,30 +3,18 @@ import com.iluwatar.model.view.controller.Fatigue; import com.iluwatar.model.view.controller.Health; import com.iluwatar.model.view.controller.Nourishment; -import lombok.Getter; /** * The type Command. */ -public class Command { - @Getter - private final Fatigue fatigue; - @Getter - private final Health health; - @Getter - private final Nourishment nourishment; - - /** - * Instantiates a new Command. - * - * @param fatigue the fatigue - * @param health the health - * @param nourishment the nourishment - */ - public Command(Fatigue fatigue, Health health, Nourishment nourishment) { - this.fatigue = fatigue; - this.health = health; - this.nourishment = nourishment; - } +/** + * Instantiates a new Command. + * + * @param fatigue the fatigue + * @param health the health + * @param nourishment the nourishment + */ +public record Command(Fatigue fatigue,Health health,Nourishment nourishment) +{ } From 5053e411e8108f7cc6e42aae0a4eb6af73417613 Mon Sep 17 00:00:00 2001 From: Mughees Qasim <45170085+MugheesQasim@users.noreply.github.com> Date: Tue, 11 Apr 2023 18:18:16 +0500 Subject: [PATCH 2/4] Issue #2377: Refactored according to the rules defined for the repo code --- builder/src/main/java/com/iluwatar/builder/Hero.java | 7 +++---- monad/src/main/java/com/iluwatar/monad/User.java | 3 +-- .../main/java/com/iluwatar/nullobject/NodeImpl.java | 3 +-- .../main/java/com/iluwatar/partialresponse/Video.java | 10 +++++++--- .../com/iluwatar/partialresponse/VideoResource.java | 3 +-- .../java/com/iluwatar/privateclassdata/StewData.java | 5 ++--- .../main/java/com/iluwatar/producer/consumer/Item.java | 3 +-- .../src/main/java/com/iluwatar/registry/Customer.java | 2 +- .../src/main/java/com/iluwatar/retry/FindCustomer.java | 7 ++----- .../separatedinterface/invoice/InvoiceGenerator.java | 3 +-- .../java/com/iluwatar/servicetoworker/Command.java | 3 +-- 11 files changed, 21 insertions(+), 28 deletions(-) diff --git a/builder/src/main/java/com/iluwatar/builder/Hero.java b/builder/src/main/java/com/iluwatar/builder/Hero.java index c36a0d53251b..1d15ac2f0a18 100644 --- a/builder/src/main/java/com/iluwatar/builder/Hero.java +++ b/builder/src/main/java/com/iluwatar/builder/Hero.java @@ -25,14 +25,13 @@ package com.iluwatar.builder; /** - * Hero, the record class + * Hero,the record class. */ -public record Hero(Profession profession,String name,HairType hairType,HairColor hairColor,Armor armor,Weapon weapon) -{ +public record Hero(Profession profession, String name, HairType hairType, HairColor hairColor, Armor armor, Weapon weapon) { private Hero(Builder builder) { - this(builder.profession,builder.name,builder.hairType,builder.hairColor,builder.armor,builder.weapon); + this(builder.profession, builder.name, builder.hairType, builder.hairColor, builder.armor, builder.weapon); } @Override diff --git a/monad/src/main/java/com/iluwatar/monad/User.java b/monad/src/main/java/com/iluwatar/monad/User.java index b72da017574c..511ab059de5d 100644 --- a/monad/src/main/java/com/iluwatar/monad/User.java +++ b/monad/src/main/java/com/iluwatar/monad/User.java @@ -36,7 +36,6 @@ * @param sex - sex * @param email - email address */ -public record User(String name, int age, Sex sex, String email) -{ +public record User(String name, int age, Sex sex, String email) { } diff --git a/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java b/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java index db7b73f86196..9dd4ccf2c9db 100644 --- a/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java +++ b/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java @@ -31,8 +31,7 @@ */ @Slf4j -public record NodeImpl(String name,Node left,Node right) implements Node -{ +public record NodeImpl(String name, Node left, Node right) implements Node { @Override public Node getLeft() { return left; diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 4ff90e84db46..7a2e462b55d2 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -26,11 +26,15 @@ /** * {@link Video} is a entity to serve from server.It contains all video related information. - * Video is a record class + * Video is a record class. */ -public record Video(Integer id, String title, Integer length, String description, String director, String language) -{ +public record Video(Integer id, String title, Integer length, String description, String director, String language) { + /** + * ToString. + * + * @return json representaion of video + */ @Override public String toString() { return "{" diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index 02ce392f67f3..c2cf4d5fe221 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -37,8 +37,7 @@ * @param videos initialize resource with existing videos. Act as database. */ -public record VideoResource(FieldJsonMapper fieldJsonMapper, Map videos) -{ +public record VideoResource(FieldJsonMapper fieldJsonMapper, Map videos) { /** * Get Details. * diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java index 98888be77407..04423d2456f7 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java @@ -29,9 +29,8 @@ */ /** - * Record class + * Record class. */ -public record StewData(int numPotatoes, int numCarrots, int numMeat, int numPeppers) -{ +public record StewData(int numPotatoes, int numCarrots, int numMeat, int numPeppers) { } diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java index f9ad4cc64447..51353ee7a785 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java @@ -27,6 +27,5 @@ /** * Class take part of an {@link Producer}-{@link Consumer} exchange. */ -public record Item(String producer,int id) -{ +public record Item(String producer, int id) { } diff --git a/registry/src/main/java/com/iluwatar/registry/Customer.java b/registry/src/main/java/com/iluwatar/registry/Customer.java index 682589ae1d32..75dd42a5f027 100644 --- a/registry/src/main/java/com/iluwatar/registry/Customer.java +++ b/registry/src/main/java/com/iluwatar/registry/Customer.java @@ -27,7 +27,7 @@ /** * Customer entity used in registry pattern example. */ -public record Customer(String id,String name) { +public record Customer(String id, String name) { @Override public String toString() { diff --git a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java index 391c7374dfea..b5a7d41d4ee7 100644 --- a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java +++ b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java @@ -25,7 +25,6 @@ package com.iluwatar.retry; import java.util.ArrayDeque; -import java.util.ArrayList; import java.util.Deque; import java.util.List; @@ -47,10 +46,8 @@ * @param errors the errors to throw before returning {@code customerId} */ -public record FindCustomer(String customerId, Deque errors) implements BusinessOperation -{ - public FindCustomer(String customerId, BusinessException... errors) - { +public record FindCustomer(String customerId, Deque errors) implements BusinessOperation { + public FindCustomer(String customerId, BusinessException... errors) { this(customerId,new ArrayDeque<>(List.of(errors))); } @Override diff --git a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java index c698e5a9db3b..759f5007ebdb 100644 --- a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java +++ b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java @@ -38,8 +38,7 @@ * Amount description: * The base product amount without tax. */ -public record InvoiceGenerator(double amount,TaxCalculator taxCalculator) -{ +public record InvoiceGenerator(double amount, TaxCalculator taxCalculator) { public double getAmountWithTax() { return amount + taxCalculator.calculate(amount); } diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java index 5cc0e8030bcb..d0923d38e4ba 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java @@ -15,6 +15,5 @@ * @param health the health * @param nourishment the nourishment */ -public record Command(Fatigue fatigue,Health health,Nourishment nourishment) -{ +public record Command(Fatigue fatigue, Health health, Nourishment nourishment) { } From e537c39e2d0ff11b8a9c8cd7297e2c4650fd6651 Mon Sep 17 00:00:00 2001 From: Mughees Qasim <45170085+MugheesQasim@users.noreply.github.com> Date: Tue, 11 Apr 2023 22:48:50 +0500 Subject: [PATCH 3/4] Issue #2377: Refactored according to the rules defined for the repo code --- .../intercepting/filter/TargetTest.java | 2 +- .../presenter/FileSelectorJframeTest.java | 2 +- .../main/java/com/iluwatar/monad/User.java | 6 +--- .../com/iluwatar/partialresponse/Video.java | 32 +++++++++---------- .../partialresponse/VideoResource.java | 3 -- .../iluwatar/privateclassdata/StewData.java | 4 --- .../java/com/iluwatar/retry/FindCustomer.java | 10 +----- .../invoice/InvoiceGenerator.java | 17 ++++------ .../com/iluwatar/servicetoworker/Action.java | 24 ++++++++++++++ .../com/iluwatar/servicetoworker/App.java | 24 ++++++++++++++ .../com/iluwatar/servicetoworker/Command.java | 27 ++++++++++++++-- .../iluwatar/servicetoworker/Dispatcher.java | 24 ++++++++++++++ .../servicetoworker/GiantController.java | 24 ++++++++++++++ .../iluwatar/servicetoworker/GiantModel.java | 24 ++++++++++++++ .../iluwatar/servicetoworker/GiantView.java | 24 ++++++++++++++ 15 files changed, 195 insertions(+), 52 deletions(-) diff --git a/intercepting-filter/src/test/java/com/iluwatar/intercepting/filter/TargetTest.java b/intercepting-filter/src/test/java/com/iluwatar/intercepting/filter/TargetTest.java index dcecb27300d4..dd4e09b84166 100644 --- a/intercepting-filter/src/test/java/com/iluwatar/intercepting/filter/TargetTest.java +++ b/intercepting-filter/src/test/java/com/iluwatar/intercepting/filter/TargetTest.java @@ -1,5 +1,5 @@ /* - * This project is licensed under the MIT license. Module intercepting-filter is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). * * The MIT License * Copyright © 2014-2022 Ilkka Seppälä diff --git a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorJframeTest.java b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorJframeTest.java index bad021dc1c80..da5788c8d6cc 100644 --- a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorJframeTest.java +++ b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorJframeTest.java @@ -1,5 +1,5 @@ /* - * This project is licensed under the MIT license. Module model-view-presenter is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). * * The MIT License * Copyright © 2014-2022 Ilkka Seppälä diff --git a/monad/src/main/java/com/iluwatar/monad/User.java b/monad/src/main/java/com/iluwatar/monad/User.java index 511ab059de5d..089279a8db59 100644 --- a/monad/src/main/java/com/iluwatar/monad/User.java +++ b/monad/src/main/java/com/iluwatar/monad/User.java @@ -25,11 +25,7 @@ package com.iluwatar.monad; /** - * User Definition. - */ - -/** - * Record class + * Record class. * * @param name - name * @param age - age diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 7a2e462b55d2..5c71f9bb37d3 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -30,20 +30,20 @@ */ public record Video(Integer id, String title, Integer length, String description, String director, String language) { - /** - * ToString. - * - * @return json representaion of video - */ - @Override - public String toString() { - return "{" - + "\"id\": " + id + "," - + "\"title\": \"" + title + "\"," - + "\"length\": " + length + "," - + "\"description\": \"" + description + "\"," - + "\"director\": \"" + director + "\"," - + "\"language\": \"" + language + "\"," - + "}"; - } + /** + * ToString. + * + * @return json representaion of video + */ + @Override + public String toString() { + return "{" + + "\"id\": " + id + "," + + "\"title\": \"" + title + "\"," + + "\"length\": " + length + "," + + "\"description\": \"" + description + "\"," + + "\"director\": \"" + director + "\"," + + "\"language\": \"" + language + "\"," + + "}"; + } } diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index c2cf4d5fe221..84dd35a3e0d8 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -29,9 +29,6 @@ /** * The resource record class which serves video information. This class act as server in the demo. Which * has all video details. - */ - -/** * * @param fieldJsonMapper map object to json. * @param videos initialize resource with existing videos. Act as database. diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java index 04423d2456f7..a973fde6d5de 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java @@ -28,9 +28,5 @@ * Stew ingredients. */ -/** - * Record class. - */ - public record StewData(int numPotatoes, int numCarrots, int numMeat, int numPeppers) { } diff --git a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java index b5a7d41d4ee7..815cdcb3acd3 100644 --- a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java +++ b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java @@ -38,17 +38,9 @@ * @author George Aristy (george.aristy@gmail.com) */ - -/** - * Record class. - * - * @param customerId the final result of the remote operation - * @param errors the errors to throw before returning {@code customerId} - */ - public record FindCustomer(String customerId, Deque errors) implements BusinessOperation { public FindCustomer(String customerId, BusinessException... errors) { - this(customerId,new ArrayDeque<>(List.of(errors))); + this(customerId, new ArrayDeque<>(List.of(errors))); } @Override public String perform() throws BusinessException { diff --git a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java index 759f5007ebdb..cafe4e8d0df4 100644 --- a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java +++ b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java @@ -27,18 +27,15 @@ /** * InvoiceGenerator class generates an invoice, accepting the product cost and calculating the total * price payable inclusive tax (calculated by {@link TaxCalculator}). - */ - -/** - * TaxCalculator description: - * The TaxCalculator interface to calculate the payable tax. - */ - -/** - * Amount description: - * The base product amount without tax. + * */ public record InvoiceGenerator(double amount, TaxCalculator taxCalculator) { + /** TaxCalculator description: + * The TaxCalculator interface to calculate the payable tax. + * + * Amount description: + * The base product amount without tax. + */ public double getAmountWithTax() { return amount + taxCalculator.calculate(amount); } diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java index 0cbd4075542f..ecfe870bcd13 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Action.java @@ -1,3 +1,27 @@ +/* + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * + * The MIT License + * Copyright © 2014-2022 Ilkka Seppälä + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.iluwatar.servicetoworker; import com.iluwatar.model.view.controller.Fatigue; diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/App.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/App.java index 2d41dba87196..3a078e1aa380 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/App.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/App.java @@ -1,3 +1,27 @@ +/* + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * + * The MIT License + * Copyright © 2014-2022 Ilkka Seppälä + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.iluwatar.servicetoworker; import com.iluwatar.model.view.controller.Fatigue; diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java index d0923d38e4ba..df6d80eb422a 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Command.java @@ -1,3 +1,27 @@ +/* + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * + * The MIT License + * Copyright © 2014-2022 Ilkka Seppälä + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.iluwatar.servicetoworker; import com.iluwatar.model.view.controller.Fatigue; @@ -6,9 +30,6 @@ /** * The type Command. - */ - -/** * Instantiates a new Command. * * @param fatigue the fatigue diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Dispatcher.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Dispatcher.java index 511e08b11301..784784478af2 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Dispatcher.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/Dispatcher.java @@ -1,3 +1,27 @@ +/* + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * + * The MIT License + * Copyright © 2014-2022 Ilkka Seppälä + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.iluwatar.servicetoworker; import java.util.ArrayList; diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantController.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantController.java index 6db186004c1f..1b830b467e02 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantController.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantController.java @@ -1,3 +1,27 @@ +/* + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * + * The MIT License + * Copyright © 2014-2022 Ilkka Seppälä + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.iluwatar.servicetoworker; import lombok.Getter; diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantModel.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantModel.java index e0e67997588c..202c25e5650c 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantModel.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantModel.java @@ -1,3 +1,27 @@ +/* + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * + * The MIT License + * Copyright © 2014-2022 Ilkka Seppälä + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.iluwatar.servicetoworker; import com.iluwatar.model.view.controller.Fatigue; diff --git a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantView.java b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantView.java index cebe03a94ce5..44d256cdbf13 100644 --- a/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantView.java +++ b/service-to-worker/src/main/java/com/iluwatar/servicetoworker/GiantView.java @@ -1,3 +1,27 @@ +/* + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). + * + * The MIT License + * Copyright © 2014-2022 Ilkka Seppälä + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.iluwatar.servicetoworker; import lombok.extern.slf4j.Slf4j; From fab4172b41343e74e2a4a38d7c59aa94a7d75f8c Mon Sep 17 00:00:00 2001 From: Mughees Qasim <45170085+MugheesQasim@users.noreply.github.com> Date: Wed, 12 Apr 2023 00:57:16 +0500 Subject: [PATCH 4/4] Issue #2377: Refactored according to the rules defined for the repo code --- .../separatedinterface/invoice/InvoiceGenerator.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java index cafe4e8d0df4..cdb2b6c1d18d 100644 --- a/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java +++ b/separated-interface/src/main/java/com/iluwatar/separatedinterface/invoice/InvoiceGenerator.java @@ -30,12 +30,11 @@ * */ public record InvoiceGenerator(double amount, TaxCalculator taxCalculator) { - /** TaxCalculator description: - * The TaxCalculator interface to calculate the payable tax. - * - * Amount description: - * The base product amount without tax. - */ + /** TaxCalculator description: + * The TaxCalculator interface to calculate the payable tax. + * Amount description: + * The base product amount without tax. + */ public double getAmountWithTax() { return amount + taxCalculator.calculate(amount); }