@Override public void defaultSerializeDateKey(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(date.getTime())); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(date)); } }
@Override public void defaultSerializeDateKey(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(timestamp)); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(new Date(timestamp))); } }
@Override public final void defaultSerializeDateValue(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(date.getTime()); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeString(_dateFormat.format(date)); } }
/** * @param timestamp Millisecond timestamp that defines date, if available; */ @Override public final void defaultSerializeDateValue(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(timestamp); } else { if (_dateFormat == null) { // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)_config.getDateFormat().clone(); } jgen.writeString(_dateFormat.format(new Date(timestamp))); } }
@Override public void defaultSerializeDateKey(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(timestamp)); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(new Date(timestamp))); } }
@Override public void defaultSerializeDateKey(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(date.getTime())); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(date)); } }
@Override public final void defaultSerializeDateValue(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(date.getTime()); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeString(_dateFormat.format(date)); } }
/** * @param timestamp Millisecond timestamp that defines date, if available; */ @Override public final void defaultSerializeDateValue(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(timestamp); } else { if (_dateFormat == null) { // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)_config.getDateFormat().clone(); } jgen.writeString(_dateFormat.format(new Date(timestamp))); } }
@Override public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { DateFormat df = (DateFormat) provider.getConfig().getDateFormat().clone(); jgen.writeString(df.format(value)); }
@Override public void defaultSerializeDateKey(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(date.getTime())); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(date)); } }
@Override public void defaultSerializeDateKey(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(timestamp)); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(new Date(timestamp))); } }
@Override public void defaultSerializeDateKey(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(date.getTime())); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(date)); } }
@Override public void defaultSerializeDateKey(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { if (isEnabled(SerializationConfig.Feature.WRITE_DATE_KEYS_AS_TIMESTAMPS)) { jgen.writeFieldName(String.valueOf(timestamp)); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeFieldName(_dateFormat.format(new Date(timestamp))); } }
/** * @param timestamp Millisecond timestamp that defines date, if available; */ @Override public final void defaultSerializeDateValue(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(timestamp); } else { if (_dateFormat == null) { // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)_config.getDateFormat().clone(); } jgen.writeString(_dateFormat.format(new Date(timestamp))); } }
@Override public final void defaultSerializeDateValue(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(date.getTime()); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeString(_dateFormat.format(date)); } }
@Override public final void defaultSerializeDateValue(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(date.getTime()); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeString(_dateFormat.format(date)); } }
@Override public final void defaultSerializeDateValue(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(date.getTime()); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeString(_dateFormat.format(date)); } }
@Override public final void defaultSerializeDateValue(Date date, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(date.getTime()); } else { if (_dateFormat == null) { DateFormat blueprint = _config.getDateFormat(); // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)blueprint.clone(); } jgen.writeString(_dateFormat.format(date)); } }
/** * @param timestamp Millisecond timestamp that defines date, if available; */ @Override public final void defaultSerializeDateValue(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(timestamp); } else { if (_dateFormat == null) { // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)_config.getDateFormat().clone(); } jgen.writeString(_dateFormat.format(new Date(timestamp))); } }
/** * @param timestamp Millisecond timestamp that defines date, if available; */ @Override public final void defaultSerializeDateValue(long timestamp, JsonGenerator jgen) throws IOException, JsonProcessingException { // [JACKSON-87]: Support both numeric timestamps and textual if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(timestamp); } else { if (_dateFormat == null) { // must create a clone since Formats are not thread-safe: _dateFormat = (DateFormat)_config.getDateFormat().clone(); } jgen.writeString(_dateFormat.format(new Date(timestamp))); } }