mirror of https://github.com/apache/jclouds.git
toString tidies
This commit is contained in:
parent
cb370ab26d
commit
ed1864e810
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.openstack.nova.v1_1.domain;
|
package org.jclouds.openstack.nova.v1_1.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.toStringHelper;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -562,15 +561,11 @@ public class Server extends Resource {
|
||||||
// hashCode/equals from super is ok
|
// hashCode/equals from super is ok
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
|
||||||
return string().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ToStringHelper string() {
|
protected ToStringHelper string() {
|
||||||
return toStringHelper("").add("id", id).add("uuid", uuid).add("name", name).add("tenantId", tenantId).add(
|
return super.string().add("uuid", uuid).add("tenantId", tenantId).add(
|
||||||
"userId", userId).add("hostId", getHostId()).add("updated", updated).add("created", created).add(
|
"userId", userId).add("hostId", getHostId()).add("updated", updated).add("created", created).add(
|
||||||
"accessIPv4", getAccessIPv4()).add("accessIPv6", getAccessIPv6()).add("status", status).add(
|
"accessIPv4", getAccessIPv4()).add("accessIPv6", getAccessIPv6()).add("status", status).add(
|
||||||
"configDrive", getConfigDrive()).add("image", image).add("flavor", flavor).add("metadata", metadata)
|
"configDrive", getConfigDrive()).add("image", image).add("flavor", flavor).add("metadata", metadata)
|
||||||
.add("links", links).add("addresses", getAddresses()).add("adminPass", adminPass);
|
.add("addresses", getAddresses()).add("adminPass", adminPass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Set;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +149,11 @@ public class Resource implements Comparable<Resource> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toStringHelper("").add("id", getId()).add("name", name).add("links", links).toString();
|
return string().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ToStringHelper string() {
|
||||||
|
return toStringHelper("").add("id", getId()).add("name", name).add("links", links);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,13 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.rest.suppliers;
|
package org.jclouds.rest.suppliers;
|
||||||
|
|
||||||
|
import static com.google.common.base.Objects.equal;
|
||||||
|
import static com.google.common.base.Objects.toStringHelper;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
|
||||||
public class URIFromStringSupplier implements Supplier<URI> {
|
public class URIFromStringSupplier implements Supplier<URI> {
|
||||||
|
|
||||||
|
@ -40,4 +44,31 @@ public class URIFromStringSupplier implements Supplier<URI> {
|
||||||
return endpoint;
|
return endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
if (this == object) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (object instanceof URIFromStringSupplier) {
|
||||||
|
final URIFromStringSupplier other = URIFromStringSupplier.class.cast(object);
|
||||||
|
return equal(endpoint, other.endpoint);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(endpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return string().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ToStringHelper string() {
|
||||||
|
return toStringHelper("").add("endpoint", endpoint);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue