domain object tweaks

This commit is contained in:
danikov 2012-02-14 12:13:44 +00:00
parent e50dd9f2eb
commit b8c0670cad
6 changed files with 113 additions and 69 deletions

View File

@ -20,8 +20,8 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@ -29,6 +29,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.testng.collections.Lists;
import com.google.common.base.Objects;
@ -58,7 +60,7 @@ import com.google.common.base.Objects;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AvailableNetworks", propOrder = {
"network"
"networks"
})
public class AvailableNetworks {
public static Builder builder() {
@ -71,25 +73,32 @@ public class AvailableNetworks {
public static class Builder {
private List<Reference> network;
private List<Reference> networks = Lists.newArrayList();
/**
* @see AvailableNetworks#getNetwork()
* @see AvailableNetworks#getNetworks()
*/
public Builder network(List<Reference> network) {
this.network = network;
public Builder networks(List<Reference> networks) {
this.networks = Lists.newArrayList(checkNotNull(networks, "networks"));
return this;
}
/**
* @see AvailableNetworks#getNetworks()
*/
public Builder network(Reference network) {
networks.add(checkNotNull(network, "network"));
return this;
}
public AvailableNetworks build() {
AvailableNetworks availableNetworks = new AvailableNetworks(network);
AvailableNetworks availableNetworks = new AvailableNetworks(networks);
return availableNetworks;
}
public Builder fromAvailableNetworks(AvailableNetworks in) {
return network(in.getNetwork());
return networks(in.getNetworks());
}
}
@ -97,13 +106,13 @@ public class AvailableNetworks {
// For JAXB and builder use
}
private AvailableNetworks(List<Reference> network) {
this.network = network;
private AvailableNetworks(List<Reference> networks) {
this.networks = networks;
}
@XmlElement(name = "Network")
protected List<Reference> network;
protected List<Reference> networks;
/**
* Gets the value of the network property.
@ -127,11 +136,11 @@ public class AvailableNetworks {
*
*
*/
public List<Reference> getNetwork() {
if (network == null) {
network = new ArrayList<Reference>();
public List<Reference> getNetworks() {
if (networks == null) {
networks = Lists.newArrayList();
}
return this.network;
return this.networks;
}
@Override
@ -141,18 +150,18 @@ public class AvailableNetworks {
if (o == null || getClass() != o.getClass())
return false;
AvailableNetworks that = AvailableNetworks.class.cast(o);
return equal(network, that.network);
return equal(networks, that.networks);
}
@Override
public int hashCode() {
return Objects.hashCode(network);
return Objects.hashCode(networks);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("network", network).toString();
.add("network", networks).toString();
}
}

View File

@ -45,8 +45,8 @@ import com.google.common.base.Objects;
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="Units" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="Allocated" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* &lt;element name="Limit" type="{http://www.w3.org/2001/XMLSchema}long"/>
* &lt;element name="Allocated" type="{http://www.w3.org/2001/XMLSchema}Long" minOccurs="0"/>
* &lt;element name="Limit" type="{http://www.w3.org/2001/XMLSchema}Long"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
@ -79,7 +79,7 @@ public class CapacityType<T extends CapacityType<T>> {
protected String units;
protected Long allocated;
protected long limit;
protected Long limit;
/**
* @see CapacityType#getUnits()
@ -100,7 +100,7 @@ public class CapacityType<T extends CapacityType<T>> {
/**
* @see CapacityType#getLimit()
*/
public Builder<T> limit(long limit) {
public Builder<T> limit(Long limit) {
this.limit = limit;
return this;
}
@ -137,7 +137,7 @@ public class CapacityType<T extends CapacityType<T>> {
@XmlElement(name = "Allocated")
protected Long allocated;
@XmlElement(name = "Limit")
protected long limit;
protected Long limit;
/**
* Gets the value of the units property.
@ -191,7 +191,7 @@ public class CapacityType<T extends CapacityType<T>> {
* Gets the value of the limit property.
*
*/
public long getLimit() {
public Long getLimit() {
return limit;
}
@ -199,7 +199,7 @@ public class CapacityType<T extends CapacityType<T>> {
* Sets the value of the limit property.
*
*/
public void setLimit(long value) {
public void setLimit(Long value) {
this.limit = value;
}

View File

@ -43,8 +43,8 @@ import com.google.common.base.Objects;
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}CapacityType">
* &lt;sequence>
* &lt;element name="Used" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* &lt;element name="Overhead" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* &lt;element name="Used" type="{http://www.w3.org/2001/XMLSchema}Long" minOccurs="0"/>
* &lt;element name="Overhead" type="{http://www.w3.org/2001/XMLSchema}Long" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
@ -121,7 +121,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
/**
* @see CapacityType#getLimit()
*/
public Builder limit(long limit) {
public Builder limit(Long limit) {
this.limit = limit;
return this;
}

View File

@ -20,8 +20,8 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@ -29,6 +29,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.testng.collections.Lists;
import com.google.common.base.Objects;
@ -46,7 +48,7 @@ import com.google.common.base.Objects;
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="ResourceEntity" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType<?>Type" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element name="ResourceEntity" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
@ -58,7 +60,7 @@ import com.google.common.base.Objects;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResourceEntities", propOrder = {
"resourceEntity"
"resourceEntities"
})
public class ResourceEntities {
public static Builder builder() {
@ -71,25 +73,32 @@ public class ResourceEntities {
public static class Builder {
private List<ReferenceType<?>> resourceEntity;
private List<Reference> resourceEntities = Lists.newArrayList();
/**
* @see ResourceEntities#getResourceEntity()
* @see ResourceEntities#getResourceEntities()
*/
public Builder resourceEntity(List<ReferenceType<?>> resourceEntity) {
this.resourceEntity = resourceEntity;
public Builder resourceEntities(List<Reference> resourceEntities) {
this.resourceEntities = Lists.newArrayList(checkNotNull(resourceEntities, "resourceEntities"));
return this;
}
/**
* @see ResourceEntities#getResourceEntities()
*/
public Builder resourceEntity(Reference resourceEntity) {
resourceEntities.add(checkNotNull(resourceEntity, "resourceEntity"));
return this;
}
public ResourceEntities build() {
ResourceEntities resourceEntities = new ResourceEntities(resourceEntity);
ResourceEntities resourceEntities = new ResourceEntities(this.resourceEntities);
return resourceEntities;
}
public Builder fromResourceEntities(ResourceEntities in) {
return resourceEntity(in.getResourceEntity());
return resourceEntities(in.getResourceEntities());
}
}
@ -97,13 +106,13 @@ public class ResourceEntities {
// For JAXB and builder use
}
private ResourceEntities(List<ReferenceType<?>> resourceEntity) {
this.resourceEntity = resourceEntity;
private ResourceEntities(List<Reference> resourceEntity) {
this.resourceEntities = resourceEntity;
}
@XmlElement(name = "ResourceEntity")
protected List<ReferenceType<?>> resourceEntity;
protected List<Reference> resourceEntities;
/**
* Gets the value of the resourceEntity property.
@ -123,15 +132,15 @@ public class ResourceEntities {
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType<?>Type }
* {@link ReferenceType }
*
*
*/
public List<ReferenceType<?>> getResourceEntity() {
if (resourceEntity == null) {
resourceEntity = new ArrayList<ReferenceType<?>>();
public List<Reference> getResourceEntities() {
if (resourceEntities == null) {
resourceEntities = Lists.newArrayList();
}
return this.resourceEntity;
return this.resourceEntities;
}
@Override
@ -141,18 +150,18 @@ public class ResourceEntities {
if (o == null || getClass() != o.getClass())
return false;
ResourceEntities that = ResourceEntities.class.cast(o);
return equal(resourceEntity, that.resourceEntity);
return equal(resourceEntities, that.resourceEntities);
}
@Override
public int hashCode() {
return Objects.hashCode(resourceEntity);
return Objects.hashCode(resourceEntities);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("resourceEntity", resourceEntity).toString();
.add("resourceEntity", resourceEntities).toString();
}
}

View File

@ -20,8 +20,8 @@
package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@ -29,6 +29,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.testng.collections.Lists;
import com.google.common.base.Objects;
@ -58,7 +60,7 @@ import com.google.common.base.Objects;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SupportedHardwareVersions", propOrder = {
"supportedHardwareVersion"
"supportedHardwareVersions"
})
public class SupportedHardwareVersions {
public static Builder builder() {
@ -71,25 +73,32 @@ public class SupportedHardwareVersions {
public static class Builder {
private List<String> supportedHardwareVersion;
private List<String> supportedHardwareVersions = Lists.newArrayList();
/**
* @see SupportedHardwareVersions#getSupportedHardwareVersion()
* @see SupportedHardwareVersions#getSupportedHardwareVersions()
*/
public Builder supportedHardwareVersion(List<String> supportedHardwareVersion) {
this.supportedHardwareVersion = supportedHardwareVersion;
public Builder supportedHardwareVersions(List<String> supportedHardwareVersions) {
this.supportedHardwareVersions = Lists.newArrayList(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions"));
return this;
}
/**
* @see SupportedHardwareVersions#getSupportedHardwareVersions()
*/
public Builder supportedHardwareVersion(String supportedHardwareVersion) {
supportedHardwareVersions.add(checkNotNull(supportedHardwareVersion, "supportedHardwareVersion"));
return this;
}
public SupportedHardwareVersions build() {
SupportedHardwareVersions supportedHardwareVersions = new SupportedHardwareVersions(supportedHardwareVersion);
SupportedHardwareVersions supportedHardwareVersions = new SupportedHardwareVersions(this.supportedHardwareVersions);
return supportedHardwareVersions;
}
public Builder fromSupportedHardwareVersions(SupportedHardwareVersions in) {
return supportedHardwareVersion(in.getSupportedHardwareVersion());
return supportedHardwareVersions(in.getSupportedHardwareVersions());
}
}
@ -97,13 +106,13 @@ public class SupportedHardwareVersions {
// For JAXB and builder use
}
private SupportedHardwareVersions(List<String> supportedHardwareVersion) {
this.supportedHardwareVersion = supportedHardwareVersion;
private SupportedHardwareVersions(List<String> supportedHardwareVersions) {
this.supportedHardwareVersions = supportedHardwareVersions;
}
@XmlElement(name = "SupportedHardwareVersion")
protected List<String> supportedHardwareVersion;
protected List<String> supportedHardwareVersions;
/**
* Gets the value of the supportedHardwareVersion property.
@ -127,11 +136,11 @@ public class SupportedHardwareVersions {
*
*
*/
public List<String> getSupportedHardwareVersion() {
if (supportedHardwareVersion == null) {
supportedHardwareVersion = new ArrayList<String>();
public List<String> getSupportedHardwareVersions() {
if (supportedHardwareVersions == null) {
supportedHardwareVersions = Lists.newArrayList();
}
return this.supportedHardwareVersion;
return this.supportedHardwareVersions;
}
@Override
@ -141,18 +150,18 @@ public class SupportedHardwareVersions {
if (o == null || getClass() != o.getClass())
return false;
SupportedHardwareVersions that = SupportedHardwareVersions.class.cast(o);
return equal(supportedHardwareVersion, that.supportedHardwareVersion);
return equal(supportedHardwareVersions, that.supportedHardwareVersions);
}
@Override
public int hashCode() {
return Objects.hashCode(supportedHardwareVersion);
return Objects.hashCode(supportedHardwareVersions);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("supportedHardwareVersion", supportedHardwareVersion).toString();
.add("supportedHardwareVersion", supportedHardwareVersions).toString();
}
}

View File

@ -29,6 +29,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
@ -71,7 +72,8 @@ import com.google.common.collect.Sets;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Vdc", propOrder = {
@XmlRootElement(name = "Vdc")
@XmlType(propOrder = {
"allocationModel",
"storageCapacity",
"computeCapacity",
@ -217,7 +219,22 @@ public class Vdc
vdc.setStatus(status);
return vdc;
}
/**
* @see EntityType#getName()
*/
public Builder name(String name) {
super.name(name);
return this;
}
/**
* @see EntityType#getDescription()
*/
public Builder description(String description) {
super.description(description);
return this;
}
/**
* @see EntityType#getId()