Module dev.metaschema.core
Interface IYearMonthDurationItem
- All Superinterfaces:
IAnyAtomicItem,IAtomicValuedItem,ICollectionValue,IDurationItem,IItem
An atomic Metapath item containing a duration data value in years, months,
and days.
-
Method Summary
Modifier and TypeMethodDescriptionasPeriod()Get the "wrapped" duration value.default longGet the total quantity of months this duration represents.static IYearMonthDurationItemcast(IAnyAtomicItem item) Cast the provided type to this item type.default IYearMonthDurationItemcastAsType(IAnyAtomicItem item) Cast the provideditemto be the same type as this item.default intCompares this value with the argument.default IAtomicOrUnionType<IYearMonthDurationItem>getType()Get the type information for the item.default IYearMonthDurationItemnegate()Returns a new instance with each amount in this period negated.type()Get the type information for this item.static IYearMonthDurationItemvalueOf(int years, int months) Construct a new year month day duration item using the provided values.static IYearMonthDurationItemConstruct a new year month day duration item using the provided stringvalue.static IYearMonthDurationItemConstruct a new year month day duration item using the providedvalue.Methods inherited from interface dev.metaschema.core.metapath.item.atomic.IAnyAtomicItem
accept, asMapKey, asString, asStringItem, atomize, deepEquals, getJavaTypeAdapter, toAtomicItemMethods inherited from interface dev.metaschema.core.metapath.item.ICollectionValue
deepEquals, toSignatureMethods inherited from interface dev.metaschema.core.metapath.item.atomic.IDurationItem
compareTo, getValueMethods inherited from interface dev.metaschema.core.metapath.item.IItem
contentsAsSequence, flatten, hasValue, toSequence
-
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 year month day duration item using the provided stringvalue.- Parameters:
value- a string representing a year month day duration- Returns:
- the new item
- Throws:
InvalidTypeMetapathException- if the provided string value is not a day/time duration value according to ISO 8601
-
valueOf
Construct a new year month day duration item using the providedvalue.- Parameters:
value- a duration- Returns:
- the new item
-
valueOf
Construct a new year month day duration item using the provided values.- Parameters:
years- the number of years in the periodmonths- the number of months in the period- Returns:
- the new item
-
asPeriod
Get the "wrapped" duration value.- Returns:
- the underlying duration value
-
asTotalMonths
default long asTotalMonths()Get the total quantity of months this duration represents.- Returns:
- the total months
-
negate
Returns a new instance with each amount in this period negated.- Returns:
- the new negated instance
-
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- Specified by:
castAsTypein interfaceIDurationItem- Parameters:
item- the item to cast- Returns:
- an atomic item of this type
-
compareTo
Compares this value with the argument.- Parameters:
item- the item to compare with this value- Returns:
- a negative integer, zero, or a positive integer if this value is less
than, equal to, or greater than the
item.
-