Class DefaultTimeService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.servicelayer.time.impl.DefaultTimeService
-
- All Implemented Interfaces:
TimeService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultTimeService extends AbstractBusinessService implements TimeService
Default implementation ofTimeService- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultTimeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.DategetCurrentDateWithTimeNormalized()Returns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date)with time part normalized to 0.java.util.DategetCurrentTime()Returns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date).longgetTimeOffset()Returns the time offset in milliseconds, which is the time difference between the system time whenTimeService.setCurrentTime(Date)is called and the argument passed to theTimeService.setCurrentTime(Date)voidresetTimeOffset()Reset the time back to system time.voidsetCurrentTime(java.util.Date instant)Set the current time to the specified time instant.voidsetI18nService(I18NService i18nService)voidsetTimeOffset(long timeOffsetMillis)Set the time offset in milliseconds.-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
setCurrentTime
public void setCurrentTime(java.util.Date instant)
Description copied from interface:TimeServiceSet the current time to the specified time instant.- Specified by:
setCurrentTimein interfaceTimeService
-
getCurrentTime
public java.util.Date getCurrentTime()
Description copied from interface:TimeServiceReturns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date). IfTimeService.setCurrentTime(Date)was never called earlier, then current system time is returned.- Specified by:
getCurrentTimein interfaceTimeService
-
getCurrentDateWithTimeNormalized
public java.util.Date getCurrentDateWithTimeNormalized()
Description copied from interface:TimeServiceReturns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date)with time part normalized to 0. IfTimeService.setCurrentTime(Date)was never called earlier, then current system time is returned.- Specified by:
getCurrentDateWithTimeNormalizedin interfaceTimeService
-
getTimeOffset
public long getTimeOffset()
Description copied from interface:TimeServiceReturns the time offset in milliseconds, which is the time difference between the system time whenTimeService.setCurrentTime(Date)is called and the argument passed to theTimeService.setCurrentTime(Date)- Specified by:
getTimeOffsetin interfaceTimeService
-
resetTimeOffset
public void resetTimeOffset()
Description copied from interface:TimeServiceReset the time back to system time. CallingTimeService.getTimeOffset()after calling this method will get a value of 0. This is equivalent to callingTimeService.setTimeOffset(long)with a zero value argument.- Specified by:
resetTimeOffsetin interfaceTimeService
-
setTimeOffset
public void setTimeOffset(long timeOffsetMillis)
Description copied from interface:TimeServiceSet the time offset in milliseconds. Subsequent call toTimeService.getCurrentTime()will return the system time plus the offset.- Specified by:
setTimeOffsetin interfaceTimeService- Parameters:
timeOffsetMillis- time offset in milliseconds. Use a negative value to adjust time backwards.
-
setI18nService
public void setI18nService(I18NService i18nService)
-
-