Class TimeProviderBase
- java.lang.Object
-
- com.sportradar.livedata.sdk.common.timer.TimeProviderBase
-
- Direct Known Subclasses:
RealTimeTimeProvider
,TimeProvider
public abstract class TimeProviderBase extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static TimeProviderBase
current
Currently usedTimeProviderBase
instance.
-
Constructor Summary
Constructors Constructor Description TimeProviderBase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TimeProviderBase
getCurrent()
Gets the currently usedTimeProviderBase
instance.org.joda.time.DateTime
getCurrentTime()
abstract Date
getDate()
When overridden in derived class, gets theDate
specifying the current date and time.abstract org.joda.time.DateTime
getDateTime()
When overridden in derived class, gets theDateTime
specifying the current date and time.Date
getFutureDate(long millis)
Adds millis to current datestatic void
resetToRealTime()
Sets the currently usedTimeProviderBase
to default one which uses system time.static void
setCurrent(TimeProviderBase provider)
Sets the currently usedTimeProviderBase
instance.
-
-
-
Field Detail
-
current
protected static TimeProviderBase current
Currently usedTimeProviderBase
instance.
-
-
Method Detail
-
getCurrent
public static TimeProviderBase getCurrent()
Gets the currently usedTimeProviderBase
instance.- Returns:
- The currently used
TimeProviderBase
instance.
-
getDateTime
public abstract org.joda.time.DateTime getDateTime()
When overridden in derived class, gets theDateTime
specifying the current date and time.- Returns:
- the
DateTime
specifying the current date and time.
-
getCurrentTime
public org.joda.time.DateTime getCurrentTime()
-
getDate
public abstract Date getDate()
When overridden in derived class, gets theDate
specifying the current date and time.- Returns:
- The
Date
specifying the current date and time.
-
setCurrent
public static void setCurrent(TimeProviderBase provider)
Sets the currently usedTimeProviderBase
instance.- Parameters:
provider
- TheTimeProviderBase
to be used.- Throws:
IllegalArgumentException
- Theprovider
is a null reference.
-
resetToRealTime
public static void resetToRealTime()
Sets the currently usedTimeProviderBase
to default one which uses system time.
-
-