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

bchapuis pushed a commit to branch sonar
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git


The following commit(s) were added to refs/heads/sonar by this push:
     new 22b933eb Use record instead of class
22b933eb is described below

commit 22b933eb2a1c5df56ed44b2ac782c34c3657a8cd
Author: Bertil Chapuis <[email protected]>
AuthorDate: Thu Jun 13 01:15:26 2024 +0200

    Use record instead of class
---
 .../apache/baremaps/openstreetmap/model/User.java  | 54 +---------------------
 1 file changed, 1 insertion(+), 53 deletions(-)

diff --git 
a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/User.java
 
b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/User.java
index 1c6b1036..734af1af 100644
--- 
a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/User.java
+++ 
b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/model/User.java
@@ -19,61 +19,9 @@ package org.apache.baremaps.openstreetmap.model;
 
 
 
-import com.google.common.base.Objects;
-
 /** Represents the author of an objet in an OpenStreetMap dataset. */
-public final class User {
+public record User(int id, String name) {
 
   public static final User NO_USER = new User(-1, "");
 
-  private final int id;
-  private final String name;
-
-  /**
-   * Constructs an OpenStreetMap {@code User} with the specified parameters.
-   *
-   * @param id the id
-   * @param name the name
-   */
-  public User(int id, String name) {
-    this.id = id;
-    this.name = name;
-  }
-
-  /**
-   * Returns the id.
-   *
-   * @return the id
-   */
-  public int getId() {
-    return id;
-  }
-
-  /**
-   * Returns the name.
-   *
-   * @return the name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /** {@inheritDoc} */
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    User user = (User) o;
-    return id == user.id && Objects.equal(name, user.name);
-  }
-
-  /** {@inheritDoc} */
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(id, name);
-  }
 }

Reply via email to