當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。