TimeZone tz = format.getTimeZone(); final Boolean lenient = format.getLenient();
: serializers.getLocale(); SimpleDateFormat df = new SimpleDateFormat(format.getPattern(), loc); TimeZone tz = format.hasTimeZone() ? format.getTimeZone() : serializers.getTimeZone(); df.setTimeZone(tz); std = std.withTimeZone(format.getTimeZone()); df = (SimpleDateFormat) df.clone(); TimeZone newTz = format.getTimeZone(); boolean changeTZ = (newTz != null) && !newTz.equals(df.getTimeZone()); if (changeTZ) {
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { JsonFormat.Value format = findFormatOverrides(ctxt, property, handledType()); if (format != null) { if (format.hasPattern()) { final String pattern = format.getPattern(); final Locale locale = format.hasLocale() ? format.getLocale() : ctxt.getLocale(); DateTimeFormatter df; if (locale == null) { df = DateTimeFormatter.ofPattern(pattern); } else { df = DateTimeFormatter.ofPattern(pattern, locale); } //Issue #69: For instant serializers/deserializers we need to configure the formatter with //a time zone picked up from JsonFormat annotation, otherwise serialization might not work if (format.hasTimeZone()) { df = df.withZone(format.getTimeZone().toZoneId()); } return withDateFormat(df); } // any use for TimeZone? } return this; }
TimeZone tz = format.getTimeZone(); final Boolean lenient = format.getLenient();
TimeZone tz = format.getTimeZone(); if (format.hasPattern()) { String pattern = format.getPattern();
TimeZone tz = format.getTimeZone(); String pattern = format.getPattern(); if (pattern.length() > 0){
dtf = dtf.withZone(format.getTimeZone().toZoneId());
TimeZone tz = format.getTimeZone(); String pattern = format.getPattern(); if (pattern.length() > 0){
TimeZone tz = format.getTimeZone(); if (format.hasPattern()) { String pattern = format.getPattern();
dtf = dtf.withZone(DateTimeUtils.toZoneId(format.getTimeZone()));
this.handledType()); if (format != null) { TimeZone tz = format.getTimeZone();
JsonFormat.Value format = ctxt.getAnnotationIntrospector().findFormat((Annotated) property.getMember()); if (format != null) { TimeZone tz = format.getTimeZone();
JsonFormat.Value format = ctxt.getAnnotationIntrospector().findFormat((Annotated) property.getMember()); if (format != null) { TimeZone tz = format.getTimeZone();
JsonFormat.Value format = ctxt.getAnnotationIntrospector().findFormat((Annotated) property.getMember()); if (format != null) { TimeZone tz = format.getTimeZone();
JsonFormat.Value format = ctxt.getAnnotationIntrospector().findFormat(property.getMember()); if (format != null) { TimeZone tz = format.getTimeZone();
TimeZone tz = format.getTimeZone(); final String pattern = format.hasPattern() ? format.getPattern()
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { JsonFormat.Value format = findFormatOverrides(ctxt, property, handledType()); if (format != null) { if (format.hasPattern()) { final String pattern = format.getPattern(); final Locale locale = format.hasLocale() ? format.getLocale() : ctxt.getLocale(); DateTimeFormatter df; if (locale == null) { df = DateTimeFormatter.ofPattern(pattern); } else { df = DateTimeFormatter.ofPattern(pattern, locale); } //Issue #69: For instant serializers/deserializers we need to configure the formatter with //a time zone picked up from JsonFormat annotation, otherwise serialization might not work if (format.hasTimeZone()) { df = df.withZone(format.getTimeZone().toZoneId()); } return withDateFormat(df); } // any use for TimeZone? } return this; } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { JsonFormat.Value format = findFormatOverrides(ctxt, property, handledType()); if (format != null) { if (format.hasPattern()) { final String pattern = format.getPattern(); final Locale locale = format.hasLocale() ? format.getLocale() : ctxt.getLocale(); DateTimeFormatter df; if (locale == null) { df = DateTimeFormatter.ofPattern(pattern); } else { df = DateTimeFormatter.ofPattern(pattern, locale); } //Issue #69: For instant serializers/deserializers we need to configure the formatter with //a time zone picked up from JsonFormat annotation, otherwise serialization might not work if (format.hasTimeZone()) { df = df.withZone(DateTimeUtils.toZoneId(format.getTimeZone())); } return withDateFormat(df); } // any use for TimeZone? } return this; } }
public JacksonJodaDateFormat with(JsonFormat.Value ann) { JacksonJodaDateFormat format = this; format = format.withLocale(ann.getLocale()); format = format.withTimeZone(ann.getTimeZone()); format = format.withFormat(ann.getPattern().trim()); Boolean adjustTZ = ann.getFeature(JsonFormat.Feature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); Boolean writeZoneId = ann.getFeature(JsonFormat.Feature.WRITE_DATES_WITH_ZONE_ID); if ((adjustTZ != _adjustToContextTZOverride) || (writeZoneId != _writeZoneId)) { format = new JacksonJodaDateFormat(format, adjustTZ, writeZoneId); } return format; }
dtf = dtf.withZone(format.getTimeZone().toZoneId());