mirror of https://github.com/apache/jclouds.git
tidied toString on vCloud
This commit is contained in:
parent
65b9955abe
commit
ead47d9893
|
@ -18,12 +18,15 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.options;
|
package org.jclouds.vcloud.options;
|
||||||
|
|
||||||
|
import static com.google.common.base.Objects.equal;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.vcloud.domain.network.NetworkConfig;
|
import org.jclouds.vcloud.domain.network.NetworkConfig;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,52 +141,40 @@ public class InstantiateVAppTemplateOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public boolean equals(Object object) {
|
||||||
return "[networkConfig=" + networkConfig + ", customizeOnInstantiate=" + customizeOnInstantiate
|
if (this == object) {
|
||||||
+ ", description=" + description + ", deploy=" + deploy + ", powerOn=" + powerOn + "]";
|
return true;
|
||||||
|
}
|
||||||
|
if (object instanceof InstantiateVAppTemplateOptions) {
|
||||||
|
final InstantiateVAppTemplateOptions other = InstantiateVAppTemplateOptions.class.cast(object);
|
||||||
|
return equal(networkConfig, other.networkConfig)
|
||||||
|
&& equal(customizeOnInstantiate, other.customizeOnInstantiate) && equal(description, other.description)
|
||||||
|
&& equal(deploy, other.deploy) && equal(powerOn, other.powerOn);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
return Objects.hashCode(networkConfig, customizeOnInstantiate, description, deploy, powerOn);
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((customizeOnInstantiate == null) ? 0 : customizeOnInstantiate.hashCode());
|
|
||||||
result = prime * result + (deploy ? 1231 : 1237);
|
|
||||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
|
||||||
result = prime * result + ((networkConfig == null) ? 0 : networkConfig.hashCode());
|
|
||||||
result = prime * result + (powerOn ? 1231 : 1237);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public String toString(){
|
||||||
if (this == obj)
|
return string().toString();
|
||||||
return true;
|
}
|
||||||
if (obj == null)
|
|
||||||
return false;
|
protected ToStringHelper string() {
|
||||||
if (getClass() != obj.getClass())
|
ToStringHelper toString = Objects.toStringHelper("").omitNullValues();
|
||||||
return false;
|
toString.add("customizeOnInstantiate", customizeOnInstantiate).add("description", description);
|
||||||
InstantiateVAppTemplateOptions other = (InstantiateVAppTemplateOptions) obj;
|
if (networkConfig.size() > 0)
|
||||||
if (customizeOnInstantiate == null) {
|
toString.add("networkConfig", networkConfig);
|
||||||
if (other.customizeOnInstantiate != null)
|
if (!deploy)
|
||||||
return false;
|
toString.add("deploy", deploy);
|
||||||
} else if (!customizeOnInstantiate.equals(other.customizeOnInstantiate))
|
if (!powerOn)
|
||||||
return false;
|
toString.add("powerOn", powerOn);
|
||||||
if (deploy != other.deploy)
|
return toString;
|
||||||
return false;
|
|
||||||
if (description == null) {
|
|
||||||
if (other.description != null)
|
|
||||||
return false;
|
|
||||||
} else if (!description.equals(other.description))
|
|
||||||
return false;
|
|
||||||
if (networkConfig == null) {
|
|
||||||
if (other.networkConfig != null)
|
|
||||||
return false;
|
|
||||||
} else if (!networkConfig.equals(other.networkConfig))
|
|
||||||
return false;
|
|
||||||
if (powerOn != other.powerOn)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue