public enum Data extends java.lang.Enum<Data> implements Unit<Data>
Unit.UnitMisMatchException
Enum Constant and Description |
---|
Bytes |
GibiBytes |
GigaBytes |
KibiBytes |
KiloBytes |
MebiBytes |
MegaBytes |
TebiBytes |
TeraBytes |
Modifier and Type | Field and Description |
---|---|
static java.util.EnumSet<Data> |
BINARY_PREFIX_SET |
static java.util.EnumSet<Data> |
METRIC_PREFIX_SET |
MATH_CONTEXT
Modifier and Type | Method and Description |
---|---|
UnitValue<Data> |
convert(UnitValue<Data> otherValue)
Returns an instance of the UnitValue with this Unit converted according to a specific ratio
|
static UnitValue<Data> |
createValueFromUnitString(java.lang.String unitString,
java.math.BigDecimal theValue)
helper method used to choose the correct UOM and set the value.
|
long |
getRatio(Data d)
Deprecated.
|
UnitValue<Data> |
valueOf(java.math.BigDecimal b)
Returns an instance of the UnitValue with this Unit and provided quantity
|
static Data |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Data[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Data Bytes
public static final Data KibiBytes
public static final Data MebiBytes
public static final Data GibiBytes
public static final Data TebiBytes
public static final Data KiloBytes
public static final Data MegaBytes
public static final Data GigaBytes
public static final Data TeraBytes
public static final java.util.EnumSet<Data> METRIC_PREFIX_SET
public static final java.util.EnumSet<Data> BINARY_PREFIX_SET
public static Data[] values()
for (Data c : Data.values()) System.out.println(c);
public static Data valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null@Deprecated public long getRatio(Data d)
The method returns a negative value if d is smaller than this Unit. For example, if d is KibiBytes and this Unit is in MebiBytes then the returned value will be 1024. If d is in MebiBytes and this Unit is in KibiBytes then the returned value is -1024. Negative value is returned to avoid any expensive divisions.
public UnitValue<Data> valueOf(java.math.BigDecimal b)
public UnitValue<Data> convert(UnitValue<Data> otherValue)
public static UnitValue<Data> createValueFromUnitString(java.lang.String unitString, java.math.BigDecimal theValue)
unitString
- the UOM for the Data valuetheValue
- the data value