Package com.adaptris.util
Class TimeInterval
- java.lang.Object
-
- com.adaptris.util.TimeInterval
-
public class TimeInterval extends java.lang.ObjectClass 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.LonggetInterval()java.util.concurrent.TimeUnitgetUnit()voidsetInterval(java.lang.Long interval)Define the actual interval for this interval.voidsetUnit(java.util.concurrent.TimeUnit unit)Define the unit for this interval.longtoMilliseconds()static longtoMillisecondsDefaultIfNull(TimeInterval t, long defaultMs)static longtoMillisecondsDefaultIfNull(TimeInterval t, TimeInterval defaultInterval)static longtoSecondsDefaultIfNull(TimeInterval t, long defaultMs)static longtoSecondsDefaultIfNull(TimeInterval t, TimeInterval defaultInterval)java.lang.StringtoString()
-
-
-
Method Detail
-
toMilliseconds
public long toMilliseconds()
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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)
-
-