/** * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> * * <p>This method represents a convenience accessor to infinite * precision fractional second value returned by * {@link #getFractionalSecond()}. The returned value is the rounded * down to milliseconds value of * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} * returns <code>null</code>, this method must return * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> * * @return Millisecond of this <code>XMLGregorianCalendar</code>. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { BigDecimal fractionalSeconds = getFractionalSecond(); // is field undefined? if (fractionalSeconds == null) { return DatatypeConstants.FIELD_UNDEFINED; } return getFractionalSecond().movePointRight(3).intValue(); }
case 's': printNumber(buf,value.getSecond(),2); if (value.getFractionalSecond() != null) { String frac = value.getFractionalSecond().toPlainString();
case 's': printNumber(buf,value.getSecond(),2); if (value.getFractionalSecond() != null) { String frac = value.getFractionalSecond().toPlainString();
@Override public BigDecimal getFractionalSecond() { return xmlGregorianCalendar.getFractionalSecond(); }
@Override public BigDecimal getFractionalSecond() { return xmlGregorianCalendar.getFractionalSecond(); }
public BigDecimal getFractionalSecond() { return calendar.getFractionalSecond(); }
public BigDecimal getFractionalSecond() { return calendar.getFractionalSecond(); }
/** * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> * * <p>This method represents a convenience accessor to infinite * precision fractional second value returned by * {@link #getFractionalSecond()}. The returned value is the rounded * down to milliseconds value of * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} * returns <code>null</code>, this method must return * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> * * @return Millisecond of this <code>XMLGregorianCalendar</code>. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { BigDecimal fractionalSeconds = getFractionalSecond(); // is field undefined? if (fractionalSeconds == null) { return DatatypeConstants.FIELD_UNDEFINED; } return getFractionalSecond().movePointRight(3).intValue(); }
/** * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> * * <p>This method represents a convenience accessor to infinite * precision fractional second value returned by * {@link #getFractionalSecond()}. The returned value is the rounded * down to milliseconds value of * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} * returns <code>null</code>, this method must return * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> * * @return Millisecond of this <code>XMLGregorianCalendar</code>. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { BigDecimal fractionalSeconds = getFractionalSecond(); // is field undefined? if (fractionalSeconds == null) { return DatatypeConstants.FIELD_UNDEFINED; } return getFractionalSecond().movePointRight(3).intValue(); }
/** * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> * * <p>This method represents a convenience accessor to infinite * precision fractional second value returned by * {@link #getFractionalSecond()}. The returned value is the rounded * down to milliseconds value of * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} * returns <code>null</code>, this method must return * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> * * @return Millisecond of this <code>XMLGregorianCalendar</code>. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { BigDecimal fractionalSeconds = getFractionalSecond(); // is field undefined? if (fractionalSeconds == null) { return DatatypeConstants.FIELD_UNDEFINED; } return getFractionalSecond().movePointRight(3).intValue(); }
/** * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> * * <p>This method represents a convenience accessor to infinite * precision fractional second value returned by * {@link #getFractionalSecond()}. The returned value is the rounded * down to milliseconds value of * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} * returns <code>null</code>, this method must return * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> * * @return Millisecond of this <code>XMLGregorianCalendar</code>. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { BigDecimal fractionalSeconds = getFractionalSecond(); // is field undefined? if (fractionalSeconds == null) { return DatatypeConstants.FIELD_UNDEFINED; } return getFractionalSecond().movePointRight(3).intValue(); }
/** * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> * * <p>This method represents a convenience accessor to infinite * precision fractional second value returned by * {@link #getFractionalSecond()}. The returned value is the rounded * down to milliseconds value of * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} * returns <code>null</code>, this method must return * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> * * @return Millisecond of this <code>XMLGregorianCalendar</code>. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { BigDecimal fractionalSeconds = getFractionalSecond(); // is field undefined? if (fractionalSeconds == null) { return DatatypeConstants.FIELD_UNDEFINED; } return getFractionalSecond().movePointRight(3).intValue(); }
/** * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p> * * <p>This method represents a convenience accessor to infinite * precision fractional second value returned by * {@link #getFractionalSecond()}. The returned value is the rounded * down to milliseconds value of * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} * returns <code>null</code>, this method must return * {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * <p>Value constraints for this value are summarized in * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p> * * @return Millisecond of this <code>XMLGregorianCalendar</code>. * * @see #getFractionalSecond() * @see #setTime(int, int, int) */ public int getMillisecond() { BigDecimal fractionalSeconds = getFractionalSecond(); // is field undefined? if (fractionalSeconds == null) { return DatatypeConstants.FIELD_UNDEFINED; } return getFractionalSecond().movePointRight(3).intValue(); }
@Override public JsonElement serialize(XMLGregorianCalendar cal, Type type, JsonSerializationContext jsonSerializationContext) { JsonObject obj = new JsonObject(); obj.addProperty(YEAR, cal.getYear()); obj.addProperty(MONTH, cal.getMonth()); obj.addProperty(DAY, cal.getDay()); obj.addProperty(TIMEZONE, cal.getTimezone()); obj.addProperty(HOUR, cal.getHour()); obj.addProperty(MINUTE, cal.getMinute()); obj.addProperty(SECOND, cal.getSecond()); obj.addProperty(FRACTIONAL, cal.getFractionalSecond()); return obj; // this alternative implementation is not working //return new JsonPrimitive(cal.toXMLFormat()); }
public static DateTime convertXMLGregorianCalendarToDateTime( XMLGregorianCalendar aXMLGregorianCalendar, Timezone aTimezone ) { // -- DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) -- int tempSubsecond = 0; if ( aXMLGregorianCalendar.getFractionalSecond() != null ) { tempSubsecond = aXMLGregorianCalendar.getFractionalSecond().intValue(); } DateTimeZone tempDateTimeZone = convertTimezoneToDateTimeZone( aTimezone ); if ( tempDateTimeZone == null ) { tempDateTimeZone = DateTimeZone.getDefault(); } return new DateTime( aXMLGregorianCalendar.getYear(), aXMLGregorianCalendar.getMonth(), aXMLGregorianCalendar.getDay(), aXMLGregorianCalendar.getHour(), aXMLGregorianCalendar.getMinute(), aXMLGregorianCalendar.getSecond(), tempSubsecond, tempDateTimeZone ); }
@Override public XMLGregorianCalendar dateAndTime(XMLGregorianCalendar date, XMLGregorianCalendar time) { if (date == null || time == null) { return null; } try { return FEELXMLGregorianCalendar.makeDateTime( BigInteger.valueOf(date.getYear()), date.getMonth(), date.getDay(), time.getHour(), time.getMinute(), time.getSecond(), time.getFractionalSecond(), time.getTimezone(), ((FEELXMLGregorianCalendar)time).getZoneID() ); } catch (Throwable e) { return null; } }
@Override public XMLGregorianCalendar dateAndTime(XMLGregorianCalendar date, XMLGregorianCalendar time) { if (date == null || time == null) { return null; } try { return FEELXMLGregorianCalendar.makeDateTime( BigInteger.valueOf(date.getYear()), date.getMonth(), date.getDay(), time.getHour(), time.getMinute(), time.getSecond(), time.getFractionalSecond(), time.getTimezone(), ((FEELXMLGregorianCalendar)time).getZoneID() ); } catch (Throwable e) { return null; } }
results[1] = createInteger( abox, value.getHour() ); results[2] = createInteger( abox, value.getMinute() ); final BigDecimal fractionalSeconds = value.getFractionalSecond(); results[3] = createDecimal( abox, (fractionalSeconds == null) ? value.getSecond()
results[1] = createInteger( abox, value.getHour() ); results[2] = createInteger( abox, value.getMinute() ); final BigDecimal fractionalSeconds = value.getFractionalSecond(); results[3] = createDecimal( abox, (fractionalSeconds == null) ? value.getSecond()
@Override public boolean apply(final ABox abox, final Literal[] args) { if (restBound(args)) { final Literal result = allBound.apply(abox, args[0], argList(args)); if (result != null) { if (args[0] == null) args[0] = result; return true; } return false; } if (args[0].getValue() instanceof XMLGregorianCalendar) { final XMLGregorianCalendar value = (XMLGregorianCalendar) args[0].getValue(); final Literal[] results = new Literal[5]; results[0] = args[0]; results[1] = createInteger(abox, value.getHour()); results[2] = createInteger(abox, value.getMinute()); final BigDecimal fractionalSeconds = value.getFractionalSecond(); results[3] = createDecimal(abox, fractionalSeconds == null ? value.getSecond() : fractionalSeconds.add(BigDecimal.valueOf(value.getSecond()))); if (value.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) results[4] = abox.addLiteral(ATermUtils.makePlainLiteral(toTZ(value.getTimezone()))); if (mergeResults(args, results)) return true; } return false; }