类的用途
javax.xml.datatype.Duration
使用 Duration 的包
-
Duration 在 javax.xml.datatype 中的用法
javax.xml.datatype 中返回 Duration 的方法修饰符和类型方法描述abstract Duration
计算值为this+rhs
的新持续时间。Duration.multiply
(int factor) 计算一个新的持续时间,其值是此持续时间值的factor
倍。abstract Duration
Duration.multiply
(BigDecimal factor) 计算一个新的持续时间,其值是此持续时间值的factor
倍。abstract Duration
Duration.negate()
返回值为-this
的新Duration
对象。DatatypeFactory.newDuration
(boolean isPositive, int years, int months, int days, int hours, int minutes, int seconds) 获取Duration
的新实例,将Duration
指定为 isPositive、年、月、日、小时、分钟、秒。abstract Duration
DatatypeFactory.newDuration
(boolean isPositive, BigInteger years, BigInteger months, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds) 获取Duration
的新实例,将Duration
指定为 isPositive、年、月、日、小时、分钟、秒。abstract Duration
DatatypeFactory.newDuration
(long durationInMilliSeconds) 获取Duration
的新实例,将Duration
指定为毫秒。abstract Duration
DatatypeFactory.newDuration
(String lexicalRepresentation) 获取Duration
的新实例,将Duration
指定为其字符串表示形式“PnYnMnDTnHnMnS”,如 XML Schema 1.0 第 3.2.6.1 节中所定义。DatatypeFactory.newDurationDayTime
(boolean isPositive, int day, int hour, int minute, int second) 使用 XQuery 1.0 和 XPath 2.0 数据模型, xdt:dayTimeDuration 中定义的指定day
、hour
、minute
和second
创建类型为xdt:dayTimeDuration
的Duration
。DatatypeFactory.newDurationDayTime
(boolean isPositive, BigInteger day, BigInteger hour, BigInteger minute, BigInteger second) 使用 XQuery 1.0 和 XPath 2.0 数据模型, xdt:dayTimeDuration 中定义的指定day
、hour
、minute
和second
创建类型为xdt:dayTimeDuration
的Duration
。DatatypeFactory.newDurationDayTime
(long durationInMilliseconds) DatatypeFactory.newDurationDayTime
(String lexicalRepresentation) 通过解析其String
表示、“PnDTnHnMnS”、XQuery 1.0 和 XPath 2.0 数据模型, xdt:dayTimeDuration,创建一个xdt:dayTimeDuration
类型的Duration
。DatatypeFactory.newDurationYearMonth
(boolean isPositive, int year, int month) 使用 XQuery 1.0 和 XPath 2.0 数据模型, xdt:yearMonthDuration 中定义的指定year
和month
创建类型为xdt:yearMonthDuration
的Duration
。DatatypeFactory.newDurationYearMonth
(boolean isPositive, BigInteger year, BigInteger month) 使用 XQuery 1.0 和 XPath 2.0 数据模型, xdt:yearMonthDuration 中定义的指定year
和month
创建类型为xdt:yearMonthDuration
的Duration
。DatatypeFactory.newDurationYearMonth
(long durationInMilliseconds) 使用 XQuery 1.0 和 XPath 2.0 数据模型, xdt:yearMonthDuration 中定义的指定毫秒创建xdt:yearMonthDuration
类型的Duration
。DatatypeFactory.newDurationYearMonth
(String lexicalRepresentation) 通过解析其String
表示,“PnYnM”,XQuery 1.0 和 XPath 2.0 数据模型, xdt:yearMonthDuration 创建一个Duration
类型的xdt:yearMonthDuration
。abstract Duration
Duration.normalizeWith
(Calendar startTimeInstant) 以特定时刻为参考点,将年月字段转换为天字段。计算值为this-rhs
的新持续时间。javax.xml.datatype 中的方法,参数类型为 Duration修饰符和类型方法描述abstract Duration
计算值为this+rhs
的新持续时间。abstract void
将duration
添加到此实例。abstract int
与此Duration
实例的偏序关系比较。boolean
Duration.isLongerThan
(Duration duration) 检查此持续时间对象是否严格长于另一个Duration
对象。boolean
Duration.isShorterThan
(Duration duration) 检查此持续时间对象是否严格短于另一个Duration
对象。计算值为this-rhs
的新持续时间。