Package xbird.xquery.type.xs

Examples of xbird.xquery.type.xs.DateTimeBaseType


            return (T) this;
        }
        final boolean mayCastable = TypeTable.isMayCastable(type, trgType);
        if(mayCastable) {
            if(trgType instanceof DateTimeBaseType) {
                final DateTimeBaseType dtType = (DateTimeBaseType) trgType;
                return (T) dtType.createInstance(value);
            } else {
                final String sv = stringValue();
                final String literal = trgType.processWhitespace(sv);
                try {
                    return (T) trgType.createInstance(literal, type, dynEnv);
View Full Code Here


    }

    @Override
    public String toString() {
        if(_canonical == null) {
            final DateTimeBaseType targetType = getDateTimeType();
            final boolean settime = targetType.isTimeSet();
            if(settime) {
                final int hour = value.getHour();
                if(hour == 24 && value.getMinute() == 0 && value.getSecond() == 0) {
                    // 2004-03-31T24:00:00" => "2004-04-01T00:00:00"
                    value.add(XsDatatypeFactory.getDatatypeFactory().newDuration(true, 0, 0, 0, 0, 0, 1));
                    value.setSecond(0);
                }
            }
            final StringBuilder buf = new StringBuilder(128);
            if(targetType.isDateSet()) {
                final boolean yset = targetType.isYearSet();
                final boolean mset = targetType.isMonthSet();
                final boolean dset = targetType.isDaySet();
                if(yset) {
                    final int year = value.getYear();
                    if(year != DatatypeConstants.FIELD_UNDEFINED) {
                        if(year == 0) {// There is no year 0, and '0000' is not a valid lexical representation
                            appendPaddedZeros(1, 4, buf);
View Full Code Here

TOP

Related Classes of xbird.xquery.type.xs.DateTimeBaseType

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.