mirror of https://github.com/apache/jclouds.git
Adding description field to Tenant
This commit is contained in:
parent
9cfa022863
commit
7033076f00
|
@ -23,6 +23,10 @@ import static com.google.common.base.Objects.equal;
|
||||||
import static com.google.common.base.Objects.toStringHelper;
|
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 javax.ws.rs.DefaultValue;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +50,7 @@ public class Tenant implements Comparable<Tenant> {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
protected String id;
|
protected String id;
|
||||||
protected String name;
|
protected String name;
|
||||||
|
protected String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Tenant#getId()
|
* @see Tenant#getId()
|
||||||
|
@ -63,8 +68,16 @@ public class Tenant implements Comparable<Tenant> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Tenant#getDescription()
|
||||||
|
*/
|
||||||
|
public Builder description(String description) {
|
||||||
|
this.description = description;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Tenant build() {
|
public Tenant build() {
|
||||||
return new Tenant(id, name);
|
return new Tenant(id, name, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder fromTenant(Tenant from) {
|
public Builder fromTenant(Tenant from) {
|
||||||
|
@ -74,10 +87,12 @@ public class Tenant implements Comparable<Tenant> {
|
||||||
|
|
||||||
protected final String id;
|
protected final String id;
|
||||||
protected final String name;
|
protected final String name;
|
||||||
|
protected final String description;
|
||||||
|
|
||||||
public Tenant(String id, String name) {
|
protected Tenant(String id, String name, String description) {
|
||||||
this.id = checkNotNull(id, "id");
|
this.id = checkNotNull(id, "id");
|
||||||
this.name = checkNotNull(name, "name");
|
this.name = checkNotNull(name, "name");
|
||||||
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,6 +111,14 @@ public class Tenant implements Comparable<Tenant> {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the description of the tenant
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if (this == object) {
|
if (this == object) {
|
||||||
|
@ -103,7 +126,8 @@ public class Tenant implements Comparable<Tenant> {
|
||||||
}
|
}
|
||||||
if (object instanceof Tenant) {
|
if (object instanceof Tenant) {
|
||||||
final Tenant other = Tenant.class.cast(object);
|
final Tenant other = Tenant.class.cast(object);
|
||||||
return equal(id, other.id) && equal(name, other.name);
|
return equal(id, other.id) && equal(name, other.name)
|
||||||
|
&& equal(description, other.description);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -111,12 +135,12 @@ public class Tenant implements Comparable<Tenant> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(id, name);
|
return Objects.hashCode(id, name, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toStringHelper("").add("id", id).add("name", name).toString();
|
return toStringHelper("").add("id", id).add("name", name).add("description", description).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue