From 4eaa9fb4555129f3d0baa56e7ffb70cac213a009 Mon Sep 17 00:00:00 2001 From: Ady Liu Date: Fri, 28 Sep 2018 17:42:06 +0800 Subject: [PATCH] remove commons-lang3 dependency --- pom.xml | 4 ++-- .../io/jafka/jeos/exception/EosApiError.java | 20 ++++++++++--------- .../io/jafka/jeos/exception/EosError.java | 20 ++++++++++++------- .../jafka/jeos/exception/EosErrorDetails.java | 19 +++++++++++------- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index c5aff48..055d46a 100644 --- a/pom.xml +++ b/pom.xml @@ -58,11 +58,11 @@ - + org.projectlombok diff --git a/src/main/java/io/jafka/jeos/exception/EosApiError.java b/src/main/java/io/jafka/jeos/exception/EosApiError.java index fd2631b..3940098 100644 --- a/src/main/java/io/jafka/jeos/exception/EosApiError.java +++ b/src/main/java/io/jafka/jeos/exception/EosApiError.java @@ -1,10 +1,5 @@ package io.jafka.jeos.exception; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - - public class EosApiError { private String message; @@ -37,12 +32,19 @@ public void setError(EosError error) { this.error = error; } + + @Override public String toString() { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("message", message) - .append("code", code) - .toString(); + StringBuilder builder = new StringBuilder(); + builder.append("EosApiError [message="); + builder.append(message); + builder.append(", code="); + builder.append(code); + builder.append(", error="); + builder.append(error); + builder.append("]"); + return builder.toString(); } public String getDetailedMessage() { diff --git a/src/main/java/io/jafka/jeos/exception/EosError.java b/src/main/java/io/jafka/jeos/exception/EosError.java index 9ed75dd..2431b4b 100644 --- a/src/main/java/io/jafka/jeos/exception/EosError.java +++ b/src/main/java/io/jafka/jeos/exception/EosError.java @@ -1,7 +1,6 @@ package io.jafka.jeos.exception; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; +import java.util.Arrays; public class EosError { @@ -51,10 +50,17 @@ public void setDetails(EosErrorDetails[] details) { @Override public String toString() { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("code", code) - .append("name", name) - .append("what", what) - .toString(); + StringBuilder builder = new StringBuilder(); + builder.append("EosError [code="); + builder.append(code); + builder.append(", name="); + builder.append(name); + builder.append(", what="); + builder.append(what); + builder.append(", details="); + builder.append(Arrays.toString(details)); + builder.append("]"); + return builder.toString(); } + } diff --git a/src/main/java/io/jafka/jeos/exception/EosErrorDetails.java b/src/main/java/io/jafka/jeos/exception/EosErrorDetails.java index 4bccbd0..810a2b8 100644 --- a/src/main/java/io/jafka/jeos/exception/EosErrorDetails.java +++ b/src/main/java/io/jafka/jeos/exception/EosErrorDetails.java @@ -1,8 +1,6 @@ package io.jafka.jeos.exception; import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; public class EosErrorDetails { @@ -53,10 +51,17 @@ public void setMethod(String method) { @Override public String toString() { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("message", message) - .append("file", file) - .append("lineNumber", lineNumber.toString()) - .toString(); + StringBuilder builder = new StringBuilder(); + builder.append("EosErrorDetails [message="); + builder.append(message); + builder.append(", file="); + builder.append(file); + builder.append(", lineNumber="); + builder.append(lineNumber); + builder.append(", method="); + builder.append(method); + builder.append("]"); + return builder.toString(); } + }