diff options
author | Vitaly Takmazov | 2022-12-21 03:26:49 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-21 03:26:49 +0300 |
commit | cf437e3004149efe3b65e80d618374eb28cca641 (patch) | |
tree | 328147d3209d9a4330c1576c9acb4c2b6cc358b6 /src/main/java/com/juick/model/ExternalToken.java | |
parent | 1ad1b73a7b85e7e907de1870991a8849487f9543 (diff) |
external tokens: adopt records
Diffstat (limited to 'src/main/java/com/juick/model/ExternalToken.java')
-rw-r--r-- | src/main/java/com/juick/model/ExternalToken.java | 37 |
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; - } } |