Commit f3ea13b3 by Jason Song

use java string builder for toString methods

parent 8a0c7f3a
package com.ctrip.framework.apollo.model; package com.ctrip.framework.apollo.model;
import com.google.common.base.MoreObjects; import com.google.common.base.Objects;
import com.ctrip.framework.apollo.enums.PropertyChangeType; import com.ctrip.framework.apollo.enums.PropertyChangeType;
...@@ -67,13 +67,13 @@ public class ConfigChange { ...@@ -67,13 +67,13 @@ public class ConfigChange {
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) final StringBuilder sb = new StringBuilder("ConfigChange{");
.omitNullValues() sb.append("namespace='").append(namespace).append('\'');
.add("namespace", namespace) sb.append(", propertyName='").append(propertyName).append('\'');
.add("propertyName", propertyName) sb.append(", oldValue='").append(oldValue).append('\'');
.add("oldValue", oldValue) sb.append(", newValue='").append(newValue).append('\'');
.add("newValue", newValue) sb.append(", changeType=").append(changeType);
.add("changeType", changeType) sb.append('}');
.toString(); return sb.toString();
} }
} }
package com.ctrip.framework.apollo.core.dto; package com.ctrip.framework.apollo.core.dto;
import com.google.common.base.MoreObjects;
import java.util.Map; import java.util.Map;
/** /**
...@@ -74,13 +72,13 @@ public class ApolloConfig { ...@@ -74,13 +72,13 @@ public class ApolloConfig {
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) final StringBuilder sb = new StringBuilder("ApolloConfig{");
.omitNullValues() sb.append("appId='").append(appId).append('\'');
.add("appId", appId) sb.append(", cluster='").append(cluster).append('\'');
.add("cluster", cluster) sb.append(", namespaceName='").append(namespaceName).append('\'');
.add("namespaceName", namespaceName) sb.append(", configurations=").append(configurations);
.add("releaseKey", releaseKey) sb.append(", releaseKey='").append(releaseKey).append('\'');
.add("configurations", configurations) sb.append('}');
.toString(); return sb.toString();
} }
} }
package com.ctrip.framework.apollo.core.dto; package com.ctrip.framework.apollo.core.dto;
import com.google.common.base.MoreObjects;
public class ServiceDTO { public class ServiceDTO {
private String appName; private String appName;
...@@ -36,11 +34,11 @@ public class ServiceDTO { ...@@ -36,11 +34,11 @@ public class ServiceDTO {
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) final StringBuilder sb = new StringBuilder("ServiceDTO{");
.omitNullValues() sb.append("appName='").append(appName).append('\'');
.add("appName", appName) sb.append(", instanceId='").append(instanceId).append('\'');
.add("instanceId", instanceId) sb.append(", homepageUrl='").append(homepageUrl).append('\'');
.add("homepageUrl", homepageUrl) sb.append('}');
.toString(); return sb.toString();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment