Renamed Volume.VolumeType to Volume.Type

This commit is contained in:
andreisavu 2011-12-11 21:41:09 +02:00
parent 78e36e7904
commit 7bece5985a
4 changed files with 19 additions and 19 deletions

View File

@ -50,7 +50,7 @@ public class Snapshot implements Comparable<Snapshot> {
private State state;
private long volumeId;
private String volumeName;
private Volume.VolumeType volumeType;
private Volume.Type volumeType;
/**
* @param id ID of the snapshot
@ -159,7 +159,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @param volumeType type of the disk volume
*/
public Builder volumeType(Volume.VolumeType volumeType) {
public Builder volumeType(Volume.Type volumeType) {
this.volumeType = volumeType;
return this;
}
@ -236,10 +236,10 @@ public class Snapshot implements Comparable<Snapshot> {
@SerializedName("volumename")
private String volumeName;
@SerializedName("volumetype")
private Volume.VolumeType volumeType;
private Volume.Type volumeType;
public Snapshot(long id, String account, Date created, String domain, long domainId, Interval interval, long jobId,
String jobStatus, String name, Type snapshotType, State state, long volumeId, String volumeName, Volume.VolumeType volumeType) {
String jobStatus, String name, Type snapshotType, State state, long volumeId, String volumeName, Volume.Type volumeType) {
this.id = id;
this.account = account;
this.created = created;
@ -356,7 +356,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @return type of the disk volume
*/
public Volume.VolumeType getVolumeType() {
public Volume.Type getVolumeType() {
return volumeType;
}

View File

@ -66,7 +66,7 @@ public class Volume implements Comparable<Volume> {
private State state;
private String storage;
private String storageType;
private VolumeType type;
private Type type;
private long virtualMachineId;
private String vmDisplayName;
private String vmName;
@ -194,7 +194,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder type(VolumeType type) {
public Builder type(Type type) {
this.type = type;
return this;
}
@ -275,7 +275,7 @@ public class Volume implements Comparable<Volume> {
@SerializedName("storagetype")
// MAYDO: this should perhaps be an enum; only value I have seen is "shared"
private String storageType;
private VolumeType type;
private Type type;
@SerializedName("virtualmachineid")
private long virtualMachineId;
@SerializedName("vmdisplayname")
@ -294,7 +294,7 @@ public class Volume implements Comparable<Volume> {
String domain, long domainId, String hypervisor, boolean extractable, long jobId,
String jobStatus, String name, String serviceOfferingDisplayText, long serviceOfferingId,
String serviceOfferingName, long size, long snapshotId, State state, String storage,
String storageType, VolumeType type, long virtualMachineId, String vmDisplayName, String vmName,
String storageType, Type type, long virtualMachineId, String vmDisplayName, String vmName,
VirtualMachine.State vmState, long zoneId, String zoneName) {
this.id = id;
this.account = account;
@ -425,7 +425,7 @@ public class Volume implements Comparable<Volume> {
return storageType;
}
public VolumeType getType() {
public Type getType() {
return type;
}
@ -626,24 +626,24 @@ public class Volume implements Comparable<Volume> {
}
}
public enum VolumeType {
public enum Type {
ROOT(0),
DATADISK(1),
UNRECOGNIZED(Integer.MAX_VALUE);
private int code;
private static final Map<Integer, VolumeType> INDEX = Maps.uniqueIndex(ImmutableSet.copyOf(VolumeType.values()),
new Function<VolumeType, Integer>() {
private static final Map<Integer, Type> INDEX = Maps.uniqueIndex(ImmutableSet.copyOf(Type.values()),
new Function<Type, Integer>() {
@Override
public Integer apply(VolumeType input) {
public Integer apply(Type input) {
return input.code;
}
});
VolumeType(int code) {
Type(int code) {
this.code = code;
}
@ -652,7 +652,7 @@ public class Volume implements Comparable<Volume> {
return name().toLowerCase();
}
public static VolumeType fromValue(String resourceType) {
public static Type fromValue(String resourceType) {
Integer code = new Integer(checkNotNull(resourceType, "resourcetype"));
return INDEX.containsKey(code) ? INDEX.get(code) : UNRECOGNIZED;
}

View File

@ -85,7 +85,7 @@ public class ListVolumesOptions extends AccountInDomainOptions {
/**
* @param type the type of the disk volume
*/
public ListVolumesOptions type(Volume.VolumeType type) {
public ListVolumesOptions type(Volume.Type type) {
this.queryParameters.replaceValues("type", ImmutableSet.of(type .toString()));
return this;
}
@ -179,7 +179,7 @@ public class ListVolumesOptions extends AccountInDomainOptions {
/**
* @see ListVolumesOptions#type
*/
public static ListVolumesOptions type(Volume.VolumeType type) {
public static ListVolumesOptions type(Volume.Type type) {
ListVolumesOptions options = new ListVolumesOptions();
return options.type(type);
}

View File

@ -237,7 +237,7 @@ public class VolumeClientLiveTest extends BaseCloudStackClientLiveTest {
static void checkVolume(final Volume volume) {
assertNotNull(volume.getId());
assertNotNull(volume.getName());
assertNotSame(Volume.VolumeType.UNRECOGNIZED, volume.getType());
assertNotSame(Volume.Type.UNRECOGNIZED, volume.getType());
}
Volume findVolumeWithId(final long id) {