You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by jh...@apache.org on 2024/07/31 04:40:56 UTC

(james-project) 09/11: JAMES-3763 Switches PlainBlobId to a java record

This is an automated email from the ASF dual-hosted git repository.

jhelou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 9e2324a7d5dbc96fc4abd821e1f5d7c0e3bd6b6e
Author: Jean Helou <je...@xn--gml-cma.com>
AuthorDate: Thu Jul 18 23:37:05 2024 +0200

    JAMES-3763 Switches PlainBlobId to a java record
    
    Co-Authored-By: Matthieu Baechler <ma...@apache.org>
---
 .../org/apache/james/blob/api/PlainBlobId.java     | 35 +---------------------
 1 file changed, 1 insertion(+), 34 deletions(-)

diff --git a/server/blob/blob-api/src/main/java/org/apache/james/blob/api/PlainBlobId.java b/server/blob/blob-api/src/main/java/org/apache/james/blob/api/PlainBlobId.java
index 239734b809..0022827252 100644
--- a/server/blob/blob-api/src/main/java/org/apache/james/blob/api/PlainBlobId.java
+++ b/server/blob/blob-api/src/main/java/org/apache/james/blob/api/PlainBlobId.java
@@ -19,14 +19,10 @@
 
 package org.apache.james.blob.api;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 
-// FIXME (in later commit) use java record
-public class PlainBlobId implements BlobId {
+public record PlainBlobId(String id) implements BlobId {
     public static class Factory implements BlobId.Factory {
 
         @Override
@@ -41,37 +37,8 @@ public class PlainBlobId implements BlobId {
         }
     }
 
-    private final String id;
-
-    @VisibleForTesting
-    PlainBlobId(String id) {
-        this.id = id;
-    }
-
     @Override
     public String asString() {
         return id;
     }
-
-    @Override
-    public final boolean equals(Object obj) {
-        if (obj instanceof PlainBlobId) {
-            PlainBlobId other = (PlainBlobId) obj;
-            return Objects.equal(id, other.id);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hashCode(id);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects
-            .toStringHelper(this)
-            .add("id", id)
-            .toString();
-    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org