當前位置: 首頁>>代碼示例>>Java>>正文


Java DatatypeFactory類代碼示例

本文整理匯總了Java中javax.xml.datatype.DatatypeFactory的典型用法代碼示例。如果您正苦於以下問題:Java DatatypeFactory類的具體用法?Java DatatypeFactory怎麽用?Java DatatypeFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DatatypeFactory類屬於javax.xml.datatype包,在下文中一共展示了DatatypeFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: preparePeriod

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
private Period preparePeriod(long periodStartTime, long periodEndTime)
        throws DatatypeConfigurationException {

    Period period = new Period();

    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gc = new GregorianCalendar();

    // start date
    period.setStartDate(BigInteger.valueOf(periodStartTime));
    gc.setTimeInMillis(periodStartTime);
    period.setStartDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    // end date
    period.setEndDate(BigInteger.valueOf(periodEndTime));
    gc.setTimeInMillis(periodEndTime);
    period.setEndDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    return period;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:21,代碼來源:ResellerShareResultAssembler.java

示例2: getXMLGregorianCalendarNow

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
private XMLGregorianCalendar getXMLGregorianCalendarNow()
		throws DatatypeConfigurationException {
	GregorianCalendar gregorianCalendar = new GregorianCalendar();
	DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
	XMLGregorianCalendar now = datatypeFactory
			.newXMLGregorianCalendar(gregorianCalendar);
	return now;
}
 
開發者ID:Discovery-Research-Network-SCCM,項目名稱:FHIR-CQL-ODM-service,代碼行數:9,代碼來源:FhirService.java

示例3: newXMLGregorianCalendarSystemTime

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
/**
 * 
 * @return An object of type XMLGregorianCalendar containing the current
 *         system time and date
 * @throws DatatypeConfigurationException
 *             If the instantiation of the DatatypeFactory fails
 */
public static XMLGregorianCalendar newXMLGregorianCalendarSystemTime()
        throws DatatypeConfigurationException {
    GregorianCalendar gregorianCalendar = new GregorianCalendar();
    DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
    XMLGregorianCalendar now = datatypeFactory
            .newXMLGregorianCalendar(gregorianCalendar);
    return now;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:16,代碼來源:GregorianCalendars.java

示例4: setup

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
@BeforeClass
public static void setup() throws Exception {
    SharesDataRetrievalServiceLocal sharesRetrievalService = mock(SharesDataRetrievalServiceLocal.class);
    BillingDataRetrievalServiceLocal billingRetrievalService = mock(BillingDataRetrievalServiceLocal.class);
    brokerShareAssembler = spy(new BrokerShareResultAssembler(
            sharesRetrievalService, billingRetrievalService));

    // create test data
    createBillingResults();

    // mock service methods
    mockGetBrokerData();
    mockGetBrokerRevenueSharePercentage();
    mockGetOrgData(NUMBER_SUPPLIERS);
    mockGetOrgData(NUMBER_CUSTOMER);
    mockGetSupplierKeyForSubscription();
    mockGetProductHistoryData();
    mockGetSubscriptionHistoryData();
    mockGetBillingResults();
    mockXmlSearch();
    datatypeFactory = DatatypeFactory.newInstance();
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:23,代碼來源:BrokerShareResultAssemblerTest.java

示例5: setup

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
@Before
public void setup() throws Exception {
    SharesDataRetrievalServiceLocal sharesRetrievalService = mock(SharesDataRetrievalServiceLocal.class);
    BillingDataRetrievalServiceLocal billingRetrievalService = mock(BillingDataRetrievalServiceLocal.class);
    resellerShareAssembler = spy(new ResellerShareResultAssembler(
            sharesRetrievalService, billingRetrievalService));

    // create test data
    createBillingResults();

    // mock service methods
    mockGetResellerData();
    mockGetResellerRevenueSharePercentage();
    mockGetOrgData(NUMBER_SUPPLIERS);
    mockGetOrgData(NUMBER_CUSTOMER);
    mockGetSupplierKeyForSubscription();
    mockGetProductHistoryData();
    mockGetSubscriptionHistoryData();
    mockGetBillingResults();
    mockXmlSearch();
    datatypeFactory = DatatypeFactory.newInstance();
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:23,代碼來源:ResellerShareResultAssemblerTest.java

示例6: setup

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
@BeforeClass
public static void setup() throws Exception {
    SharesDataRetrievalServiceLocal billingRetrievalService = mock(SharesDataRetrievalServiceLocal.class);
    when(
            billingRetrievalService.loadOrganizationHistoryRoles(anyLong(),
                    anyLong())).thenReturn(
            Arrays.asList(new OrganizationRole(
                    OrganizationRoleType.SUPPLIER)));
    supplierShareAssembler = spy(new SupplierShareResultAssembler(
            billingRetrievalService));

    createBillingResults();

    mockOrganizationData();
    mockOrganizationHistoryRoles();
    mockGetMarketplaceRevenueSharePercentage();
    mockGetOperatorRevenueSharePercentage();
    mockGetSellerRevenueSharePercentage();
    mockGetProductHistoryData();
    mockGetSubscriptionHistoryData();
    mockGetBillingResults();
    mockFindMarketplaceHistory();
    mockGetOrgData(CUSTOMER);
    mockXmlSearch();
    datatypeFactory = DatatypeFactory.newInstance();
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:27,代碼來源:SupplierShareResultAssemblerTest.java

示例7: setPeriod

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
void setPeriod(long periodStartTime, long periodEndTime)
        throws DatatypeConfigurationException {
    this.periodEndTime = periodEndTime;

    Period period = new Period();

    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gc = new GregorianCalendar();

    // start date
    period.setStartDate(BigInteger.valueOf(periodStartTime));
    gc.setTimeInMillis(periodStartTime);
    period.setStartDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    // end date
    period.setEndDate(BigInteger.valueOf(periodEndTime));
    gc.setTimeInMillis(periodEndTime);
    period.setEndDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    result.setPeriod(period);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:22,代碼來源:BrokerShareResultAssembler.java

示例8: setPeriod

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
void setPeriod(long periodStartTime, long periodEndTime)
        throws DatatypeConfigurationException {

    this.periodStartTime = periodStartTime;
    this.periodEndTime = periodEndTime;

    Period period = new Period();

    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gc = new GregorianCalendar();

    // start date
    period.setStartDate(BigInteger.valueOf(periodStartTime));
    gc.setTimeInMillis(periodStartTime);
    period.setStartDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    // end date
    period.setEndDate(BigInteger.valueOf(periodEndTime));
    gc.setTimeInMillis(periodEndTime);
    period.setEndDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    result.setPeriod(period);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:24,代碼來源:MpOwnerShareResultAssembler.java

示例9: preparePeriod

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
private Period preparePeriod(long periodStartTime, long periodEndTime)
        throws DatatypeConfigurationException {

    Period period = new Period();

    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gc = new GregorianCalendar();

    period.setStartDate(BigInteger.valueOf(periodStartTime));
    gc.setTimeInMillis(periodStartTime);
    period.setStartDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    period.setEndDate(BigInteger.valueOf(periodEndTime));
    gc.setTimeInMillis(periodEndTime);
    period.setEndDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    return period;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:19,代碼來源:SupplierShareResultAssembler.java

示例10: toXMLCalendar

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
public XMLGregorianCalendar toXMLCalendar(Date d) throws Exception {  
    GregorianCalendar gc = new GregorianCalendar();  
    gc.setTime(d);  
    XMLGregorianCalendar xml = DatatypeFactory.newInstance()  
            .newXMLGregorianCalendar();  
    xml.setYear(gc.get(Calendar.YEAR));  
    xml.setMonth(gc.get(Calendar.MONTH) + 1);  
    xml.setDay(gc.get(Calendar.DAY_OF_MONTH));  
    xml.setHour(gc.get(Calendar.HOUR_OF_DAY));  
    xml.setMinute(gc.get(Calendar.MINUTE));  
    xml.setSecond(gc.get(Calendar.SECOND));  
    return xml;  
}
 
開發者ID:vindell,項目名稱:docx4j-template,代碼行數:14,代碼來源:Docx4j_創建批注_S3_Test.java

示例11: getDatatypeFactory

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
public static DatatypeFactory getDatatypeFactory() {
    ClassLoader tccl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
        public ClassLoader run() {
            return Thread.currentThread().getContextClassLoader();
        }
    });
    DatatypeFactory df = DF_CACHE.get(tccl);
    if (df == null) {
        synchronized (DatatypeConverterImpl.class) {
            df = DF_CACHE.get(tccl);
            if (df == null) { // to prevent multiple initialization
                try {
                    df = DatatypeFactory.newInstance();
                } catch (DatatypeConfigurationException e) {
                    throw new Error(Messages.FAILED_TO_INITIALE_DATATYPE_FACTORY.format(),e);
                }
                DF_CACHE.put(tccl, df);
            }
        }
    }
    return df;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:DatatypeConverterImpl.java

示例12: vulStuurgegevens

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
private void vulStuurgegevens(final VrijBericht vrijBericht, final VrijBerichtStuurVrijBericht verzoek, final PartijCode zendendePartij)
        throws DatatypeConfigurationException {
    final GroepBerichtStuurgegevens stuurgegevens = objectFactory.createGroepBerichtStuurgegevens();
    stuurgegevens.setCommunicatieID(UUID.randomUUID().toString());
    final SysteemNaam zendendeSysteem = new SysteemNaam();
    final Referentienummer referentieNummer = new Referentienummer();
    final DatumTijd tijdstipVerzending = new DatumTijd();
    zendendeSysteem.setValue("BRP");
    referentieNummer.setValue(UUID.randomUUID().toString());
    final GregorianCalendar c = new GregorianCalendar();
    final XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
    c.setTime(vrijBericht.getTijdstipRegistratie());
    tijdstipVerzending.setValue(xmlDate);
    stuurgegevens.setZendendePartij(objectFactory.createGroepBerichtStuurgegevensZendendePartij(zendendePartij));
    stuurgegevens.setZendendeSysteem(objectFactory.createGroepBerichtStuurgegevensZendendeSysteem(zendendeSysteem));
    stuurgegevens.setReferentienummer(objectFactory.createGroepBerichtStuurgegevensReferentienummer(referentieNummer));
    stuurgegevens.setTijdstipVerzending(objectFactory.createGroepBerichtStuurgegevensTijdstipVerzending(tijdstipVerzending));
    verzoek.setStuurgegevens(objectFactory.createObjecttypeBerichtStuurgegevens(stuurgegevens));
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:20,代碼來源:VrijBerichtClientServiceImpl.java

示例13: test

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
private static void test(int offsetMinutes)
        throws DatatypeConfigurationException {
    XMLGregorianCalendar calendar = DatatypeFactory.newInstance().
            newXMLGregorianCalendar();
    calendar.setTimezone(60 + offsetMinutes);
    TimeZone timeZone = calendar.getTimeZone(DatatypeConstants.FIELD_UNDEFINED);
    String expected = (offsetMinutes < 10 ? "GMT+01:0" : "GMT+01:")
            + offsetMinutes;
    if (!timeZone.getID().equals(expected)) {
        throw new RuntimeException("Test failed: expected timezone: " +
                expected + " Actual: " + timeZone.getID());
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:14,代碼來源:TestXMLGregorianCalendarTimeZone.java

示例14: main

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
/**
 * main method.
 *
 * @param args Standard args.
 */
public static void main(String[] args) {
    try {
        String dateTimeString = "2006-11-22T00:00:00.0+01:02";
        DatatypeFactory dtf = DatatypeFactory.newInstance();
        XMLGregorianCalendar cal = dtf.newXMLGregorianCalendar( dateTimeString );
        System.out.println( "XMLGregCal:" + cal.toString() );
        System.out.println( "GregCal:" + cal.toGregorianCalendar() );
        String toGCal = cal.toGregorianCalendar().toString();
        if (toGCal.indexOf("GMT+12:00") > -1) {
            throw new RuntimeException("Expected GMT+01:02");
        }
    } catch (DatatypeConfigurationException ex) {
        throw new RuntimeException(ex.getMessage());
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:CalendarDuration1243Test.java

示例15: main

import javax.xml.datatype.DatatypeFactory; //導入依賴的package包/類
/**
 * main method.
 *
 * @param args Standard args.
 */
public static void main(String[] args) {
    try {
        String dateTimeString = "0001-01-01T00:00:00.0000000-05:00";
        DatatypeFactory dtf = DatatypeFactory.newInstance();
        XMLGregorianCalendar cal = dtf.newXMLGregorianCalendar( dateTimeString );
        System.out.println( "Expected: 0001-01-01T00:00:00.0000000-05:00");
        System.out.println( "Actual:" + cal.toString() );
        System.out.println( "toXMLFormat:" + cal.toXMLFormat() );
        String test = cal.toString();
        if (test.indexOf("E-7") > -1) {
            throw new RuntimeException("Expected: 0001-01-01T00:00:00.0000000-05:00");
        }
    } catch (DatatypeConfigurationException ex) {
        throw new RuntimeException(ex.getMessage());
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:CalendarDuration1097Test.java


注:本文中的javax.xml.datatype.DatatypeFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。