List of usage examples for org.joda.time.format DateTimeParserBucket DateTimeParserBucket
@Deprecated public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale)
From source file:org.jpmml.evaluator.TypeUtil.java
License:Open Source License
@SuppressWarnings(value = { "deprecation" }) static private Seconds parseSeconds(String value) { DateTimeFormatter format = SecondsSinceMidnight.getFormat(); DateTimeParser parser = format.getParser(); DateTimeParserBucket bucket = new DateTimeParserBucket(0, null, null); bucket.setZone(null);/* w ww.jav a2s . com*/ int result = parser.parseInto(bucket, value, 0); if (result >= 0 && result >= value.length()) { long millis = bucket.computeMillis(true); return Seconds.seconds((int) (millis / 1000L)); } throw new IllegalArgumentException(value); }
From source file:org.whole.lang.xsd.parsers.AbstractISO8601DataTypeParser.java
License:Open Source License
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);//from w w w . j av a 2 s .c o m 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); }