- All Superinterfaces:
IAnyAtomicItem,IAtomicValuedItem,ICollectionValue,IItem,ITemporalItem
- All Known Subinterfaces:
ITimeWithTimeZoneItem
This interface provides functionality for handling time values with and
without time zone information, supporting parsing, casting, and comparison
operations. It works in conjunction with AmbiguousTime to properly
handle time zone ambiguity.
-
Method Summary
Modifier and TypeMethodDescriptiondefault LocalTimeGet the time as aLocalTime.Get the underlying time value.static ITimeItemcast(IAnyAtomicItem item) Cast the provided type to this item type.default ITimeItemcastAsType(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 ITimeItem>getType()Get the type information for the item.default intgetYear()Get the year value of this temporal.default ZoneOffsetGet the timezone offset for this temporal.default booleanhasDate()Determine if the temporal has date information.default booleanhasTime()Determine if the temporal has time information.booleanDetermine if the temporal item has a timezone.default ITimeItemreplaceTimezone(IDayTimeDurationItem offset) Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all.static IAtomicOrUnionType<ITimeItem>type()Get the type information for this item.static ITimeItemvalueOf(AmbiguousTime value) Construct a new time item using the providedvalue.static ITimeItemConstruct a new date/time item using the provided stringvalue.static ITimeItemvalueOf(OffsetTime value, boolean hasTimeZone) Construct a new 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.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
-
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 time- Returns:
- the new item
-
valueOf
Construct a new 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 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 time item using the providedvalue.This method handles recording if an explicit timezone was provided using the
AmbiguousTime. TheAbstractAmbiguousTemporal.hasTimeZone()method can be called to determine if timezone information is present.- Parameters:
value- a 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
-
hasTimezone
boolean hasTimezone()Description copied from interface:ITemporalItemDetermine if the temporal item has a timezone.- Specified by:
hasTimezonein interfaceITemporalItem- Returns:
trueif the temporal item has a timezone 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
-
getZoneOffset
Description copied from interface:ITemporalItemGet the timezone offset for this temporal.- Specified by:
getZoneOffsetin interfaceITemporalItem- Returns:
- the timezone offset if specified or
nullif the timezone is not known - See Also:
-
asOffsetTime
Get the underlying time value.- Returns:
- the time value
-
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
-
asLocalTime
Get the time as aLocalTime.- Returns:
- the date
-