Class ClockFactoryImpl
- java.lang.Object
-
- java.util.TimerTask
-
- net.officefloor.frame.impl.execute.clock.ClockFactoryImpl
-
- All Implemented Interfaces:
java.lang.Runnable
,OfficeFloorListener
,ClockFactory
public class ClockFactoryImpl extends java.util.TimerTask implements ClockFactory, OfficeFloorListener
ClockFactory
implementation.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ClockFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Clock<T>
createClock(java.util.function.Function<java.lang.Long,T> translator)
Creates aClock
.protected long
currentTimeSeconds()
Obtains the current time in seconds since Epoch.void
officeFloorClosed(OfficeFloorEvent event)
Notifies that theOfficeFloor
has been closed.void
officeFloorOpened(OfficeFloorEvent event)
Notifies that theOfficeFloor
has been opened.void
run()
-
-
-
Method Detail
-
currentTimeSeconds
protected long currentTimeSeconds()
Obtains the current time in seconds since Epoch.- Returns:
- Current time in seconds since Epoch.
-
createClock
public <T> Clock<T> createClock(java.util.function.Function<java.lang.Long,T> translator)
Description copied from interface:ClockFactory
Creates aClock
.- Specified by:
createClock
in interfaceClockFactory
- Parameters:
translator
- Translate the seconds since Epoch toClock
time.- Returns:
Clock
.
-
officeFloorOpened
public void officeFloorOpened(OfficeFloorEvent event) throws java.lang.Exception
Description copied from interface:OfficeFloorListener
Notifies that theOfficeFloor
has been opened.- Specified by:
officeFloorOpened
in interfaceOfficeFloorListener
- Parameters:
event
-OfficeFloorEvent
.- Throws:
java.lang.Exception
- If fails to handle open listen logic.
-
officeFloorClosed
public void officeFloorClosed(OfficeFloorEvent event) throws java.lang.Exception
Description copied from interface:OfficeFloorListener
Notifies that theOfficeFloor
has been closed.- Specified by:
officeFloorClosed
in interfaceOfficeFloorListener
- Parameters:
event
-OfficeFloorEvent
.- Throws:
java.lang.Exception
- If fails to handle close listen logic.
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Specified by:
run
in classjava.util.TimerTask
-
-