|
@@ -16,6 +16,12 @@ public class StorageQuantity {
|
|
|
//存储的默认单位为MB
|
|
//存储的默认单位为MB
|
|
|
private Unit unit = Unit.MB;
|
|
private Unit unit = Unit.MB;
|
|
|
|
|
|
|
|
|
|
+ //存储空间为0
|
|
|
|
|
+ public static final StorageQuantity EMPTY = new StorageQuantity(0);
|
|
|
|
|
+
|
|
|
|
|
+ //默认存储空间为500Mi
|
|
|
|
|
+ public static final StorageQuantity DEFAULT = new StorageQuantity(500);
|
|
|
|
|
+
|
|
|
//存储单位
|
|
//存储单位
|
|
|
public enum Unit{
|
|
public enum Unit{
|
|
|
KB("Ki"),
|
|
KB("Ki"),
|
|
@@ -33,7 +39,6 @@ public class StorageQuantity {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static final StorageQuantity EMPTY = new StorageQuantity(0);
|
|
|
|
|
|
|
|
|
|
public StorageQuantity(int quantity){
|
|
public StorageQuantity(int quantity){
|
|
|
this.quantity = Quantity.fromString(quantity + unit.getCode());
|
|
this.quantity = Quantity.fromString(quantity + unit.getCode());
|