You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by po...@apache.org on 2019/06/28 20:38:12 UTC
[incubator-tamaya-extensions] 01/01: TAMAYA-394: Add lombok support
to basic beans
This is an automated email from the ASF dual-hosted git repository.
pottlinger pushed a commit to branch feature/TAMAYA-394lombok
in repository https://gitbox.apache.org/repos/asf/incubator-tamaya-extensions.git
commit 844d9ab2ef84ba643259db1a08a98ea756c5eb66
Author: Hugo Hirsch <gi...@hugo-hirsch.de>
AuthorDate: Fri Jun 28 22:37:53 2019 +0200
TAMAYA-394: Add lombok support to basic beans
---
examples/06-distributed/pom.xml | 6 +-
.../examples/distributed/DisplayContent.java | 102 +--------------------
.../examples/distributed/DisplayRegistration.java | 55 +----------
3 files changed, 11 insertions(+), 152 deletions(-)
diff --git a/examples/06-distributed/pom.xml b/examples/06-distributed/pom.xml
index 9909cc4..0fc4eee 100644
--- a/examples/06-distributed/pom.xml
+++ b/examples/06-distributed/pom.xml
@@ -95,7 +95,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -103,6 +102,11 @@
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.8</version>
+ </dependency>
</dependencies>
<build>
diff --git a/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayContent.java b/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayContent.java
index 57e7f22..c8c0fcf 100644
--- a/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayContent.java
+++ b/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayContent.java
@@ -21,113 +21,17 @@ package org.apache.tamaya.examples.distributed;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
+
+import lombok.Data;
/**
* Created by atsticks on 13.11.16.
*/
+@Data
public class DisplayContent {
private String displayId;
private String title = "UNKNOWN";
private Map<String,String> content = new HashMap<>();
private long timestamp = System.currentTimeMillis();
private String displayName;
-
- @Override
- public boolean equals(Object o) {
- if (this == o){
- return true;
- }
- if (!(o instanceof DisplayContent)){
- return false;
- }
- DisplayContent that = (DisplayContent) o;
- return getTimestamp() == that.getTimestamp() &&
- Objects.equals(getDisplayId(), that.getDisplayId()) &&
- Objects.equals(getTitle(), that.getTitle());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getDisplayId(), getTitle(), getTimestamp());
- }
-
- @Override
- public String toString() {
- return "DisplayContent{" +
- "displayId='" + getDisplayId() + '\'' +
- ", title='" + getTitle() + '\'' +
- ", content=" + getContent() +
- '}';
- }
-
- /**
- * @return the displayId
- */
- public String getDisplayId() {
- return displayId;
- }
-
- /**
- * @param displayId the displayId to set
- */
- public void setDisplayId(String displayId) {
- this.displayId = displayId;
- }
-
- /**
- * @return the title
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * @param title the title to set
- */
- public void setTitle(String title) {
- this.title = title;
- }
-
- /**
- * @return the content
- */
- public Map<String,String> getContent() {
- return content;
- }
-
- /**
- * @param content the content to set
- */
- public void setContent(Map<String,String> content) {
- this.content = content;
- }
-
- /**
- * @return the timestamp
- */
- public long getTimestamp() {
- return timestamp;
- }
-
- /**
- * @param timestamp the timestamp to set
- */
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- /**
- * @return the displayName
- */
- public String getDisplayName() {
- return displayName;
- }
-
- /**
- * @param displayName the displayName to set
- */
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
}
diff --git a/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayRegistration.java b/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayRegistration.java
index a09c8ba..5f4e498 100644
--- a/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayRegistration.java
+++ b/examples/06-distributed/src/main/java/org/apache/tamaya/examples/distributed/DisplayRegistration.java
@@ -24,9 +24,12 @@ import java.net.InetAddress;
import java.util.Objects;
import java.util.UUID;
+import lombok.Data;
+
/**
* Created by atsticks on 13.11.16.
*/
+@Data
public class DisplayRegistration implements Serializable{
private static final long serialVersionUID = 1L;
@@ -64,55 +67,6 @@ public class DisplayRegistration implements Serializable{
}
}
- public boolean isUpdate(){
- return this.update;
- }
-
- public String getDisplayModel() {
- return displayModel;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public String getHost() {
- return host;
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o){
- return true;
- }
- if (!(o instanceof DisplayRegistration)){
- return false;
- }
- DisplayRegistration that = (DisplayRegistration) o;
- return Objects.equals(getId(), that.getId());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getId());
- }
-
- @Override
- public String toString() {
- return "DisplayRegistration{" +
- "\n id='" + id + '\'' +
- "\n displayName='" + displayName + '\'' +
- "\n host='" + host + '\'' +
- "\n displayModel='" + displayModel + '\'' +
- "\n timestamp='" + timestamp + '\'' +
- "\n update='" + update + '\'' +
- "\n}";
- }
-
public DisplayRegistration update() {
DisplayRegistration reg = new DisplayRegistration();
reg.displayModel = this.displayModel;
@@ -124,7 +78,4 @@ public class DisplayRegistration implements Serializable{
return reg;
}
- public void setDisplayName(String displayName) {
- this.displayName = Objects.requireNonNull(displayName);
- }
}