Package javax.xml.datatype

Examples of javax.xml.datatype.DatatypeFactory.newDuration()


   
    public static void main (String [] args) {
        try {
            DatatypeFactory df = DatatypeFactory.newInstance();
            // my work number in milliseconds:
            Duration myPhone = df.newDuration(9054133519l);
            Duration myLife = df.newDuration(true, 29, 2, 15, 13, 45, 0);
            int compareVal = myPhone.compare(myLife);
            switch (compareVal) {
                case DatatypeConstants.LESSER:
                    System.out.println("There are fewer milliseconds in my phone number than my lifespan.");
View Full Code Here


    public static void main (String [] args) {
        try {
            DatatypeFactory df = DatatypeFactory.newInstance();
            // my work number in milliseconds:
            Duration myPhone = df.newDuration(9054133519l);
            Duration myLife = df.newDuration(true, 29, 2, 15, 13, 45, 0);
            int compareVal = myPhone.compare(myLife);
            switch (compareVal) {
                case DatatypeConstants.LESSER:
                    System.out.println("There are fewer milliseconds in my phone number than my lifespan.");
                    break;
View Full Code Here

            }
            BigDecimal seconds = null;
            if ((value = metadata.getSeconds()) != null) {
                seconds = new BigDecimal(value.toString());
            }
            return factory.newDuration(true, years, months, days, hours, minutes, seconds);
        } catch (DatatypeConfigurationException e) {
            warningOccured("getElement", e);
        }
        return null;
    }
View Full Code Here

  public static Duration convertStringToDuration(String duration) throws DispositionReportFaultMessage {
    Duration result = null;
    try {
     
      DatatypeFactory df = DatatypeFactory.newInstance();
      result = df.newDuration(duration);
    }
    catch(DatatypeConfigurationException ce) {
      throw new FatalErrorException(new ErrorMessage("errors.Unspecified"));
    }
View Full Code Here

   
    public static void main (String [] args) {
        try {
            DatatypeFactory df = DatatypeFactory.newInstance();
            // my work number in milliseconds:
            Duration myPhone = df.newDuration(9054133519l);
            Duration myLife = df.newDuration(true, 29, 2, 15, 13, 45, 0);
            int compareVal = myPhone.compare(myLife);
            switch (compareVal) {
                case DatatypeConstants.LESSER:
                    System.out.println("There are fewer milliseconds in my phone number than my lifespan.");
View Full Code Here

    public static void main (String [] args) {
        try {
            DatatypeFactory df = DatatypeFactory.newInstance();
            // my work number in milliseconds:
            Duration myPhone = df.newDuration(9054133519l);
            Duration myLife = df.newDuration(true, 29, 2, 15, 13, 45, 0);
            int compareVal = myPhone.compare(myLife);
            switch (compareVal) {
                case DatatypeConstants.LESSER:
                    System.out.println("There are fewer milliseconds in my phone number than my lifespan.");
                    break;
View Full Code Here

    }

    private void performTestNewDuration(StandardTypesServiceClient serviceClient) throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        Duration[] da = new Duration[3];
        da[0] = df.newDuration(1000000000000L);
        da[1] = df.newDurationDayTime(1000000000000L);
        da[2] = df.newDurationYearMonth(true, 1, 3);

        for (int i = 0; i < da.length; ++i) {
            Assert.assertEquals(da[i].negate(), serviceClient.getNewDurationForward(da[i]));
View Full Code Here

    private void performTestNewDurationArray(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        Duration[] da = new Duration[3];
        da[0] = df.newDuration(1000000000000L);
        da[1] = df.newDurationDayTime(1000000000000L);
        da[2] = df.newDurationYearMonth(true, 1, 3);

        Duration[] actual = serviceClient.getNewDurationArrayForward(da);
        Assert.assertEquals(da.length, actual.length);
View Full Code Here

    }

    private void performTestNewDuration(StandardTypesServiceClient serviceClient) throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        Duration[] da = new Duration[3];
        da[0] = df.newDuration(1000000000000L);
        da[1] = df.newDurationDayTime(1000000000000L);
        da[2] = df.newDurationYearMonth(true, 1, 3);

        for (int i = 0; i < da.length; ++i) {
            Assert.assertEquals(da[i].negate(), serviceClient.getNewDurationForward(da[i]));
View Full Code Here

    private void performTestNewDurationArray(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        Duration[] da = new Duration[3];
        da[0] = df.newDuration(1000000000000L);
        da[1] = df.newDurationDayTime(1000000000000L);
        da[2] = df.newDurationYearMonth(true, 1, 3);

        Duration[] actual = serviceClient.getNewDurationArrayForward(da);
        Assert.assertEquals(da.length, actual.length);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.