aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/model
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-21 03:26:49 +0300
committerGravatar Vitaly Takmazov2022-12-21 03:26:49 +0300
commitcf437e3004149efe3b65e80d618374eb28cca641 (patch)
tree328147d3209d9a4330c1576c9acb4c2b6cc358b6 /src/main/java/com/juick/model
parent1ad1b73a7b85e7e907de1870991a8849487f9543 (diff)
external tokens: adopt records
Diffstat (limited to 'src/main/java/com/juick/model')
-rw-r--r--src/main/java/com/juick/model/ExternalToken.java37
1 files changed, 1 insertions, 36 deletions
diff --git a/src/main/java/com/juick/model/ExternalToken.java b/src/main/java/com/juick/model/ExternalToken.java
index 65a07e55..12f5388c 100644
--- a/src/main/java/com/juick/model/ExternalToken.java
+++ b/src/main/java/com/juick/model/ExternalToken.java
@@ -17,48 +17,13 @@
package com.juick.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by vitalyster on 22.11.2016.
*/
-public class ExternalToken {
- private final String name;
- private final String type;
- private final String token;
- private final String secret;
-
- @JsonCreator
- public ExternalToken(@JsonProperty("name") String name,
+public record ExternalToken(@JsonProperty("name") String name,
@JsonProperty("type") String type,
@JsonProperty("token") String token,
@JsonProperty("secret") String secret) {
- this.name = name;
- this.type = type;
- this.token = token;
- this.secret = secret;
- if (this.type == null) {
- throw new IllegalStateException("Token must have type");
- }
- if (this.token == null) {
- throw new IllegalStateException("Token must have value");
- }
- }
-
- public String getType() {
- return type;
- }
-
- public String getToken() {
- return token;
- }
-
- public String getName() {
- return name;
- }
-
- public String getSecret() {
- return secret;
- }
}