Package org.goda.time

Examples of org.goda.time.IllegalFieldValueException


                    if (instant + iGapDuration < iCutover) {
                        instant = gregorianToJulian(instant);
                    }
                    // Verify that new value stuck.
                    if (get(instant) != value) {
                        throw new IllegalFieldValueException
                            (iGregorianField.getType(), new Integer(value), null, null);
                    }
                }
            } else {
                instant = iJulianField.set(instant, value);
                if (instant >= iCutover) {
                    // Only adjust if gap fully crossed.
                    if (instant - iGapDuration >= iCutover) {
                        instant = julianToGregorian(instant);
                    }
                    // Verify that new value stuck.
                    if (get(instant) != value) {
                       throw new IllegalFieldValueException
                            (iJulianField.getType(), new Integer(value), null, null);
                    }
                }
            }
            return instant;
View Full Code Here


    }

    static int adjustYearForSet(int year) {
        if (year <= 0) {
            if (year == 0) {
                throw new IllegalFieldValueException
                    (DateTimeFieldType.year(), new Integer(year), null, null);
            }
            year++;
        }
        return year;
View Full Code Here

        public long set(long instant, int value) {
            long localInstant = iZone.convertUTCToLocal(instant);
            localInstant = iField.set(localInstant, value);
            long result = iZone.convertLocalToUTC(localInstant, false);
            if (get(result) != value) {
                throw new IllegalFieldValueException(iField.getType(), new Integer(value),
                    "Illegal instant due to time zone offset transition: " +
                    DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS").print(new Instant(localInstant)) +
                    " (" + iZone.getID() + ")");
            }
            return result;
View Full Code Here

    public int eraTextToValue(String text) {
        Integer era = (Integer) iParseEras.get(text);
        if (era != null) {
            return era.intValue();
        }
        throw new IllegalFieldValueException(DateTimeFieldType.era(), text);
    }
View Full Code Here

    public int monthOfYearTextToValue(String text) {
        Integer month = (Integer) iParseMonths.get(text);
        if (month != null) {
            return month.intValue();
        }
        throw new IllegalFieldValueException(DateTimeFieldType.monthOfYear(), text);
    }
View Full Code Here

    public int dayOfWeekTextToValue(String text) {
        Integer day = (Integer) iParseDaysOfWeek.get(text);
        if (day != null) {
            return day.intValue();
        }
        throw new IllegalFieldValueException(DateTimeFieldType.dayOfWeek(), text);
    }
View Full Code Here

        for (int i = halfday.length; --i>=0; ) {
            if (halfday[i].equalsIgnoreCase(text)) {
                return i;
            }
        }
        throw new IllegalFieldValueException(DateTimeFieldType.halfdayOfDay(), text);
    }
View Full Code Here

    }

    /** @inheritDoc */
    public long set(long instant, String text, Locale locale) {
        if (iEraText.equals(text) == false && "1".equals(text) == false) {
            throw new IllegalFieldValueException(DateTimeFieldType.era(), text);
        }
        return instant;
    }
View Full Code Here

    public int eraTextToValue(String text) {
        Integer era = (Integer) iParseEras.get(text);
        if (era != null) {
            return era.intValue();
        }
        throw new IllegalFieldValueException(DateTimeFieldType.era(), text);
    }
View Full Code Here

    public int monthOfYearTextToValue(String text) {
        Integer month = (Integer) iParseMonths.get(text);
        if (month != null) {
            return month.intValue();
        }
        throw new IllegalFieldValueException(DateTimeFieldType.monthOfYear(), text);
    }
View Full Code Here

TOP

Related Classes of org.goda.time.IllegalFieldValueException

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.