当前位置: 首页>>代码示例>>Java>>正文


Java DatatypeFactory.newDurationDayTime方法代码示例

本文整理汇总了Java中javax.xml.datatype.DatatypeFactory.newDurationDayTime方法的典型用法代码示例。如果您正苦于以下问题:Java DatatypeFactory.newDurationDayTime方法的具体用法?Java DatatypeFactory.newDurationDayTime怎么用?Java DatatypeFactory.newDurationDayTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.datatype.DatatypeFactory的用法示例。


在下文中一共展示了DatatypeFactory.newDurationDayTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNewDurationDayTimeLexicalRepresentation

import javax.xml.datatype.DatatypeFactory; //导入方法依赖的package包/类
@Test
public void testNewDurationDayTimeLexicalRepresentation() throws DatatypeConfigurationException {
    DatatypeFactory dtf = DatatypeFactory.newInstance();
    Duration d = dtf.newDurationDayTime("P1DT23H59M65S");
    int days = d.getDays();
    Assert.assertTrue(days == 2, "Return value should be normalized");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Bug6937964Test.java

示例2: testNewDurationDayTimeMilliseconds

import javax.xml.datatype.DatatypeFactory; //导入方法依赖的package包/类
@Test
public void testNewDurationDayTimeMilliseconds() throws DatatypeConfigurationException {
    DatatypeFactory dtf = DatatypeFactory.newInstance();
    Duration d = dtf.newDurationDayTime(172805000L);
    int days = d.getDays();
    Assert.assertTrue(days == 2, "Return value should be normalized");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Bug6937964Test.java

示例3: testNewDurationDayTimeBigInteger

import javax.xml.datatype.DatatypeFactory; //导入方法依赖的package包/类
@Test
public void testNewDurationDayTimeBigInteger() throws DatatypeConfigurationException {
    DatatypeFactory dtf = DatatypeFactory.newInstance();
    BigInteger day = new BigInteger("1");
    BigInteger hour = new BigInteger("23");
    BigInteger min = new BigInteger("59");
    BigInteger sec = new BigInteger("65");
    Duration d = dtf.newDurationDayTime(true, day, hour, min, sec);
    int days = d.getDays();
    System.out.println("Days: " + days);
    Assert.assertTrue(days == 2, "Return value should be normalized");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Bug6937964Test.java

示例4: testNewDurationDayTimeInt

import javax.xml.datatype.DatatypeFactory; //导入方法依赖的package包/类
@Test
public void testNewDurationDayTimeInt() throws DatatypeConfigurationException {
    DatatypeFactory dtf = DatatypeFactory.newInstance();
    Duration d = dtf.newDurationDayTime(true, 1, 23, 59, 65);
    int days = d.getDays();
    System.out.println("Days: " + days);
    Assert.assertTrue(days == 2, "Return value should be normalized");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Bug6937964Test.java

示例5: newDurationDayTimeTester

import javax.xml.datatype.DatatypeFactory; //导入方法依赖的package包/类
private void newDurationDayTimeTester(boolean isPositive, boolean normalizedIsPositive, BigInteger years, BigInteger normalizedYears, BigInteger months,
        BigInteger normalizedMonths, BigInteger days, BigInteger normalizedDays, BigInteger hours, BigInteger normalizedHours, BigInteger minutes,
        BigInteger normalizedMinutes, BigDecimal seconds, BigDecimal normalizedSeconds, long durationInMilliSeconds, long normalizedDurationInMilliSeconds,
        String lexicalRepresentation, String normalizedLexicalRepresentation) {

    DatatypeFactory datatypeFactory = null;
    try {
        datatypeFactory = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException ex) {
        ex.printStackTrace();
        Assert.fail(ex.toString());
    }

    // create 4 dayTime Durations using the 4 different constructors

    Duration durationDayTimeBigInteger = datatypeFactory.newDurationDayTime(isPositive, days, hours, minutes, seconds.toBigInteger());
    durationAssertEquals(durationDayTimeBigInteger, DatatypeConstants.DURATION_DAYTIME, normalizedIsPositive, normalizedYears.intValue(),
            normalizedMonths.intValue(), normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
            normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);

    /*
     * Duration durationDayTimeInt = datatypeFactory.newDurationDayTime(
     * isPositive, days.intValue(), hours.intValue(), minutes.intValue(),
     * seconds.intValue()); Duration durationDayTimeMilliseconds =
     * datatypeFactory.newDurationDayTime( durationInMilliSeconds); Duration
     * durationDayTimeLexical = datatypeFactory.newDurationDayTime(
     * lexicalRepresentation);
     * Duration durationYearMonthBigInteger =
     * datatypeFactory.newDurationYearMonth( isPositive, years, months);
     * Duration durationYearMonthInt = datatypeFactory.newDurationYearMonth(
     * isPositive, years.intValue(), months.intValue()); Duration
     * durationYearMonthMilliseconds = datatypeFactory.newDurationYearMonth(
     * durationInMilliSeconds); Duration durationYearMonthLexical =
     * datatypeFactory.newDurationYearMonth( lexicalRepresentation) ;
     */

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:DurationTest.java

示例6: getShippingDuration

import javax.xml.datatype.DatatypeFactory; //导入方法依赖的package包/类
private Duration getShippingDuration() throws DatatypeConfigurationException {
    DatatypeFactory factory = DatatypeFactory.newInstance();
    return factory.newDurationDayTime(true, 1, 0, 0, 0); // in one day
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:5,代码来源:DhlShippingCalculationMethod.java


注:本文中的javax.xml.datatype.DatatypeFactory.newDurationDayTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。