/** * 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); }
public static KnowledgePackageWrapper parseKnowledgePackageWrapper(String content){ try{ ObjectMapper mapper=new ObjectMapper(); mapper.getDeserializationConfig().withDateFormat(new SimpleDateFormat(Configure.getDateFormat())); KnowledgePackageWrapper wrapper=mapper.readValue(content, KnowledgePackageWrapper.class); wrapper.buildDeserialize(); return wrapper; }catch(Exception ex){ throw new RuleException(ex); } }
/** * 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); }
/** * 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); }
public static KnowledgePackageWrapper parseKnowledgePackageWrapper(String content){ try{ ObjectMapper mapper=new ObjectMapper(); mapper.getDeserializationConfig().withDateFormat(new SimpleDateFormat(Configure.getDateFormat())); KnowledgePackageWrapper wrapper=mapper.readValue(content, KnowledgePackageWrapper.class); wrapper.buildDeserialize(); return wrapper; }catch(Exception ex){ throw new RuleException(ex); } }
@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")); }