Package com.adaptris.util
Class TimeInterval
- java.lang.Object
-
- com.adaptris.util.TimeInterval
-
public class TimeInterval extends java.lang.Object
Class that describes a time unit for use within the adapter.- See Also:
TimeUnit
In the adapter configuration file this class is aliased as time-interval which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Constructor Summary
Constructors Constructor Description TimeInterval()
TimeInterval(java.lang.Long interval, java.lang.String unit)
TimeInterval(java.lang.Long interval, java.util.concurrent.TimeUnit unit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Long
getInterval()
java.util.concurrent.TimeUnit
getUnit()
void
setInterval(java.lang.Long interval)
Define the actual interval for this interval.void
setUnit(java.util.concurrent.TimeUnit unit)
Define the unit for this interval.long
toMilliseconds()
static long
toMillisecondsDefaultIfNull(TimeInterval t, long defaultMs)
static long
toMillisecondsDefaultIfNull(TimeInterval t, TimeInterval defaultInterval)
static long
toSecondsDefaultIfNull(TimeInterval t, long defaultMs)
static long
toSecondsDefaultIfNull(TimeInterval t, TimeInterval defaultInterval)
java.lang.String
toString()
-
-
-
Method Detail
-
toMilliseconds
public long toMilliseconds()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getUnit
public java.util.concurrent.TimeUnit getUnit()
-
setUnit
public void setUnit(java.util.concurrent.TimeUnit unit)
Define the unit for this interval.- Parameters:
unit
- the unit, if not specified (or unknown) defaults toTimeUnit.SECONDS
-
getInterval
public java.lang.Long getInterval()
-
setInterval
public void setInterval(java.lang.Long interval)
Define the actual interval for this interval.- Parameters:
interval
- the interval, if not specified defaults to 10.
-
toMillisecondsDefaultIfNull
public static long toMillisecondsDefaultIfNull(TimeInterval t, long defaultMs)
-
toMillisecondsDefaultIfNull
public static long toMillisecondsDefaultIfNull(TimeInterval t, TimeInterval defaultInterval)
-
toSecondsDefaultIfNull
public static long toSecondsDefaultIfNull(TimeInterval t, TimeInterval defaultInterval)
-
toSecondsDefaultIfNull
public static long toSecondsDefaultIfNull(TimeInterval t, long defaultMs)
-
-