C - generic type of date componentpublic final class GeneralTimestamp<C> extends Object implements ChronoDisplay
Represents a general timestamp consisting of a general date and a 24-hour-clock time.
Note: This class is only relevant for non-gregorian use-cases. Most users will use PlainTimestamp
instead.
| Modifier and Type | Method and Description |
|---|---|
Moment |
at(ZonalOffset offset,
StartOfDay startOfDay)
Combines this general timestamp with given timezone offset to a global UTC-moment.
|
boolean |
contains(ChronoElement<?> element)
Queries if the value for given chronological element can be
accessed via
get(element). |
boolean |
equals(Object obj) |
<V> V |
get(ChronoElement<V> element)
Returns the partial value associated with given chronological
element.
|
int |
getInt(ChronoElement<Integer> element)
Returns the partial value associated with given chronological element.
|
<V> V |
getMaximum(ChronoElement<V> element)
Yields the maximum value of given chronological element in the
current context of this object.
|
<V> V |
getMinimum(ChronoElement<V> element)
Yields the minimum value of given chronological element in the
current context of this object.
|
TZID |
getTimezone()
Returns the associated timezone ID for display purposes
if available.
|
int |
hashCode() |
boolean |
hasTimezone()
Queries if this object contains a timezone for display purposes.
|
Moment |
in(Timezone tz,
StartOfDay startOfDay)
Combines this general timestamp with given timezone to a global UTC-moment.
|
static <C extends CalendarVariant<C>> |
of(C calendarVariant,
PlainTime time)
Creates a new timestamp consisting of a calendar variant and a time component.
|
static <C extends Calendrical<?,C>> |
of(C calendrical,
PlainTime time)
Creates a new timestamp consisting of a general date and a time component.
|
C |
toDate()
Yields the date component.
|
String |
toString() |
PlainTime |
toTime()
Yields the time component.
|
public static <C extends CalendarVariant<C>> GeneralTimestamp<C> of(C calendarVariant, PlainTime time)
Creates a new timestamp consisting of a calendar variant and a time component.
C - generic type of date componentcalendarVariant - date componenttime - time componentpublic static <C extends Calendrical<?,C>> GeneralTimestamp<C> of(C calendrical, PlainTime time)
Creates a new timestamp consisting of a general date and a time component.
C - generic type of date componentcalendrical - date componenttime - time componentpublic C toDate()
Yields the date component.
public PlainTime toTime()
Yields the time component.
public Moment at(ZonalOffset offset, StartOfDay startOfDay)
Combines this general timestamp with given timezone offset to a global UTC-moment.
offset - timezone offsetstartOfDay - start of daypublic Moment in(Timezone tz, StartOfDay startOfDay)
Combines this general timestamp with given timezone to a global UTC-moment.
tz - timezonestartOfDay - start of daypublic boolean contains(ChronoElement<?> element)
ChronoDisplayQueries if the value for given chronological element can be
accessed via get(element).
If the argument is missing then this method will yield false.
Note: Elements which are not registered but define a suitable rule
are also accessible.
contains in interface ChronoDisplayelement - chronological element to be asked (optional)true if the element is registered or there is an element rule for evaluating the value
else falseChronoDisplay.get(ChronoElement)public <V> V get(ChronoElement<V> element)
ChronoDisplayReturns the partial value associated with given chronological element.
get in interface ChronoDisplayV - generic type of element valueelement - element which has the valuenull)ChronoDisplay.contains(ChronoElement)public int getInt(ChronoElement<Integer> element)
ChronoDisplayReturns the partial value associated with given chronological element.
getInt in interface ChronoDisplayelement - element which has the valueInteger.MIN_VALUE if not availableChronoDisplay.get(ChronoElement)public <V> V getMinimum(ChronoElement<V> element)
ChronoDisplayYields the minimum value of given chronological element in the current context of this object.
The definition of a minimum and a maximum does generally not imply that every intermediate value between minimum and maximum is valid in this context. For example in the timezone Europe/Berlin the hour [T02:00] will be invalid if switching to summer time.
In most cases the minimum value is not dependent on this context.
getMinimum in interface ChronoDisplayV - generic type of element valueelement - element whose minimum value is to be evaluatedChronoElement.getDefaultMinimum(),
ChronoDisplay.getMaximum(ChronoElement)public <V> V getMaximum(ChronoElement<V> element)
ChronoDisplayYields the maximum value of given chronological element in the current context of this object.
Maximum values are different from minimum case often dependent
on the context. An example is the element SECOND_OF_MINUTE whose
maximum is normally 59 but can differ in UTC-context with
leap seconds. Another more common example is the maximum of the
element DAY_OF_MONTH (28-31) which is dependent on the month and year
of this context (leap years!).
Note: In timezone-related timestamps possible offset jumps inducing gaps on the local timeline will be conserved. That means that minimum and maximum do not guarantee a continuum of valid intermediate values.
getMaximum in interface ChronoDisplayV - generic type of element valueelement - element whose maximum value is to be evaluatedChronoElement.getDefaultMaximum(),
ChronoDisplay.getMinimum(ChronoElement)public boolean hasTimezone()
ChronoDisplayQueries if this object contains a timezone for display purposes.
hasTimezone in interface ChronoDisplaytrue if a timezone is available and can be achieved
with ChronoDisplay.getTimezone() else falsepublic TZID getTimezone()
ChronoDisplayReturns the associated timezone ID for display purposes if available.
Note: Although global types like Moment indeed have a
timezone reference (namely UTC+00:00), such types will not support
formatted output without explicitly giving a timezone for display
purposes. Therefore calling this method on global types will throw
an exception. This method is not just about any timezone reference
but a timezone designed for display purposes.
getTimezone in interface ChronoDisplayChronoDisplay.hasTimezone()Copyright © 2014–2017. All rights reserved.