From cf437e3004149efe3b65e80d618374eb28cca641 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 21 Dec 2022 03:26:49 +0300 Subject: external tokens: adopt records --- src/main/java/com/juick/model/ExternalToken.java | 37 +----------------------- 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'src/main/java/com/juick/model') 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; - } } -- cgit v1.2.3