diff --git a/providers/gogrid/pom.xml b/providers/gogrid/pom.xml
index b42e13c1af..97b7d7fdc9 100644
--- a/providers/gogrid/pom.xml
+++ b/providers/gogrid/pom.xml
@@ -77,10 +77,16 @@
org.jclouds.driver
- jclouds-log4j
+ jclouds-slf4j
${project.version}
test
+
+ ch.qos.logback
+ logback-classic
+ 1.0.0
+ test
+
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/BillingToken.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/BillingToken.java
index 58aff2efed..bcc9df245f 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/BillingToken.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/BillingToken.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,72 +18,127 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
import com.google.common.primitives.Longs;
/**
+ * Class BillingToken
+ *
* @author Oleksiy Yarmula
- */
+*/
public class BillingToken implements Comparable {
- private long id;
- private String name;
- private double price;
-
- /**
- * A no-args constructor is required for deserialization
- */
- public BillingToken() {
+ public static Builder> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromBillingToken(this);
}
- public BillingToken(long id, String name, double price) {
+ public static abstract class Builder> {
+ protected abstract T self();
+
+ protected long id;
+ protected String name;
+ protected double price;
+
+ /**
+ * @see BillingToken#getId()
+ */
+ public T id(long id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see BillingToken#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see BillingToken#getPrice()
+ */
+ public T price(double price) {
+ this.price = price;
+ return self();
+ }
+
+ public BillingToken build() {
+ return new BillingToken(id, name, price);
+ }
+
+ public T fromBillingToken(BillingToken in) {
+ return this
+ .id(in.getId())
+ .name(in.getName())
+ .price(in.getPrice());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final long id;
+ private final String name;
+ private final double price;
+
+ @ConstructorProperties({
+ "id", "name", "price"
+ })
+ protected BillingToken(long id, String name, double price) {
this.id = id;
- this.name = name;
+ this.name = checkNotNull(name, "name");
this.price = price;
}
public long getId() {
- return id;
+ return this.id;
}
public String getName() {
- return name;
+ return this.name;
}
public double getPrice() {
- return price;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- BillingToken other = (BillingToken) obj;
- if (id != other.id)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (Double.doubleToLongBits(price) != Double.doubleToLongBits(other.price))
- return false;
- return true;
+ return this.price;
}
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (id ^ (id >>> 32));
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- long temp;
- temp = Double.doubleToLongBits(price);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- return result;
+ return Objects.hashCode(id, name, price);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ BillingToken that = BillingToken.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.price, that.price);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("name", name).add("price", price);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
}
@Override
@@ -91,8 +146,4 @@ public class BillingToken implements Comparable {
return Longs.compare(id, o.getId());
}
- @Override
- public String toString() {
- return "BillingToken{" + "id=" + id + ", name='" + name + '\'' + ", price=" + price + '}';
- }
}
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Customer.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Customer.java
index 59699acd97..5e46e5a9f0 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Customer.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Customer.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,50 +18,109 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
/**
+ * Class Customer
+ *
* @author Oleksiy Yarmula
- */
+*/
public class Customer {
- private long id;
- private String name;
+ public static Builder> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromCustomer(this);
+ }
- public Customer(long id, String name) {
- this.id = id;
- this.name = name;
- }
+ public static abstract class Builder> {
+ protected abstract T self();
- public long getId() {
- return id;
- }
+ protected long id;
+ protected String name;
+
+ /**
+ * @see Customer#getId()
+ */
+ public T id(long id) {
+ this.id = id;
+ return self();
+ }
- public String getName() {
- return name;
- }
-
- /**
- * A no-args constructor is required for deserialization
- */
- public Customer() {
- }
+ /**
+ * @see Customer#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ public Customer build() {
+ return new Customer(id, name);
+ }
+
+ public T fromCustomer(Customer in) {
+ return this
+ .id(in.getId())
+ .name(in.getName());
+ }
+ }
- Customer customer = (Customer) o;
+ private static class ConcreteBuilder extends Builder {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
- if (id != customer.id) return false;
- if (name != null ? !name.equals(customer.name) : customer.name != null) return false;
+ private final long id;
+ private final String name;
- return true;
- }
+ @ConstructorProperties({
+ "id", "name"
+ })
+ protected Customer(long id, String name) {
+ this.id = id;
+ this.name = checkNotNull(name, "name");
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, name);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Customer that = Customer.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.name, that.name);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("name", name);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
- @Override
- public int hashCode() {
- int result = (int) (id ^ (id >>> 32));
- result = 31 * result + (name != null ? name.hashCode() : 0);
- return result;
- }
}
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Ip.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Ip.java
index 80bbc75985..4e8185d3c7 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Ip.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Ip.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,129 +18,187 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
import com.google.common.primitives.Longs;
-import com.google.gson.annotations.SerializedName;
/**
+ * Class Ip
+ *
* @author Oleksiy Yarmula
- */
+*/
public class Ip implements Comparable {
- private long id;
-
- private String ip;
- private String subnet;
- @SerializedName("public")
- private boolean isPublic;
- private IpState state;
- private Option datacenter;
-
- /**
- * A no-args constructor is required for deserialization
- */
- public Ip() {
+ public static Builder> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromIp(this);
}
- /**
- * Constructs a generic IP address without any additional options.
- *
- * @param ip
- * ip address
- */
- public Ip(String ip) {
- this.ip = ip;
+ public static abstract class Builder> {
+ protected abstract T self();
+
+ protected long id;
+ protected String ip;
+ protected String subnet;
+ protected boolean isPublic;
+ protected IpState state;
+ protected Option datacenter;
+
+ /**
+ * @see Ip#getId()
+ */
+ public T id(long id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see Ip#getIp()
+ */
+ public T ip(String ip) {
+ this.ip = ip;
+ return self();
+ }
+
+ /**
+ * @see Ip#getSubnet()
+ */
+ public T subnet(String subnet) {
+ this.subnet = subnet;
+ return self();
+ }
+
+ /**
+ * @see Ip#isPublic()
+ */
+ public T isPublic(boolean isPublic) {
+ this.isPublic = isPublic;
+ return self();
+ }
+
+ /**
+ * @see Ip#getState()
+ */
+ public T state(IpState state) {
+ this.state = state;
+ return self();
+ }
+
+ /**
+ * @see Ip#getDatacenter()
+ */
+ public T datacenter(Option datacenter) {
+ this.datacenter = datacenter;
+ return self();
+ }
+
+ public Ip build() {
+ return new Ip(id, ip, subnet, isPublic, state, datacenter);
+ }
+
+ public T fromIp(Ip in) {
+ return this
+ .id(in.getId())
+ .ip(in.getIp())
+ .subnet(in.getSubnet())
+ .isPublic(in.isPublic())
+ .state(in.getState())
+ .datacenter(in.getDatacenter());
+ }
}
- public Ip(long id, String ip, String subnet, boolean isPublic, IpState state, Option datacenter) {
+ private static class ConcreteBuilder extends Builder {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final long id;
+ private final String ip;
+ private final String subnet;
+ private final boolean isPublic;
+ private final IpState state;
+ private final Option datacenter;
+
+ @ConstructorProperties({
+ "id", "ip", "subnet", "public", "state", "datacenter"
+ })
+ protected Ip(long id, String ip, @Nullable String subnet, boolean isPublic, @Nullable IpState state, @Nullable Option datacenter) {
this.id = id;
- this.ip = ip;
+ this.ip = checkNotNull(ip, "ip");
this.subnet = subnet;
this.isPublic = isPublic;
- this.state = state;
+ this.state = state == null ? IpState.UNRECOGNIZED : state;
this.datacenter = datacenter;
}
public long getId() {
- return id;
- }
-
- public Option getDatacenter() {
- return datacenter;
+ return this.id;
}
public String getIp() {
- return ip;
+ return this.ip;
}
+ @Nullable
public String getSubnet() {
- return subnet;
+ return this.subnet;
}
public boolean isPublic() {
- return isPublic;
+ return this.isPublic;
}
public IpState getState() {
- return state;
+ return this.state;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Ip other = (Ip) obj;
- if (datacenter == null) {
- if (other.datacenter != null)
- return false;
- } else if (!datacenter.equals(other.datacenter))
- return false;
- if (id != other.id)
- return false;
- if (ip == null) {
- if (other.ip != null)
- return false;
- } else if (!ip.equals(other.ip))
- return false;
- if (isPublic != other.isPublic)
- return false;
- if (state == null) {
- if (other.state != null)
- return false;
- } else if (!state.equals(other.state))
- return false;
- if (subnet == null) {
- if (other.subnet != null)
- return false;
- } else if (!subnet.equals(other.subnet))
- return false;
- return true;
+ @Nullable
+ public Option getDatacenter() {
+ return this.datacenter;
}
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((datacenter == null) ? 0 : datacenter.hashCode());
- result = prime * result + (int) (id ^ (id >>> 32));
- result = prime * result + ((ip == null) ? 0 : ip.hashCode());
- result = prime * result + (isPublic ? 1231 : 1237);
- result = prime * result + ((state == null) ? 0 : state.hashCode());
- result = prime * result + ((subnet == null) ? 0 : subnet.hashCode());
- return result;
+ return Objects.hashCode(id, ip, subnet, isPublic, state, datacenter);
}
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Ip that = Ip.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.ip, that.ip)
+ && Objects.equal(this.subnet, that.subnet)
+ && Objects.equal(this.isPublic, that.isPublic)
+ && Objects.equal(this.state, that.state)
+ && Objects.equal(this.datacenter, that.datacenter);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("ip", ip).add("subnet", subnet).add("isPublic", isPublic).add("state", state).add("datacenter", datacenter);
+ }
+
@Override
public String toString() {
- return "Ip [datacenter=" + datacenter + ", id=" + id + ", ip=" + ip + ", isPublic="
- + isPublic + ", state=" + state + ", subnet=" + subnet + "]";
+ return string().toString();
}
@Override
public int compareTo(Ip o) {
return Longs.compare(id, o.getId());
}
+
}
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/IpPortPair.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/IpPortPair.java
index d8febe8ac5..61e4bec668 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/IpPortPair.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/IpPortPair.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,64 +18,116 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
import com.google.common.primitives.Ints;
import com.google.common.primitives.Longs;
/**
+ * Class IpPortPair
+ *
* @author Oleksiy Yarmula
- */
+*/
public class IpPortPair implements Comparable {
- private Ip ip;
- private int port;
+ public static Builder> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromIpPortPair(this);
+ }
- /**
- * A no-args constructor is required for deserialization
- */
- public IpPortPair() {
- }
+ public static abstract class Builder> {
+ protected abstract T self();
- public IpPortPair(Ip ip, int port) {
- this.ip = ip;
- this.port = port;
- }
+ protected Ip ip;
+ protected int port;
+
+ /**
+ * @see IpPortPair#getIp()
+ */
+ public T ip(Ip ip) {
+ this.ip = ip;
+ return self();
+ }
- public Ip getIp() {
- return ip;
- }
+ /**
+ * @see IpPortPair#getPort()
+ */
+ public T port(int port) {
+ this.port = port;
+ return self();
+ }
- public int getPort() {
- return port;
- }
+ public IpPortPair build() {
+ return new IpPortPair(ip, port);
+ }
+
+ public T fromIpPortPair(IpPortPair in) {
+ return this
+ .ip(in.getIp())
+ .port(in.getPort());
+ }
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ private static class ConcreteBuilder extends Builder {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
- IpPortPair that = (IpPortPair) o;
+ private final Ip ip;
+ private final int port;
- if (port != that.port) return false;
- if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
+ @ConstructorProperties({
+ "ip", "port"
+ })
+ protected IpPortPair(Ip ip, int port) {
+ this.ip = checkNotNull(ip, "ip");
+ this.port = port;
+ }
- return true;
- }
+ public Ip getIp() {
+ return this.ip;
+ }
- @Override
- public int hashCode() {
- int result = ip != null ? ip.hashCode() : 0;
- result = 31 * result + port;
- return result;
- }
-
- @Override
- public int compareTo(IpPortPair o) {
- if(ip != null && o.getIp() != null) return Longs.compare(ip.getId(), o.getIp().getId());
- return Ints.compare(port, o.getPort());
- }
+ public int getPort() {
+ return this.port;
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ip, port);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ IpPortPair that = IpPortPair.class.cast(obj);
+ return Objects.equal(this.ip, that.ip)
+ && Objects.equal(this.port, that.port);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("ip", ip).add("port", port);
+ }
+
@Override
public String toString() {
- return "IpPortPair [ip=" + ip + ", port=" + port + "]";
+ return string().toString();
+ }
+
+ @Override
+ public int compareTo(IpPortPair o) {
+ if(ip != null && o.getIp() != null) return Longs.compare(ip.getId(), o.getIp().getId());
+ return Ints.compare(port, o.getPort());
}
}
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Job.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Job.java
index 59cbf3e85e..fb8071c2c3 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Job.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Job.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,160 +18,269 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
import java.util.Date;
import java.util.Map;
import java.util.Set;
-import java.util.SortedSet;
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import com.google.common.primitives.Longs;
-import com.google.gson.annotations.SerializedName;
/**
* Represents any job in GoGrid system
* (jobs include server creation, stopping, etc)
*
- * @see
* @author Oleksiy Yarmula
+ * @see
*/
public class Job implements Comparable {
- private long id;
- private Option command;
- @SerializedName("objecttype")
- private ObjectType objectType;
- @SerializedName("createdon")
- private Date createdOn;
- @SerializedName("lastupdatedon")
- private Date lastUpdatedOn;
- @SerializedName("currentstate")
- private JobState currentState;
- private int attempts;
- private String owner;
- private Set history;
- @SerializedName("detail") /*NOTE: as of Feb 28, 10,
- there is a contradiction b/w the name in
- documentation (details) and actual param
- name (detail)*/
- private Map details;
+ public static Builder> builder() {
+ return new ConcreteBuilder();
+ }
- /**
- * A no-args constructor is required for deserialization
- */
- public Job() {
- }
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromJob(this);
+ }
- public Job(long id, Option command, ObjectType objectType,
- Date createdOn, Date lastUpdatedOn, JobState currentState,
- int attempts, String owner, SortedSet history,
- Map details) {
- this.id = id;
- this.command = command;
- this.objectType = objectType;
- this.createdOn = createdOn;
- this.lastUpdatedOn = lastUpdatedOn;
- this.currentState = currentState;
- this.attempts = attempts;
- this.owner = owner;
- this.history = history;
- this.details = details;
- }
+ public static abstract class Builder> {
+ protected abstract T self();
- public long getId() {
- return id;
- }
+ protected long id;
+ protected Option command;
+ protected ObjectType objectType;
+ protected Date createdOn;
+ protected Date lastUpdatedOn;
+ protected JobState currentState;
+ protected int attempts;
+ protected String owner;
+ protected Set history = ImmutableSet.of();
+ protected Map details = ImmutableMap.of();
- public Option getCommand() {
- return command;
- }
+ /**
+ * @see Job#getId()
+ */
+ public T id(long id) {
+ this.id = id;
+ return self();
+ }
- public ObjectType getObjectType() {
- return objectType;
- }
+ /**
+ * @see Job#getCommand()
+ */
+ public T command(Option command) {
+ this.command = command;
+ return self();
+ }
- public Date getCreatedOn() {
- return createdOn;
- }
+ /**
+ * @see Job#getObjectType()
+ */
+ public T objectType(ObjectType objectType) {
+ this.objectType = objectType;
+ return self();
+ }
- public Date getLastUpdatedOn() {
- return lastUpdatedOn;
- }
+ /**
+ * @see Job#getCreatedOn()
+ */
+ public T createdOn(Date createdOn) {
+ this.createdOn = createdOn;
+ return self();
+ }
- public JobState getCurrentState() {
- return currentState;
- }
+ /**
+ * @see Job#getLastUpdatedOn()
+ */
+ public T lastUpdatedOn(Date lastUpdatedOn) {
+ this.lastUpdatedOn = lastUpdatedOn;
+ return self();
+ }
- public int getAttempts() {
- return attempts;
- }
+ /**
+ * @see Job#getCurrentState()
+ */
+ public T currentState(JobState currentState) {
+ this.currentState = currentState;
+ return self();
+ }
- public String getOwner() {
- return owner;
- }
+ /**
+ * @see Job#getAttempts()
+ */
+ public T attempts(int attempts) {
+ this.attempts = attempts;
+ return self();
+ }
- public Set getHistory() {
- return history;
- }
+ /**
+ * @see Job#getOwner()
+ */
+ public T owner(String owner) {
+ this.owner = owner;
+ return self();
+ }
- public Map getDetails() {
- return details;
- }
+ /**
+ * @see Job#getHistory()
+ */
+ public T history(Set history) {
+ this.history = ImmutableSet.copyOf(checkNotNull(history, "history"));
+ return self();
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ public T history(JobProperties... in) {
+ return history(ImmutableSet.copyOf(in));
+ }
- Job job = (Job) o;
+ /**
+ * @see Job#getDetails()
+ */
+ public T details(Map details) {
+ this.details = ImmutableMap.copyOf(checkNotNull(details, "details"));
+ return self();
+ }
- if (attempts != job.attempts) return false;
- if (id != job.id) return false;
- if (command != null ? !command.equals(job.command) : job.command != null) return false;
- if (createdOn != null ? !createdOn.equals(job.createdOn) : job.createdOn != null) return false;
- if (currentState != null ? !currentState.equals(job.currentState) : job.currentState != null) return false;
- if (details != null ? !details.equals(job.details) : job.details != null) return false;
- if (history != null ? !history.equals(job.history) : job.history != null) return false;
- if (lastUpdatedOn != null ? !lastUpdatedOn.equals(job.lastUpdatedOn) : job.lastUpdatedOn != null) return false;
- if (objectType != null ? !objectType.equals(job.objectType) : job.objectType != null) return false;
- if (owner != null ? !owner.equals(job.owner) : job.owner != null) return false;
+ public Job build() {
+ return new Job(id, command, objectType, createdOn, lastUpdatedOn, currentState, attempts, owner, history, details);
+ }
- return true;
- }
+ public T fromJob(Job in) {
+ return this
+ .id(in.getId())
+ .command(in.getCommand())
+ .objectType(in.getObjectType())
+ .createdOn(in.getCreatedOn())
+ .lastUpdatedOn(in.getLastUpdatedOn())
+ .currentState(in.getCurrentState())
+ .attempts(in.getAttempts())
+ .owner(in.getOwner())
+ .history(in.getHistory())
+ .details(in.getDetails());
+ }
+ }
- @Override
- public int hashCode() {
- int result = (int) (id ^ (id >>> 32));
- result = 31 * result + (command != null ? command.hashCode() : 0);
- result = 31 * result + (objectType != null ? objectType.hashCode() : 0);
- result = 31 * result + (createdOn != null ? createdOn.hashCode() : 0);
- result = 31 * result + (lastUpdatedOn != null ? lastUpdatedOn.hashCode() : 0);
- result = 31 * result + (currentState != null ? currentState.hashCode() : 0);
- result = 31 * result + attempts;
- result = 31 * result + (owner != null ? owner.hashCode() : 0);
- result = 31 * result + (history != null ? history.hashCode() : 0);
- result = 31 * result + (details != null ? details.hashCode() : 0);
- return result;
- }
+ private static class ConcreteBuilder extends Builder {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
- @Override
- public int compareTo(Job o) {
- if(createdOn != null && o.getCreatedOn() != null)
- return Longs.compare(createdOn.getTime(), o.getCreatedOn().getTime());
- return Longs.compare(id, o.getId());
- }
+ private final long id;
+ private final Option command;
+ private final ObjectType objectType;
+ private final Date createdOn;
+ private final Date lastUpdatedOn;
+ private final JobState currentState;
+ private final int attempts;
+ private final String owner;
+ private final Set history;
+ private final Map details;
+
+ /* NOTE: as of Feb 28, 10, there is a contradiction b/w the name in documentation (details) and actual param name (detail)*/
+ @ConstructorProperties({
+ "id", "command", "objecttype", "createdon", "lastupdatedon", "currentstate", "attempts", "owner", "history", "detail"
+ })
+ protected Job(long id, Option command, ObjectType objectType, Date createdOn, @Nullable Date lastUpdatedOn,
+ JobState currentState, int attempts, String owner, Set history, Map details) {
+ this.id = id;
+ this.command = checkNotNull(command, "command");
+ this.objectType = checkNotNull(objectType, "objectType");
+ this.createdOn = checkNotNull(createdOn, "createdOn");
+ this.lastUpdatedOn = lastUpdatedOn;
+ this.currentState = checkNotNull(currentState, "currentState");
+ this.attempts = attempts;
+ this.owner = checkNotNull(owner, "owner");
+ this.history = ImmutableSet.copyOf(checkNotNull(history, "history"));
+ this.details = ImmutableMap.copyOf(checkNotNull(details, "details"));
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public Option getCommand() {
+ return this.command;
+ }
+
+ public ObjectType getObjectType() {
+ return this.objectType;
+ }
+
+ public Date getCreatedOn() {
+ return this.createdOn;
+ }
+
+ @Nullable
+ public Date getLastUpdatedOn() {
+ return this.lastUpdatedOn;
+ }
+
+ public JobState getCurrentState() {
+ return this.currentState;
+ }
+
+ public int getAttempts() {
+ return this.attempts;
+ }
+
+ public String getOwner() {
+ return this.owner;
+ }
+
+ public Set getHistory() {
+ return this.history;
+ }
+
+ public Map getDetails() {
+ return this.details;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, command, objectType, createdOn, lastUpdatedOn, currentState, attempts, owner, history, details);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Job that = Job.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.command, that.command)
+ && Objects.equal(this.objectType, that.objectType)
+ && Objects.equal(this.createdOn, that.createdOn)
+ && Objects.equal(this.lastUpdatedOn, that.lastUpdatedOn)
+ && Objects.equal(this.currentState, that.currentState)
+ && Objects.equal(this.attempts, that.attempts)
+ && Objects.equal(this.owner, that.owner)
+ && Objects.equal(this.history, that.history)
+ && Objects.equal(this.details, that.details);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("command", command).add("objectType", objectType).add("createdOn", createdOn).add("lastUpdatedOn", lastUpdatedOn).add("currentState", currentState).add("attempts", attempts).add("owner", owner).add("history", history).add("details", details);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ @Override
+ public int compareTo(Job o) {
+ if(createdOn != null && o.getCreatedOn() != null)
+ return Longs.compare(createdOn.getTime(), o.getCreatedOn().getTime());
+ return Longs.compare(id, o.getId());
+ }
- @Override
- public String toString() {
- return "Job{" +
- "id=" + id +
- ", command=" + command +
- ", objectType=" + objectType +
- ", createdOn=" + createdOn +
- ", lastUpdatedOn=" + lastUpdatedOn +
- ", currentState=" + currentState +
- ", attempts=" + attempts +
- ", owner='" + owner + '\'' +
- ", history=" + history +
- ", details=" + details +
- '}';
- }
}
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/JobProperties.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/JobProperties.java
index f0fa3fcace..58054c9095 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/JobProperties.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/JobProperties.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,92 +18,153 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
import java.util.Date;
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
import com.google.common.primitives.Longs;
-import com.google.gson.annotations.SerializedName;
/**
* State of a job.
- *
+ *
* @see
- *
* @author Oleksiy Yarmula
- */
+*/
public class JobProperties implements Comparable {
- private long id;
- @SerializedName("updatedon")
- private Date updatedOn;
- private JobState state;
- private String note;
+ public static Builder> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromJobProperties(this);
+ }
- /**
- * A no-args constructor is required for deserialization
- */
- public JobProperties() {
+ public static abstract class Builder> {
+ protected abstract T self();
- }
+ protected long id;
+ protected Date updatedOn;
+ protected JobState state;
+ protected String note;
+
+ /**
+ * @see JobProperties#getId()
+ */
+ public T id(long id) {
+ this.id = id;
+ return self();
+ }
- public JobProperties(long id, Date updatedOn, JobState state, String note) {
- this.id = id;
- this.updatedOn = updatedOn;
- this.state = state;
- this.note = note;
- }
+ /**
+ * @see JobProperties#getUpdatedOn()
+ */
+ public T updatedOn(Date updatedOn) {
+ this.updatedOn = updatedOn;
+ return self();
+ }
- public long getId() {
- return id;
- }
+ /**
+ * @see JobProperties#getState()
+ */
+ public T state(JobState state) {
+ this.state = state;
+ return self();
+ }
- public Date getUpdatedOn() {
- return updatedOn;
- }
+ /**
+ * @see JobProperties#getNote()
+ */
+ public T note(String note) {
+ this.note = note;
+ return self();
+ }
- public JobState getState() {
- return state;
- }
+ public JobProperties build() {
+ return new JobProperties(id, updatedOn, state, note);
+ }
+
+ public T fromJobProperties(JobProperties in) {
+ return this
+ .id(in.getId())
+ .updatedOn(in.getUpdatedOn())
+ .state(in.getState())
+ .note(in.getNote());
+ }
+ }
- public String getNote() {
- return note;
- }
+ private static class ConcreteBuilder extends Builder {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ private final long id;
+ private final Date updatedOn;
+ private final JobState state;
+ private final String note;
- JobProperties jobState = (JobProperties) o;
+ @ConstructorProperties({
+ "id", "updatedon", "state", "note"
+ })
+ protected JobProperties(long id, Date updatedOn, JobState state, @Nullable String note) {
+ this.id = id;
+ this.updatedOn = checkNotNull(updatedOn, "updatedOn");
+ this.state = checkNotNull(state, "state");
+ this.note = note;
+ }
- if (id != jobState.id) return false;
- if (note != null ? !note.equals(jobState.note) : jobState.note != null) return false;
- if (state != null ? !state.equals(jobState.state) : jobState.state != null) return false;
- if (updatedOn != null ? !updatedOn.equals(jobState.updatedOn) : jobState.updatedOn != null) return false;
+ public long getId() {
+ return this.id;
+ }
- return true;
- }
+ public Date getUpdatedOn() {
+ return this.updatedOn;
+ }
- @Override
- public int hashCode() {
- int result = (int) (id ^ (id >>> 32));
- result = 31 * result + (updatedOn != null ? updatedOn.hashCode() : 0);
- result = 31 * result + (state != null ? state.hashCode() : 0);
- result = 31 * result + (note != null ? note.hashCode() : 0);
- return result;
- }
+ public JobState getState() {
+ return this.state;
+ }
- @Override
- public String toString() {
- return "JobState{" +
- "id=" + id +
- ", updatedOn=" + updatedOn +
- ", state=" + state +
- ", note='" + note + '\'' +
- '}';
- }
+ @Nullable
+ public String getNote() {
+ return this.note;
+ }
- @Override
- public int compareTo(JobProperties o) {
- return Longs.compare(id, o.getId());
- }
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, updatedOn, state, note);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ JobProperties that = JobProperties.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.updatedOn, that.updatedOn)
+ && Objects.equal(this.state, that.state)
+ && Objects.equal(this.note, that.note);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("updatedOn", updatedOn).add("state", state).add("note", note);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ @Override
+ public int compareTo(JobProperties o) {
+ return Longs.compare(id, o.getId());
+ }
}
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/LoadBalancer.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/LoadBalancer.java
index 4f15779839..3b6aed29f7 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/LoadBalancer.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/LoadBalancer.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,177 +18,259 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
import java.util.Set;
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
import com.google.common.primitives.Longs;
-import com.google.gson.annotations.SerializedName;
/**
+ * Class LoadBalancer
+ *
* @author Oleksiy Yarmula
- */
+*/
public class LoadBalancer implements Comparable {
- private long id;
- private String name;
- private String description;
- @SerializedName("virtualip")
- private IpPortPair virtualIp;
- @SerializedName("realiplist")
- private Set realIpList;
- private LoadBalancerType type;
- private LoadBalancerPersistenceType persistence;
- private LoadBalancerOs os;
- private LoadBalancerState state;
- private Option datacenter;
-
- /**
- * A no-args constructor is required for deserialization
- */
- public LoadBalancer() {
+ public static Builder> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromLoadBalancer(this);
}
- public LoadBalancer(long id, String name, String description, IpPortPair virtualIp,
- Set realIpList, LoadBalancerType type,
- LoadBalancerPersistenceType persistence, LoadBalancerOs os, LoadBalancerState state,
- Option datacenter) {
+ public static abstract class Builder> {
+ protected abstract T self();
+
+ protected long id;
+ protected String name;
+ protected String description;
+ protected IpPortPair virtualIp;
+ protected Set realIpList = ImmutableSet.of();
+ protected LoadBalancerType type;
+ protected LoadBalancerPersistenceType persistence;
+ protected LoadBalancerOs os;
+ protected LoadBalancerState state;
+ protected Option datacenter;
+
+ /**
+ * @see LoadBalancer#getId()
+ */
+ public T id(long id) {
+ this.id = id;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getDescription()
+ */
+ public T description(String description) {
+ this.description = description;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getVirtualIp()
+ */
+ public T virtualIp(IpPortPair virtualIp) {
+ this.virtualIp = virtualIp;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getRealIpList()
+ */
+ public T realIpList(Set realIpList) {
+ this.realIpList = ImmutableSet.copyOf(checkNotNull(realIpList, "realIpList"));
+ return self();
+ }
+
+ public T realIpList(IpPortPair... in) {
+ return realIpList(ImmutableSet.copyOf(in));
+ }
+
+ /**
+ * @see LoadBalancer#getType()
+ */
+ public T type(LoadBalancerType type) {
+ this.type = type;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getPersistence()
+ */
+ public T persistence(LoadBalancerPersistenceType persistence) {
+ this.persistence = persistence;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getOs()
+ */
+ public T os(LoadBalancerOs os) {
+ this.os = os;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getState()
+ */
+ public T state(LoadBalancerState state) {
+ this.state = state;
+ return self();
+ }
+
+ /**
+ * @see LoadBalancer#getDatacenter()
+ */
+ public T datacenter(Option datacenter) {
+ this.datacenter = datacenter;
+ return self();
+ }
+
+ public LoadBalancer build() {
+ return new LoadBalancer(id, name, description, virtualIp, realIpList, type, persistence, os, state, datacenter);
+ }
+
+ public T fromLoadBalancer(LoadBalancer in) {
+ return this
+ .id(in.getId())
+ .name(in.getName())
+ .description(in.getDescription())
+ .virtualIp(in.getVirtualIp())
+ .realIpList(in.getRealIpList())
+ .type(in.getType())
+ .persistence(in.getPersistence())
+ .os(in.getOs())
+ .state(in.getState())
+ .datacenter(in.getDatacenter());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final long id;
+ private final String name;
+ private final String description;
+ private final IpPortPair virtualIp;
+ private final Set realIpList;
+ private final LoadBalancerType type;
+ private final LoadBalancerPersistenceType persistence;
+ private final LoadBalancerOs os;
+ private final LoadBalancerState state;
+ private final Option datacenter;
+
+ @ConstructorProperties({
+ "id", "name", "description", "virtualip", "realiplist", "type", "persistence", "os", "state", "datacenter"
+ })
+ protected LoadBalancer(long id, String name, @Nullable String description, IpPortPair virtualIp, Set realIpList, LoadBalancerType type, LoadBalancerPersistenceType persistence, LoadBalancerOs os, LoadBalancerState state, Option datacenter) {
this.id = id;
- this.name = name;
+ this.name = checkNotNull(name, "name");
this.description = description;
- this.virtualIp = virtualIp;
- this.realIpList = realIpList;
- this.type = type;
- this.persistence = persistence;
- this.os = os;
- this.state = state;
- this.datacenter = datacenter;
+ this.virtualIp = checkNotNull(virtualIp, "virtualIp");
+ this.realIpList = ImmutableSet.copyOf(checkNotNull(realIpList, "realIpList"));
+ this.type = checkNotNull(type, "type");
+ this.persistence = checkNotNull(persistence, "persistence");
+ this.os = checkNotNull(os, "os");
+ this.state = checkNotNull(state, "state");
+ this.datacenter = checkNotNull(datacenter, "datacenter");
}
public long getId() {
- return id;
- }
-
- public Option getDatacenter() {
- return datacenter;
+ return this.id;
}
public String getName() {
- return name;
+ return this.name;
}
+ @Nullable
public String getDescription() {
- return description;
+ return this.description;
}
public IpPortPair getVirtualIp() {
- return virtualIp;
+ return this.virtualIp;
}
public Set getRealIpList() {
- return realIpList;
+ return this.realIpList;
}
public LoadBalancerType getType() {
- return type;
+ return this.type;
}
public LoadBalancerPersistenceType getPersistence() {
- return persistence;
+ return this.persistence;
}
public LoadBalancerOs getOs() {
- return os;
+ return this.os;
}
public LoadBalancerState getState() {
- return state;
+ return this.state;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- LoadBalancer other = (LoadBalancer) obj;
- if (datacenter == null) {
- if (other.datacenter != null)
- return false;
- } else if (!datacenter.equals(other.datacenter))
- return false;
- if (description == null) {
- if (other.description != null)
- return false;
- } else if (!description.equals(other.description))
- return false;
- if (id != other.id)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (os == null) {
- if (other.os != null)
- return false;
- } else if (!os.equals(other.os))
- return false;
- if (persistence == null) {
- if (other.persistence != null)
- return false;
- } else if (!persistence.equals(other.persistence))
- return false;
- if (realIpList == null) {
- if (other.realIpList != null)
- return false;
- } else if (!realIpList.equals(other.realIpList))
- return false;
- if (state == null) {
- if (other.state != null)
- return false;
- } else if (!state.equals(other.state))
- return false;
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.equals(other.type))
- return false;
- if (virtualIp == null) {
- if (other.virtualIp != null)
- return false;
- } else if (!virtualIp.equals(other.virtualIp))
- return false;
- return true;
+ public Option getDatacenter() {
+ return this.datacenter;
}
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((datacenter == null) ? 0 : datacenter.hashCode());
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + (int) (id ^ (id >>> 32));
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((os == null) ? 0 : os.hashCode());
- result = prime * result + ((persistence == null) ? 0 : persistence.hashCode());
- result = prime * result + ((realIpList == null) ? 0 : realIpList.hashCode());
- result = prime * result + ((state == null) ? 0 : state.hashCode());
- result = prime * result + ((type == null) ? 0 : type.hashCode());
- result = prime * result + ((virtualIp == null) ? 0 : virtualIp.hashCode());
- return result;
+ return Objects.hashCode(id, name, description, virtualIp, realIpList, type, persistence, os, state, datacenter);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ LoadBalancer that = LoadBalancer.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.description, that.description)
+ && Objects.equal(this.virtualIp, that.virtualIp)
+ && Objects.equal(this.realIpList, that.realIpList)
+ && Objects.equal(this.type, that.type)
+ && Objects.equal(this.persistence, that.persistence)
+ && Objects.equal(this.os, that.os)
+ && Objects.equal(this.state, that.state)
+ && Objects.equal(this.datacenter, that.datacenter);
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper(this)
+ .add("id", id).add("name", name).add("description", description).add("virtualIp", virtualIp).add("realIpList", realIpList).add("type", type).add("persistence", persistence).add("os", os).add("state", state).add("datacenter", datacenter);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
}
@Override
public int compareTo(LoadBalancer o) {
return Longs.compare(id, o.getId());
}
-
- @Override
- public String toString() {
- return "LoadBalancer [datacenter=" + datacenter + ", description=" + description + ", id="
- + id + ", name=" + name + ", os=" + os + ", persistence=" + persistence
- + ", realIpList=" + realIpList + ", state=" + state + ", type=" + type
- + ", virtualIp=" + virtualIp + "]";
- }
}
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Option.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Option.java
index 3f8fe9db77..68bde78de4 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Option.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/Option.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,79 +18,138 @@
*/
package org.jclouds.gogrid.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
import com.google.common.primitives.Longs;
/**
+ * Class Option
+ *
* @author Oleksiy Yarmula
- */
+*/
public class Option implements Comparable