Class Clock.TimeSourceClock
- java.lang.Object
-
- javax.time.calendar.Clock
-
- javax.time.calendar.Clock.TimeSourceClock
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDA serialization identifier for this class.private TimeSourcetimeSourceThe time-source being used.private TimeZonezoneThe time-zone being used.
-
Constructor Summary
Constructors Modifier Constructor Description privateTimeSourceClock(TimeSource timeSource, TimeZone zone)Restricted constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)TimeSourcegetSource()Gets the time-source being used to create dates and times.TimeZonegetZone()Gets the time-zone being used to create dates and times.inthashCode()java.lang.StringtoString()ClockwithSource(TimeSource timeSource)Returns a copy of this clock with a different time-source.ClockwithZone(TimeZone zone)Returns a copy of this clock with a different time-zone.-
Methods inherited from class javax.time.calendar.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 Detail
-
serialVersionUID
private static final long serialVersionUID
A serialization identifier for this class.- See Also:
- Constant Field Values
-
timeSource
private final TimeSource timeSource
The time-source being used.
-
zone
private final TimeZone zone
The time-zone being used.
-
-
Constructor Detail
-
TimeSourceClock
private TimeSourceClock(TimeSource timeSource, TimeZone zone)
Restricted constructor.
-
-
Method Detail
-
getSource
public TimeSource 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
public Clock withSource(TimeSource timeSource)
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
public TimeZone 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
public Clock withZone(TimeZone zone)
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
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-