- All Superinterfaces:
IAnyAtomicItem,IAtomicValuedItem,ICalendarTemporalItem,ICollectionValue,IItem,ITemporalItem
- All Known Subinterfaces:
IDateTimeWithTimeZoneItem
This interface provides functionality for handling date/time values with and
without time zone information, supporting parsing, casting, and comparison
operations. It works in conjunction with AmbiguousDateTime to
properly handle time zone ambiguity.
-
Method Summary
Modifier and TypeMethodDescriptiondefault IDateItemasDate()Get the date/time as a date item.default IDateTimeItemGet this date/time in the UTC timezone.default LocalDateGet the date as aLocalDate.default LocalDateTimeGet the date as aLocalDate.default LocalTimeGet the date/time as aLocalTime.default OffsetTimeGet the date/time as anOffsetTime.default ITimeItemasTime()Get the date/time as a time item.static IDateTimeItemcast(IAnyAtomicItem item) Cast the provided type to this item type.default IDateTimeItemcastAsType(IAnyAtomicItem item) Cast the provideditemto be the same type as this item.default intgetDay()Get the day value of this temporal.default intgetHour()Get the hour value of this temporal.default intGet the minute value of this temporal.default intgetMonth()Get the month value of this temporal.default intgetNano()Get the partial nano second value of this temporal.default intGet the whole second value of this temporal.default IAtomicOrUnionType<? extends IDateTimeItem>getType()Get the type information for the item.default intgetYear()Get the year value of this temporal.default booleanhasDate()Determine if the temporal has date information.default booleanhasTime()Determine if the temporal has time information.default IDateTimeItemnormalize(DynamicContext dynamicContext) Get a date/time that has an explicit timezone.default IDateTimeItemreplaceTimezone(IDayTimeDurationItem offset) Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all.static IAtomicOrUnionType<IDateTimeItem>type()Get the type information for this item.static IDateTimeItemvalueOf(AmbiguousDateTime value) Construct a new date/time item using the providedvalue.static IDateTimeItemvalueOf(ICalendarTemporalItem item) Get the provided item as a date/time item.static IDateTimeItemGet a date/time item based on the provided date and time item values.static IDateTimeItemConstruct a new date/time item using the provided stringvalue.static IDateTimeItemvalueOf(LocalDateTime value) Construct a new date/time item using the provided local timevalue.static IDateTimeItemvalueOf(ZonedDateTime value, boolean hasTimeZone) Construct a new date/time item using the providedvalue.Methods inherited from interface dev.metaschema.core.metapath.item.atomic.IAnyAtomicItem
accept, asMapKey, asString, asStringItem, atomize, deepEquals, getJavaTypeAdapter, getValue, toAtomicItemMethods inherited from interface dev.metaschema.core.metapath.item.atomic.ICalendarTemporalItem
asZonedDateTime, getZoneOffsetMethods inherited from interface dev.metaschema.core.metapath.item.ICollectionValue
deepEquals, toSignatureMethods inherited from interface dev.metaschema.core.metapath.item.IItem
contentsAsSequence, flatten, hasValue, toSequenceMethods inherited from interface dev.metaschema.core.metapath.item.atomic.ITemporalItem
getOffset, hasTimezone
-
Method Details
-
type
Get the type information for this item.- Returns:
- the type information
-
getType
Description copied from interface:IItemGet the type information for the item. -
valueOf
Construct a new date/time item using the provided stringvalue.- Parameters:
value- a string representing a date/time- Returns:
- the new item
-
valueOf
Get a date/time item based on the provided date and time item values.- Parameters:
date- the date portion of the date/timetime- the time portion of the date/time- Returns:
- the date/time item
-
valueOf
Get the provided item as a date/time item.- Parameters:
item- the item to convert to a date/time- Returns:
- the provided value as a date/time
-
valueOf
Construct a new date/time item using the providedvalue.This method handles recording if an explicit timezone was provided using the
hasTimeZoneparameter. TheAbstractAmbiguousTemporal.hasTimeZone()method can be called to determine if timezone information is present.- Parameters:
value- a date/time, without time zone informationhasTimeZone-trueif the date/time is intended to have an associated time zone orfalseotherwise- Returns:
- the new item
- See Also:
-
valueOf
Construct a new date/time item using the provided local timevalue.The timezone is marked as ambiguous, meaning the
AbstractAmbiguousTemporal.hasTimeZone()method will return a result offalse.- Parameters:
value- the local time value to use- Returns:
- the new item
- See Also:
-
valueOf
Construct a new date/time item using the providedvalue.This method handles recording if an explicit timezone was provided using the
AmbiguousDateTime. TheAbstractAmbiguousTemporal.hasTimeZone()method can be called to determine if timezone information is present.- Parameters:
value- a date/time, without time zone information- Returns:
- the new item
- See Also:
-
hasDate
default boolean hasDate()Description copied from interface:ITemporalItemDetermine if the temporal has date information.- Specified by:
hasDatein interfaceITemporalItem- Returns:
trueif the temporal item has date information orfalseotherwise
-
hasTime
default boolean hasTime()Description copied from interface:ITemporalItemDetermine if the temporal has time information.- Specified by:
hasTimein interfaceITemporalItem- Returns:
trueif the temporal item has time information orfalseotherwise
-
getYear
default int getYear()Description copied from interface:ITemporalItemGet the year value of this temporal.- Specified by:
getYearin interfaceITemporalItem- Returns:
- the year value
-
getMonth
default int getMonth()Description copied from interface:ITemporalItemGet the month value of this temporal.- Specified by:
getMonthin interfaceITemporalItem- Returns:
- the month value
-
getDay
default int getDay()Description copied from interface:ITemporalItemGet the day value of this temporal.- Specified by:
getDayin interfaceITemporalItem- Returns:
- the day value
-
getHour
default int getHour()Description copied from interface:ITemporalItemGet the hour value of this temporal.- Specified by:
getHourin interfaceITemporalItem- Returns:
- the hour value
-
getMinute
default int getMinute()Description copied from interface:ITemporalItemGet the minute value of this temporal.- Specified by:
getMinutein interfaceITemporalItem- Returns:
- the minute value
-
getSecond
default int getSecond()Description copied from interface:ITemporalItemGet the whole second value of this temporal.- Specified by:
getSecondin interfaceITemporalItem- Returns:
- the whole second value
-
getNano
default int getNano()Description copied from interface:ITemporalItemGet the partial nano second value of this temporal.- Specified by:
getNanoin interfaceITemporalItem- Returns:
- the partial nano second value
-
asLocalDateTime
Get the date as aLocalDate.- Returns:
- the date
-
asLocalDate
Get the date as aLocalDate.- Returns:
- the date
-
asLocalTime
Get the date/time as aLocalTime.- Returns:
- the time
-
asOffsetTime
Get the date/time as anOffsetTime.- Returns:
- the time
-
asDate
Get the date/time as a date item.- Returns:
- the date portion of this date/time
-
asTime
Get the date/time as a time item.- Returns:
- the time portion of this date/time
-
normalize
Get a date/time that has an explicit timezone.If this date/time has a timezone, then this timezone is used. Otherwise, the implicit timezone is used from the dynamic context to create a new date/time.
- Parameters:
dynamicContext- the dynamic context used to get the implicit timezone- Returns:
- the date/time with the timezone normalized using UTC-based timezone
-
asDateTimeZ
Get this date/time in the UTC timezone.- Returns:
- the date/time in UTC
-
replaceTimezone
Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all.This method does one of the following things based on the arguments.
- If the provided offset is
nulland the provided date/time value has a timezone, the timezone is maked absent. - If the provided offset is
nulland the provided date/time value has an absent timezone, the date/time value is returned. - If the provided offset is not
nulland the provided date/time value has an absent timezone, the date/time value is returned with the new timezone applied. - Otherwise, the provided timezone is applied to the date/time value adjusting the time instant.
Implements the XPath 3.1 fn:adjust-dateTime-to-timezone function.
- Specified by:
replaceTimezonein interfaceITemporalItem- Parameters:
offset- the timezone offset to use ornull- Returns:
- the adjusted date/time value
- Throws:
DateTimeFunctionException- with codeDateTimeFunctionException.INVALID_TIME_ZONE_VALUE_ERRORif the offset is < -PT14H or > PT14H
- If the provided offset is
-
cast
Cast the provided type to this item type.- Parameters:
item- the item to cast- Returns:
- the original item if it is already this type, otherwise a new item cast to this type
- Throws:
InvalidValueForCastFunctionException- if the provideditemcannot be cast to this type
-
castAsType
Description copied from interface:IAnyAtomicItemCast the provideditemto be the same type as this item.- Specified by:
castAsTypein interfaceIAnyAtomicItem- Parameters:
item- the item to cast- Returns:
- an atomic item of this type
-