/** * Convenience method for constructing Calendar instance set * to specified time, to be modified and used by caller. */ public Calendar constructCalendar(Date d) { // 08-Jan-2008, tatu: not optimal, but should work for the most part; let's revise as needed. Calendar c = Calendar.getInstance(getTimeZone()); c.setTime(d); return c; }
protected XMLGregorianCalendar _gregorianFromDate(DeserializationContext ctxt, Date d) { if (d == null) { return null; } GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(d); TimeZone tz = ctxt.getTimeZone(); if (tz != null) { calendar.setTimeZone(tz); } return _dataTypeFactory.newXMLGregorianCalendar(calendar); } }
private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles return (_valueClass == Instant.class) ? null : context.getTimeZone().toZoneId(); }
private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles return (_valueClass == Instant.class) ? null : context.getTimeZone().toZoneId(); }
@Override public Calendar deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Date d = _parseDate(p, ctxt); if (d == null) { return null; } if (_defaultCtor == null) { return ctxt.constructCalendar(d); } try { Calendar c = _defaultCtor.newInstance(); c.setTimeInMillis(d.getTime()); TimeZone tz = ctxt.getTimeZone(); if (tz != null) { c.setTimeZone(tz); } return c; } catch (Exception e) { return (Calendar) ctxt.handleInstantiationProblem(handledType(), d, e); } } }
SimpleDateFormat df = new SimpleDateFormat(pattern, loc); if (tz == null) { tz = ctxt.getTimeZone();
@Override protected DateTime deserialize(String key, DeserializationContext ctxt) throws IOException { if (ctxt.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { TimeZone tz = ctxt.getTimeZone(); DateTimeZone dtz = (tz == null) ? DateTimeZone.UTC : DateTimeZone.forTimeZone(tz); return new DateTime(key, dtz); } return DateTime.parse(key); }
/** * Accessor used during deserialization. */ public DateTimeFormatter createParser(DeserializationContext ctxt) { DateTimeFormatter formatter = _formatter; if (!_explicitLocale) { Locale loc = ctxt.getLocale(); if (loc != null && !loc.equals(_locale)) { formatter = formatter.withLocale(loc); } } if (!_explicitTimezone) { if (shouldAdjustToContextTimeZone(ctxt)) { TimeZone tz = ctxt.getTimeZone(); if (tz != null && !tz.equals(_jdkTimezone)) { formatter = formatter.withZone(DateTimeZone.forTimeZone(tz)); } } else { formatter = formatter.withOffsetParsed(); } } return formatter; }
DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone()); return new DateTime(p.getLongValue(), tz);
"after DateMidnight ints"); DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone());
DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone()); if (tz != null) { if (!tz.equals(result.getStart().getZone())) {
case JsonTokenId.ID_NUMBER_INT: DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone()); return new LocalDate(p.getLongValue(), tz);
DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone()); return new LocalDateTime(p.getLongValue(), tz);
/** * Convenience method for constructing Calendar instance set * to specified time, to be modified and used by caller. */ public Calendar constructCalendar(Date d) { // 08-Jan-2008, tatu: not optimal, but should work for the most part; let's revise as needed. Calendar c = Calendar.getInstance(getTimeZone()); c.setTime(d); return c; }
/** * Convenience method for constructing Calendar instance set * to specified time, to be modified and used by caller. */ public Calendar constructCalendar(Date d) { // 08-Jan-2008, tatu: not optimal, but should work for the most part; let's revise as needed. Calendar c = Calendar.getInstance(getTimeZone()); c.setTime(d); return c; }
/** * Convenience method for constructing Calendar instance set * to specified time, to be modified and used by caller. */ public Calendar constructCalendar(Date d) { // 08-Jan-2008, tatu: not optimal, but should work for the most part; let's revise as needed. Calendar c = Calendar.getInstance(getTimeZone()); c.setTime(d); return c; }
/** * Convenience method for constructing Calendar instance set * to specified time, to be modified and used by caller. */ public Calendar constructCalendar(Date d) { // 08-Jan-2008, tatu: not optimal, but should work for the most part; let's revise as needed. Calendar c = Calendar.getInstance(getTimeZone()); c.setTime(d); return c; }
@Override protected Object _parse(String key, DeserializationContext ctxt) throws Exception { if (key.length() == 0) { // [JACKSON-360] return null; } return new DateTime(key, DateTimeZone.forTimeZone(ctxt.getTimeZone())); }
private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); }
private ZoneId getZone(DeserializationContext context) { // Instants are always in UTC, so don't waste compute cycles return (_valueClass == Instant.class) ? null : context.getTimeZone().toZoneId(); }