Class Clock.TimeSourceClock
- All Implemented Interfaces:
Serializable
- Enclosing class:
Clock
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longA serialization identifier for this class.private final TimeSourceThe time-source being used.private final TimeZoneThe time-zone being used. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTimeSourceClock(TimeSource timeSource, TimeZone zone) Restricted constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the time-source being used to create dates and times.getZone()Gets the time-zone being used to create dates and times.inthashCode()toString()withSource(TimeSource timeSource) Returns a copy of this clock with a different time-source.Returns a copy of this clock with a different time-zone.Methods inherited from class Clock
clock, clockDefaultZone, dateTime, dateTimeToMinute, dateTimeToSecond, instant, offsetDate, offsetDateTime, offsetDateTimeToMinute, offsetDateTimeToSecond, offsetTime, offsetTimeToMinute, offsetTimeToSecond, system, systemDefaultZone, time, timeToMinute, timeToSecond, today, tomorrow, year, yearMonth, yesterday, zonedDateTime, zonedDateTimeToMinute, zonedDateTimeToSecond
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDA serialization identifier for this class.- See Also:
-
timeSource
The time-source being used. -
zone
The time-zone being used.
-
-
Constructor Details
-
TimeSourceClock
Restricted constructor.
-
-
Method Details
-
getSource
Gets the time-source being used to create dates and times.The standard implementation of
Clockuses a time-source to provide the current instant. This method returns that time-source.Non-standard implementations may choose to use another means to obtain instants, dates and times, thus this method is allowed to throw
UnsupportedOperationException. -
withSource
Returns a copy of this clock with a different time-source.The standard implementation of
Clockuses a time-source to provide the current instant. This method allows that time-source to be changed.Non-standard implementations may choose to use another means to obtain instants, dates and times, thus this method is allowed to throw
UnsupportedOperationException.- Overrides:
withSourcein classClock- Parameters:
timeSource- the time-source to change to, not null- Returns:
- the new clock with the altered time-source, never null
-
getZone
Gets the time-zone being used to create dates and times.The standard implementation of
Clockuses a time-zone to interpret the current instant. This method returns that time-zone.Non-standard implementations may choose to use another means to interpret instants, dates and times, thus this method is allowed to throw
UnsupportedOperationException. -
withZone
Returns a copy of this clock with a different time-zone.The standard implementation of
Clockuses a time-zone to interpret the current instant. This method allows that time-zone to be changed.Non-standard implementations may choose to use another means to interpret instants, dates and times, thus this method is allowed to throw
UnsupportedOperationException. -
equals
-
hashCode
-
toString
-