Package org.infinispan.commons.util
Class TimeQuantity
java.lang.Object
java.lang.Number
org.infinispan.commons.util.TimeQuantity
- All Implemented Interfaces:
Serializable
,Matchable<TimeQuantity>
Parser human-readable quantity of time.
- Since:
- 15.1
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondouble
boolean
float
int
hashCode()
int
intValue()
long
toString()
static TimeQuantity
valueOf
(long l) static TimeQuantity
Parses the byte quantity representation composed of a number plus a unit.static TimeQuantity
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
PARSER
-
-
Method Details
-
longValue
public long longValue() -
intValue
public int intValue() -
floatValue
public float floatValue()- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValue
in classNumber
-
toDuration
-
toString
-
equals
-
hashCode
public int hashCode() -
valueOf
Parses the byte quantity representation composed of a number plus a unit. When the unit is omitted, it is assumed as milliseconds. The supported units are:- ms: milliseconds
- s: seconds
- m: minutes
- h: hours
- d: days
Examples:
1000
,1s
,1.5h
,10m
- Parameters:
s
- The String representing a quantity (can have decimals) plus the optional unit.- Returns:
- TimeQuantity
- Throws:
IllegalArgumentException
- if the string cannot be parsed.
-
valueOf
-
valueOf
- Throws:
IllegalArgumentException
-