protected Duration parsePeriod(String period) throws Exception { return datatypeFactory.newDuration(period); }
@Override protected Duration _deserialize(String value, DeserializationContext ctxt) throws IllegalArgumentException { return _dataTypeFactory.newDuration(value); } }
public Object fromString(String s) { return factory.newDuration(s); } }
/** * <p>Create a <code>Duration</code> of type <code>xdt:yearMonthDuration</code> using the specified * <code>year</code> and <code>month</code> as defined in * <a href="http://www.w3.org/TR/xpath-datamodel#dt-yearMonthyDuration"> * XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a>.</p> * * <p>A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.</p> * * @param isPositive Set to <code>false</code> to create a negative duration. When the length * of the duration is zero, this parameter will be ignored. * @param year Year of <code>Duration</code>. * @param month Month of <code>Duration</code>. * * @return New <code>Duration</code> created using the specified <code>year</code> and <code>month</code>. * * @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. */ public Duration newDurationYearMonth( final boolean isPositive, final int year, final int month) { return newDuration(isPositive, year, month, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED); }
final int minute, final int second) { return newDuration(isPositive, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, day, hour, minute, second);
return newDuration(durationInMilliseconds);
final BigInteger month) { return newDuration( isPositive, year,
public JAXBElement<Duration> standardClassDuration() { Duration duration = factory.newDuration(42000); return new JAXBElement<>(NAME, Duration.class, duration); }
final BigInteger second) { return newDuration( isPositive,
@Override protected Object _deserialize(String value, DeserializationContext ctxt) throws IOException { switch (_kind) { case TYPE_DURATION: return _dataTypeFactory.newDuration(value); case TYPE_QNAME: return QName.valueOf(value); case TYPE_G_CALENDAR: Date d; try { d = _parseDate(value, ctxt); } catch (JsonMappingException e) { // try to parse from native XML Schema 1.0 lexical representation String, // which includes time-only formats not handled by parseXMLGregorianCalendarFromJacksonFormat(...) return _dataTypeFactory.newXMLGregorianCalendar(value); } return _gregorianFromDate(ctxt, d); } throw new IllegalStateException(); }
@Override protected Object _deserialize(String value, DeserializationContext ctxt) throws IOException { switch (_kind) { case TYPE_DURATION: return _dataTypeFactory.newDuration(value); case TYPE_QNAME: return QName.valueOf(value); case TYPE_G_CALENDAR: Date d; try { d = _parseDate(value, ctxt); } catch (JsonMappingException e) { // try to parse from native XML Schema 1.0 lexical representation String, // which includes time-only formats not handled by parseXMLGregorianCalendarFromJacksonFormat(...) return _dataTypeFactory.newXMLGregorianCalendar(value); } return _gregorianFromDate(ctxt, d); } throw new IllegalStateException(); }
return newDuration(lexicalRepresentation);
return newDuration(lexicalRepresentation);
public Duration parse(CharSequence lexical) { TODO.checkSpec("JSR222 Issue #42"); return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); } }
long _durationInMilliseconds = durationInMilliseconds; if (_durationInMilliseconds == 0) { return newDuration(true, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, 0, 0, 0, 0); long days = val / 24L; if (days <= ((long) Integer.MAX_VALUE)) { return newDuration(isPositive, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, (int) days, hours, minutes, seconds); return newDuration(isPositive, null, null, BigInteger.valueOf(days), BigInteger.valueOf(hours), BigInteger.valueOf(minutes), BigDecimal.valueOf(milliseconds, 3)); return newDuration(isPositive, null, null, days, hours, minutes, seconds);
dur = DatatypeFactory.newInstance().newDuration(str); seconds = dur.getTimeInMillis(STATIC_DATE) / 1000; } catch (Exception ex) {
@Override protected Object _deserialize(String value, DeserializationContext ctxt) throws IOException { switch (_kind) { case TYPE_DURATION: return _dataTypeFactory.newDuration(value); case TYPE_QNAME: return QName.valueOf(value); case TYPE_G_CALENDAR: Date d; try { d = _parseDate(value, ctxt); } catch (JsonMappingException e) { // try to parse from native XML Schema 1.0 lexical representation String, // which includes time-only formats not handled by parseXMLGregorianCalendarFromJacksonFormat(...) return _dataTypeFactory.newXMLGregorianCalendar(value); } return _gregorianFromDate(ctxt, d); } throw new IllegalStateException(); }
} else { end = parseDate(expression.get(1)); period = datatypeFactory.newDuration(end.getTimeInMillis() - start.getTimeInMillis());
return newDuration( isPositive, realYears,
public Duration parse(CharSequence lexical) { TODO.checkSpec("JSR222 Issue #42"); return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); } }