JCLOUDS-653: Address Guava 18 deprecations

Mostly renaming Objects.toStringHelper to MoreObjects.toStringHelper.
This commit is contained in:
Andrew Gaul 2014-08-08 11:49:42 -07:00
parent b9858851ed
commit 61b78441d6
24 changed files with 72 additions and 60 deletions

View File

@ -73,7 +73,7 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.logging.Logger;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
@ -288,8 +288,8 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
@Override
public Image getImage(String id) {
return Objects.firstNonNull(api.getImageApiForProject(userProject.get()).get(id),
Objects.firstNonNull(api.getImageApiForProject(DEBIAN_PROJECT).get(id),
return MoreObjects.firstNonNull(api.getImageApiForProject(userProject.get()).get(id),
MoreObjects.firstNonNull(api.getImageApiForProject(DEBIAN_PROJECT).get(id),
api.getImageApiForProject(CENTOS_PROJECT).get(id)));
}

View File

@ -157,7 +157,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
NetworkAndAddressRange nAr = new NetworkAndAddressRange(name, DEFAULT_INTERNAL_NETWORK_RANGE, null);
Network nw = networkCreator.apply(nAr);
Network nw = networkCreator.getUnchecked(nAr);
return groupConverter.apply(nw);
}

View File

@ -134,7 +134,7 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
String networkName = templateOptions.getNetworkName().or(sharedResourceName);
return networkMap.apply(new NetworkAndAddressRange(networkName, DEFAULT_INTERNAL_NETWORK_RANGE, null));
return networkMap.getUnchecked(new NetworkAndAddressRange(networkName, DEFAULT_INTERNAL_NETWORK_RANGE, null));
}
/**

View File

@ -22,7 +22,7 @@ import java.net.URI;
import java.util.Date;
import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
/**
* A persistent disk resource
@ -59,7 +59,7 @@ public abstract class AbstractDisk extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("sizeGb", sizeGb)

View File

@ -25,7 +25,7 @@ import java.net.URI;
import java.util.Date;
import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
/**
@ -100,7 +100,7 @@ public final class Address extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("status", status)

View File

@ -16,13 +16,14 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import java.beans.ConstructorProperties;
import java.net.URI;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
@ -107,7 +108,7 @@ public class Deprecated {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.omitNullValues()
.add("state", state.orNull())

View File

@ -24,7 +24,7 @@ import java.net.URI;
import java.util.Date;
import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
/**
* A persistent disk resource
@ -69,7 +69,7 @@ public final class Disk extends AbstractDisk {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("zone", zone);

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
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.checkState;
import static com.google.common.collect.Range.closed;
@ -31,6 +31,7 @@ import java.util.Set;
import org.jclouds.net.domain.IpProtocol;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.RangeSet;
@ -113,7 +114,7 @@ public final class Firewall extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.add("network", network)
.add("sourceRanges", sourceRanges)
@ -305,7 +306,7 @@ public final class Firewall extends Resource {
/**
* {@inheritDoc}
*/
public Objects.ToStringHelper string() {
public MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.add("IpProtocol", ipProtocol).add("ports", ports);
}

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
@ -26,6 +26,7 @@ import java.net.URI;
import java.util.Date;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
@ -77,7 +78,7 @@ public final class Image extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("sourceType", sourceType)
@ -217,7 +218,7 @@ public final class Image extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.omitNullValues()
.add("source", source)

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.getLast;
@ -30,6 +30,7 @@ import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Splitter;
@ -166,7 +167,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("items", tags)
@ -389,7 +390,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.add("items", items)
.add("fingerprint", fingerprint);
@ -495,7 +496,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this).add("index", index);
}
@ -593,7 +594,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this).add("boot", boot);
}
@ -746,7 +747,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.add("name", name)
.add("network", network).add("networkIP", networkIP).add("accessConfigs",
@ -900,7 +901,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.add("name", name).add("type", type).add("natIP", natIP);
}
@ -1018,7 +1019,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this).add("selfLink", selfLink).add("contents", contents);
}
@ -1126,7 +1127,7 @@ public class Instance extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this).add("email", email).add("scopes", scopes);
}

