Unit.UnitMisMatchException
Enum Constant and Description |
---|
Days |
Hours |
Millis |
Minutes |
Seconds |
Weeks |
Modifier and Type | Field and Description |
---|---|
static java.util.EnumSet<Duration> |
ALLOWABLE_DURATION |
MATH_CONTEXT
Modifier and Type | Method and Description |
---|---|
UnitValue<Duration> |
convert(UnitValue<Duration> otherValue)
Returns an instance of the UnitValue with this Unit converted according to a specific ratio
|
static UnitValue<Duration> |
createValueFromUnitString(java.lang.String unitString,
java.math.BigDecimal theValue)
helper method used to choose the correct UOM and set the value.
|
long |
getRatio(Duration d)
Deprecated.
|
UnitValue<Duration> |
valueOf(java.math.BigDecimal b)
Returns an instance of the UnitValue with this Unit and provided quantity
|
static Duration |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Duration[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Duration Millis
public static final Duration Seconds
public static final Duration Minutes
public static final Duration Hours
public static final Duration Days
public static final Duration Weeks
public static final transient java.util.EnumSet<Duration> ALLOWABLE_DURATION
public static Duration[] values()
for (Duration c : Duration.values()) System.out.println(c);
public static Duration 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(Duration d)
The method returns a negative value if d is smaller than this Unit. For example, if d is Millis and this Unit is in Seconds then the returned value will be 1000. If d is in Seconds and this Unit is in Millis then the returned value is -1000. Negative value is returned to avoid any expensive divisions.
getRatio
in interface Unit<Duration>
d
- Duration to find the conversion ration with.public UnitValue<Duration> valueOf(java.math.BigDecimal b)
public UnitValue<Duration> convert(UnitValue<Duration> otherValue)
public static UnitValue<Duration> createValueFromUnitString(java.lang.String unitString, java.math.BigDecimal theValue)
unitString
- the UOM for the Data valuetheValue
- the data value