Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.GDate


    protected void set_GDate(GDateSpecification v)
    {
        int code = schemaType().getPrimitiveType().getBuiltinTypeCode();

        GDate candidate;

        if (v.isImmutable() && (v instanceof GDate) && v.getBuiltinTypeCode() == code)
            candidate = (GDate)v;
        else
        {
            // truncate extra fields from the date if necessary.
            if (v.getBuiltinTypeCode() != code)
            {
                GDateBuilder gDateBuilder = new GDateBuilder(v);
                gDateBuilder.setBuiltinTypeCode(code);
                v = gDateBuilder;
            }
            candidate = new GDate(v);
        }

        if (_validateOnSet())
            validateValue(candidate, _schemaType, _voorVc);
View Full Code Here


    {
        int code = schemaType().getPrimitiveType().getBuiltinTypeCode();

        GDateBuilder gDateBuilder = new GDateBuilder(c);
        gDateBuilder.setBuiltinTypeCode(code);
        GDate value = gDateBuilder.toGDate();
        if (_validateOnSet())
            validateValue(value, _schemaType, _voorVc);

        _value = value;
View Full Code Here

            v == null)
            throw new XmlValueOutOfRangeException();

        GDateBuilder gDateBuilder = new GDateBuilder(v);
        gDateBuilder.setBuiltinTypeCode(code);
        GDate value = gDateBuilder.toGDate();
        if (_validateOnSet())
            validateValue(value, _schemaType, _voorVc);

        _value = value;
View Full Code Here

    {
        return Byte.toString(value);
    }
    public String printDateTime(java.util.Calendar value)
    {
        return new GDate(value).toString();

    }
View Full Code Here

        return Integer.toString(value);
    }

    public String printTime(java.util.Calendar value)
    {
        return new GDate(value).toString();
    }
View Full Code Here

        return new GDate(value).toString();
    }

    public String printDate(java.util.Calendar value)
    {
        return new GDate(value).toString();
    }
View Full Code Here

        return value;
    }

    public java.util.Calendar parseDateTime(String s)
    {
        GDate date = JavaGDateHolderEx.lex(s, XmlDateTime.type, _evc);
        return date.getCalendar();
    }
View Full Code Here

        catch (Exception e) { throw new NullPointerException("invalid unsigned short " + s); }
    }

    public java.util.Calendar parseTime(String s)
    {
        GDate date = JavaGDateHolderEx.lex(s, XmlTime.type, _evc);
        return date.getCalendar();
    }
View Full Code Here

        Calendar[] gd = reports.getWhenArray();
        Assert.assertEquals(3, dt.length);
        Assert.assertEquals(3, gd.length);
        for (int i = 0; i < 3; i++)
        {
            Assert.assertEquals(((SimpleValue)dt[i]).gDateValue(), new GDate(gd[i]));
            Assert.assertEquals(gd[i], dt[i].objectValue());
        }

        Assert.assertEquals(new XmlCalendar("2001-08-06T03:34:00"), gd[0]);
        Assert.assertEquals(new XmlCalendar("2002-01-04"), gd[1]);
View Full Code Here

    }
   
    public static void testGregorianCalendar()
    {
        // this is a check of DST offsets
        Date date = new GDate("2002-04-18T23:59:59Z").getDate();
        GregorianCalendar gcal = new XmlCalendar(date);
        Assert.assertEquals(date, gcal.getTime());

        // now check out some things
        GDate gd = new GDate("2001-12-31T07:00:59.010");
        GregorianCalendar gc = gd.getCalendar();
        Date gdd = gd.getDate();
        Date gcd = gc.getTime();
        Assert.assertEquals(gdd, gcd);
       
        // set up 2/29, and read out Feb 29 in the year 1 BC.
        Calendar gregcal = new GDate("--02-29").getCalendar();
        Assert.assertEquals(29, gregcal.get(Calendar.DAY_OF_MONTH));
        Assert.assertEquals(2 - 1, gregcal.get(Calendar.MONTH));
        Assert.assertEquals(1, gregcal.get(Calendar.YEAR));
        Assert.assertEquals(0, gregcal.get(Calendar.ERA));
        // repeat some tests to make sure it's stable.
        Assert.assertEquals(29, gregcal.get(Calendar.DAY_OF_MONTH));
        Assert.assertEquals(2 - 1, gregcal.get(Calendar.MONTH));

        // now try some setters
        gregcal = new GDate("--02-29").getCalendar();
        gregcal.set(Calendar.MONTH, 10);
        Assert.assertEquals("--11-29", gregcal.toString());
        // repeat to ensure it's stable.
        Assert.assertEquals("--11-29", gregcal.toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.GDate

Copyright © 2018 www.massapicom. 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.