View File

@ -25,6 +25,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
@ -420,8 +421,8 @@ public class InstanceTemplate {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
Objects.ToStringHelper toString = Objects.toStringHelper("")
protected MoreObjects.ToStringHelper string() {
MoreObjects.ToStringHelper toString = MoreObjects.toStringHelper("")
.omitNullValues();
toString.add("description", description);
if (disks.size() > 0)

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
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 org.jclouds.googlecomputeengine.domain.Resource.Kind;
@ -27,6 +27,7 @@ import java.util.Iterator;
import org.jclouds.collect.IterableWithMarker;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
@ -98,7 +99,7 @@ public class ListPage<T> extends IterableWithMarker<T> {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.omitNullValues()
.add("kind", kind)

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties;
@ -28,6 +28,7 @@ import java.util.List;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
@ -141,7 +142,7 @@ public final class MachineType extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.add("guestCpus", guestCpus)
.add("memoryMb", memoryMb)
@ -315,7 +316,7 @@ public final class MachineType extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.add("diskGb", diskGb);
}

View File

@ -16,14 +16,15 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import java.beans.ConstructorProperties;
import java.util.Map;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMap;
@ -80,7 +81,7 @@ public class Metadata {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.add("items", items)
.add("fingerprint", fingerprint);

View File

@ -25,7 +25,7 @@ import java.net.URI;
import java.util.Date;
import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
/**
@ -71,7 +71,7 @@ public final class Network extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("IPv4Range", IPv4Range)

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
@ -30,6 +30,7 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
@ -203,7 +204,7 @@ public class Operation extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("targetLink", targetLink)
@ -489,7 +490,7 @@ public class Operation extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.omitNullValues()
.add("code", code)

View File

@ -25,7 +25,7 @@ import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
/**
@ -74,7 +74,7 @@ public class Project extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.add("commonInstanceMetadata", commonInstanceMetadata)
.add("quotas", quotas)

View File

@ -21,8 +21,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
/**
* Quotas assigned to a given project or region.
@ -88,7 +89,7 @@ public class Quota {
* {@inheritDoc}
*/
public ToStringHelper string() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("metric", metric)
.add("usage", usage)

View File

@ -26,7 +26,7 @@ import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
/**
@ -85,7 +85,7 @@ public final class Region extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.add("status", status)
.add("zones", zones)

View File

@ -16,9 +16,9 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.Objects.ToStringHelper;
import static com.google.common.base.MoreObjects.ToStringHelper;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
@ -28,6 +28,7 @@ import java.util.Map;
import java.util.Set;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
@ -140,7 +141,7 @@ public final class Route extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.add("network", network)
.add("tags", tags)
@ -359,7 +360,7 @@ public final class Route extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.add("code", code)
.add("message", message)

View File

@ -24,7 +24,7 @@ import java.net.URI;
import java.util.Date;
import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
/**
@ -70,7 +70,7 @@ public final class Snapshot extends AbstractDisk {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.omitNullValues()
.add("sourceDisk", sourceDisk.orNull())

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
@ -29,6 +29,7 @@ import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
@ -90,7 +91,7 @@ public final class Zone extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return super.string()
.add("status", status)
.add("maintenanceWindows", maintenanceWindows)
@ -253,7 +254,7 @@ public final class Zone extends Resource {
/**
* {@inheritDoc}
*/
protected Objects.ToStringHelper string() {
protected MoreObjects.ToStringHelper string() {
return toStringHelper(this)
.omitNullValues()
.add("name", name)

View File

@ -16,8 +16,8 @@
*/
package org.jclouds.googlecomputeengine.domain.internal;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
@ -25,8 +25,8 @@ import java.beans.ConstructorProperties;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.base.Optional;
/**