Search in sources :

Example 1 with DateTimeParserBucket

use of org.joda.time.format.DateTimeParserBucket in project whole by wholeplatform.

the class AbstractISO8601DataTypeParser method parseObject.

public Object parseObject(EntityDescriptor<?> ed, String value) {
    DateTimeParser parser = getFormatter().getParser();
    DateTimeParserBucket bucket = new DateTimeParserBucket(0, ISOChronology.getInstance(), null);
    // use a custom UTC to check if offset part is parsed
    if (bucket.getZone() == null)
        bucket.setZone(UTC);
    if (parser.parseInto(bucket, value, 0) < 0)
        throw new WholeIllegalArgumentException(WholeMessages.no_data_type);
    DateTimeZone zone = bucket.getZone();
    if (zone == null)
        return parseWithTimeZone(bucket);
    else
        return parseWithoutTimeZone(bucket);
}
Also used : DateTimeParser(org.joda.time.format.DateTimeParser) DateTimeParserBucket(org.joda.time.format.DateTimeParserBucket) WholeIllegalArgumentException(org.whole.lang.exceptions.WholeIllegalArgumentException) DateTimeZone(org.joda.time.DateTimeZone) FixedDateTimeZone(org.joda.time.tz.FixedDateTimeZone)

Aggregations

DateTimeZone (org.joda.time.DateTimeZone)1 DateTimeParser (org.joda.time.format.DateTimeParser)1 DateTimeParserBucket (org.joda.time.format.DateTimeParserBucket)1 FixedDateTimeZone (org.joda.time.tz.FixedDateTimeZone)1 WholeIllegalArgumentException (org.whole.lang.exceptions.WholeIllegalArgumentException)1