From a740c0e1d4e9f89ef7decfe4225e53555121f93b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 21 Dec 2022 01:18:05 +0300 Subject: Switch from `lombok` to Java 17 `record` --- .../www/api/activity/converters/UserToActorConverter.java | 12 ++---------- .../juick/www/api/activity/helpers/ProfileUriBuilder.java | 10 +--------- 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'src/main/java/com/juick/www/api') diff --git a/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java b/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java index 435cb50d..0ba047b5 100644 --- a/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java +++ b/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java @@ -13,15 +13,8 @@ import com.juick.www.api.activity.model.objects.Image; import com.juick.www.api.activity.model.objects.Key; import com.juick.www.api.activity.model.objects.Person; -import lombok.AllArgsConstructor; - -@AllArgsConstructor -public class UserToActorConverter implements Converter { - - private ProfileUriBuilder profileUriBuilder; - private KeystoreManager keystoreManager; - private WebApp webApp; - +public record UserToActorConverter(ProfileUriBuilder profileUriBuilder, KeystoreManager keystoreManager, WebApp webApp) + implements Converter { @Override public Actor convert(User user) { Actor profile = user.isService() ? new Application() : new Person(); @@ -44,5 +37,4 @@ public class UserToActorConverter implements Converter { profile.setIcon(avatar); return (Actor) Context.build(profile); } - } diff --git a/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java b/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java index 8f5e7566..e10c3078 100644 --- a/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java +++ b/src/main/java/com/juick/www/api/activity/helpers/ProfileUriBuilder.java @@ -20,18 +20,10 @@ package com.juick.www.api.activity.helpers; import com.juick.model.Message; import com.juick.model.Tag; import com.juick.model.User; -import lombok.AllArgsConstructor; import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; -@AllArgsConstructor -public class ProfileUriBuilder { - private String baseUri; - - public String getBaseUri() { - return baseUri; - } - +public record ProfileUriBuilder(String baseUri) { public String inboxUri() { UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri); return uri.replacePath("/api/inbox").toUriString(); -- cgit v1.2.3