From 1ad1b73a7b85e7e907de1870991a8849487f9543 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 21 Dec 2022 02:36:49 +0300 Subject: Social logins: adopt records --- .../java/com/juick/model/ext/facebook/User.java | 31 ++-------------------- .../java/com/juick/model/ext/twitter/User.java | 10 ++----- src/main/java/com/juick/model/ext/vk/Token.java | 23 +++------------- src/main/java/com/juick/model/ext/vk/User.java | 28 +++---------------- .../java/com/juick/model/ext/vk/UsersResponse.java | 10 ++----- 5 files changed, 12 insertions(+), 90 deletions(-) (limited to 'src/main/java/com/juick/model/ext') diff --git a/src/main/java/com/juick/model/ext/facebook/User.java b/src/main/java/com/juick/model/ext/facebook/User.java index 44a3e73ec..4c9433e96 100644 --- a/src/main/java/com/juick/model/ext/facebook/User.java +++ b/src/main/java/com/juick/model/ext/facebook/User.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,32 +24,5 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by vitalyster on 28.11.2016. */ @JsonIgnoreProperties(ignoreUnknown = true) -public class User { - private String id; - private String name; - private String firstName; - private String lastName; - private String email; - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - @JsonProperty("first_name") - public String getFirstName() { - return firstName; - } - - @JsonProperty("last_name") - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } +public record User(String id, String name, @JsonProperty("first_name") String firstName, @JsonProperty("last_name") String lastName, String email) { } diff --git a/src/main/java/com/juick/model/ext/twitter/User.java b/src/main/java/com/juick/model/ext/twitter/User.java index ea89f6750..5a09556da 100644 --- a/src/main/java/com/juick/model/ext/twitter/User.java +++ b/src/main/java/com/juick/model/ext/twitter/User.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,11 +24,5 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by vitalyster on 28.11.2016. */ @JsonIgnoreProperties(ignoreUnknown = true) -public class User { - private String screenName; - - @JsonProperty("screen_name") - public String getScreenName() { - return screenName; - } +public record User( @JsonProperty("screen_name") String screenName) { } diff --git a/src/main/java/com/juick/model/ext/vk/Token.java b/src/main/java/com/juick/model/ext/vk/Token.java index 42a3195d4..7623a3e9c 100644 --- a/src/main/java/com/juick/model/ext/vk/Token.java +++ b/src/main/java/com/juick/model/ext/vk/Token.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,23 +24,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by vitalyster on 28.11.2016. */ @JsonIgnoreProperties(ignoreUnknown = true) -public class Token { - private Long userId; - private String accessToken; - private String expiresIn; - - @JsonProperty("user_id") - public Long getUserId() { - return userId; - } - - @JsonProperty("access_token") - public String getAccessToken() { - return accessToken; - } - - @JsonProperty("expires_in") - public String getExpiresIn() { - return expiresIn; - } +public record Token(@JsonProperty("user_id") Long userId, @JsonProperty("access_token") String accessToken, + @JsonProperty("expires_in") String expiresIn) { } diff --git a/src/main/java/com/juick/model/ext/vk/User.java b/src/main/java/com/juick/model/ext/vk/User.java index a39ca6dc5..3404a9e6b 100644 --- a/src/main/java/com/juick/model/ext/vk/User.java +++ b/src/main/java/com/juick/model/ext/vk/User.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,28 +24,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by vitalyster on 28.11.2016. */ @JsonIgnoreProperties(ignoreUnknown = true) -public class User { - private String id; - private String firstName; - private String lastName; - private String screenName; - - @JsonProperty("first_name") - public String getFirstName() { - return firstName; - } - - @JsonProperty("last_name") - public String getLastName() { - return lastName; - } - - @JsonProperty("screen_name") - public String getScreenName() { - return screenName; - } - - public String getId() { - return id; - } +public record User(String id, @JsonProperty("first_name") String firstName, + @JsonProperty("last_name") String lastName, @JsonProperty("screen_name") String screenName) { } diff --git a/src/main/java/com/juick/model/ext/vk/UsersResponse.java b/src/main/java/com/juick/model/ext/vk/UsersResponse.java index 60f6c06e3..0ece27fc5 100644 --- a/src/main/java/com/juick/model/ext/vk/UsersResponse.java +++ b/src/main/java/com/juick/model/ext/vk/UsersResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,11 +24,5 @@ import java.util.List; /** * Created by vitalyster on 28.11.2016. */ -public class UsersResponse { - private List users; - - @JsonProperty("response") - public List getUsers() { - return users; - } +public record UsersResponse(@JsonProperty("response") List users) { } -- cgit v1.2.3