/** * Fluent factory method that will construct a new writer instance that will * use specified date format for serializing dates; or if null passed, one * that will serialize dates as numeric timestamps. * * @since 1.9 */ public ObjectWriter withDateFormat(DateFormat df) { SerializationConfig newConfig = _config.withDateFormat(df); if (newConfig == _config) { return this; } return new ObjectWriter(this, newConfig); }
/** * Method for configuring the default {@link DateFormat} to use when serializing time * values as Strings, and deserializing from JSON Strings. * This is preferably to directly modifying {@link SerializationConfig} and * {@link DeserializationConfig} instances. * If you need per-request configuration, use {@link #writer(DateFormat)} to * create properly configured {@link ObjectWriter} and use that; this because * {@link ObjectWriter}s are thread-safe whereas ObjectMapper itself is only * thread-safe when configuring methods (such as this one) are NOT called. * * @since 1.8 */ public void setDateFormat(DateFormat dateFormat) { _deserializationConfig = _deserializationConfig.withDateFormat(dateFormat); _serializationConfig = _serializationConfig.withDateFormat(dateFormat); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified {@link DateFormat}; or, if * null passed, using timestamp (64-bit number. * * @since 1.9 */ public ObjectWriter writer(DateFormat df) { return new ObjectWriter(this, copySerializationConfig().withDateFormat(df)); }
/** * Fluent factory method that will construct a new writer instance that will * use specified date format for serializing dates; or if null passed, one * that will serialize dates as numeric timestamps. * * @since 1.9 */ public ObjectWriter withDateFormat(DateFormat df) { SerializationConfig newConfig = _config.withDateFormat(df); if (newConfig == _config) { return this; } return new ObjectWriter(this, newConfig); }
/** * Method for configuring the default {@link DateFormat} to use when serializing time * values as Strings, and deserializing from JSON Strings. * This is preferably to directly modifying {@link SerializationConfig} and * {@link DeserializationConfig} instances. * If you need per-request configuration, use {@link #writer(DateFormat)} to * create properly configured {@link ObjectWriter} and use that; this because * {@link ObjectWriter}s are thread-safe whereas ObjectMapper itself is only * thread-safe when configuring methods (such as this one) are NOT called. * * @since 1.8 */ public void setDateFormat(DateFormat dateFormat) { _deserializationConfig = _deserializationConfig.withDateFormat(dateFormat); _serializationConfig = _serializationConfig.withDateFormat(dateFormat); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified {@link DateFormat}; or, if * null passed, using timestamp (64-bit number. * * @since 1.9 */ public ObjectWriter writer(DateFormat df) { return new ObjectWriter(this, copySerializationConfig().withDateFormat(df)); }
/** * Method for configuring {@link DateFormat} to use when serializing time * values as Strings, and deserializing from JSON Strings. * This is preferably to directly modifying {@link SerializationConfig} and * {@link DeserializationConfig} instances. * * @since 1.8 */ public void setDateFormat(DateFormat dateFormat) { _deserializationConfig = _deserializationConfig.withDateFormat(dateFormat); _serializationConfig = _serializationConfig.withDateFormat(dateFormat); }
/** * Fluent factory method that will construct a new writer instance that will * use specified date format for serializing dates; or if null passed, one * that will serialize dates as numeric timestamps. * * @since 1.9 */ public ObjectWriter withDateFormat(DateFormat df) { SerializationConfig newConfig = _config.withDateFormat(df); if (newConfig == _config) { return this; } return new ObjectWriter(this, newConfig); }
/** * Fluent factory method that will construct a new writer instance that will * use specified date format for serializing dates; or if null passed, one * that will serialize dates as numeric timestamps. * * @since 1.9 */ public ObjectWriter withDateFormat(DateFormat df) { SerializationConfig newConfig = _config.withDateFormat(df); if (newConfig == _config) { return this; } return new ObjectWriter(this, newConfig); }
/** * Method for configuring the default {@link DateFormat} to use when serializing time * values as Strings, and deserializing from JSON Strings. * This is preferably to directly modifying {@link SerializationConfig} and * {@link DeserializationConfig} instances. * If you need per-request configuration, use {@link #writer(DateFormat)} to * create properly configured {@link ObjectWriter} and use that; this because * {@link ObjectWriter}s are thread-safe whereas ObjectMapper itself is only * thread-safe when configuring methods (such as this one) are NOT called. * * @since 1.8 */ public void setDateFormat(DateFormat dateFormat) { _deserializationConfig = _deserializationConfig.withDateFormat(dateFormat); _serializationConfig = _serializationConfig.withDateFormat(dateFormat); }
/** * Method for configuring the default {@link DateFormat} to use when serializing time * values as Strings, and deserializing from JSON Strings. * This is preferably to directly modifying {@link SerializationConfig} and * {@link DeserializationConfig} instances. * If you need per-request configuration, use {@link #writer(DateFormat)} to * create properly configured {@link ObjectWriter} and use that; this because * {@link ObjectWriter}s are thread-safe whereas ObjectMapper itself is only * thread-safe when configuring methods (such as this one) are NOT called. * * @since 1.8 */ public void setDateFormat(DateFormat dateFormat) { _deserializationConfig = _deserializationConfig.withDateFormat(dateFormat); _serializationConfig = _serializationConfig.withDateFormat(dateFormat); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified {@link DateFormat}; or, if * null passed, using timestamp (64-bit number. * * @since 1.9 */ public ObjectWriter writer(DateFormat df) { return new ObjectWriter(this, copySerializationConfig().withDateFormat(df)); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified {@link DateFormat}; or, if * null passed, using timestamp (64-bit number. * * @since 1.9 */ public ObjectWriter writer(DateFormat df) { return new ObjectWriter(this, copySerializationConfig().withDateFormat(df)); }
@PostConstruct public void init() { // check if everything is configured. checkConfig(); log.info("Creating MailChimp integration client."); String url = buildServerURL(); log.info("Server URL is: {}", url); client = Client.create(); resource = client.resource(url); SerializationConfig s = m.getSerializationConfig(); s.setSerializationInclusion(Inclusion.NON_NULL); s.withDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); m.setSerializationConfig(s); DeserializationConfig d = m.getDeserializationConfig(); d.withDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); m.setDeserializationConfig(d); m.setDateFormat(new SimpleDateFormat("yyyy-MM-MM HH:mm:ss")); }
mapper.setDeserializationConfig(mapper.getDeserializationConfig().withAnnotationIntrospector(pair) .without(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES) .withDateFormat(StdDateFormat.getBlueprintISO8601Format())); mapper.setSerializationConfig(mapper.getSerializationConfig().withAnnotationIntrospector(pair) .withSerializationInclusion(JsonSerialize.Inclusion.NON_NULL) .withDateFormat(StdDateFormat.getBlueprintISO8601Format())); return mapper;