mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-11 03:13:32 +00:00
* Issue #2377: The repository code has been refactored to use the record class * Issue #2377: Refactored according to the rules defined for the repo code * Issue #2377: Refactored according to the rules defined for the repo code * Issue #2377: Refactored according to the rules defined for the repo code
This commit is contained in:
1 parent
c0e1603f90
commit
3ae6b07590
26 files changed
+244
-293
No files matched your search
@@ -47,7 +47,7 @@ public class Consumer {
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,25 +27,5 @@ package com.iluwatar.producer.consumer;
|
||||
/**
|
||||
* 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) {
|
||||
}
|
||||
Reference in new issue
Block a user