org.apache.tapestry5.ioc.util
Class TimeInterval
java.lang.Object
org.apache.tapestry5.ioc.util.TimeInterval
public class TimeInterval
- extends java.lang.Object
Used to represent a period of time, specifically as a configuration value. This is often used to specify timeouts.
TimePeriods are parsed from strings.
The string specifys a number of terms. The values of all the terms are summed together to form the total time period.
Each term consists of a number followed by a unit. Units (from largest to smallest) are: - y
- year
- d
- day
- h
- hour
- m
- minute
- s
- second
- ms
- millisecond
Example: "2 h 30 m". By
convention, terms are specified largest to smallest. A term without a unit is assumed to be milliseconds. Units are
case insensitive ("h" or "H" are treated the same).
Constructor Summary |
TimeInterval(long milliseconds)
|
TimeInterval(java.lang.String input)
Creates a TimeInterval for a string. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TimeInterval
public TimeInterval(java.lang.String input)
- Creates a TimeInterval for a string.
- Parameters:
input
- the string specifying the amount of time in the period
TimeInterval
public TimeInterval(long milliseconds)
milliseconds
public long milliseconds()
seconds
public long seconds()
toDescription
public java.lang.String toDescription()
- Converts the milliseconds back into a string (compatible with
TimeInterval(String)
).
- Since:
- 5.2.0
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
Copyright © 2003-2012 The Apache Software Foundation.