docs: update monostate

This commit is contained in:
Ilkka Seppälä committed 2024-05-09 13:27:17 +03:00
1 parent 36a9eea769
commit de1dd7f82a
3 files changed
+74 -69

No files matched your search

@@ -25,13 +25,7 @@
package com.iluwatar.monostate;
/**
* The Request class. A {@link Server} can handle an instance of a Request.
* The Request record. A {@link Server} can handle an instance of a Request.
*/
public class Request {
public final String value;
public Request(String value) {
this.value = value;
}
}
public record Request(String value) {}
@@ -24,6 +24,7 @@
*/
package com.iluwatar.monostate;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
/**
@@ -31,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
* in a simplistic Round Robin fashion.
*/
@Slf4j
@Getter
public class Server {
public final String host;
@@ -46,16 +48,8 @@ public class Server {
this.id = id;
}
public String getHost() {
return host;
}
public int getPort() {
return port;
}
public void serve(Request request) {
LOGGER.info("Server ID {} associated to host : {} and port {}. Processed request with value {}",
id, host, port, request.value);
id, host, port, request.value());
}
}