/** * Method that will define global setting of which * bean/map properties are to be included in serialization. * Can be overridden by class annotations (overriding * settings to use for instances of that class) and * method/field annotations (overriding settings for the value * bean for that getter method or field) * * @deprecated since 1.9 should either use {@link #withSerializationInclusion} * to construct new instance, or configure through {@link ObjectMapper} */ @Deprecated public void setSerializationInclusion(JsonSerialize.Inclusion props) { _serializationInclusion = props; // And for some level of backwards compatibility, also... if (props == JsonSerialize.Inclusion.NON_NULL) { disable(Feature.WRITE_NULL_PROPERTIES); } else { enable(Feature.WRITE_NULL_PROPERTIES); } }
private JsonFactory createJsonFactory() { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.getSerializationConfig().disable( SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE ); JsonFactory factory = new JsonFactory( objectMapper ) { @Override protected JsonGenerator _createUTF8JsonGenerator( OutputStream out, IOContext ctxt ) { final int bufferSize = 1024 * 8; Utf8Generator gen = new Utf8Generator( ctxt, _generatorFeatures, _objectCodec, out, new byte[bufferSize], 0, true ); if ( _characterEscapes != null ) { gen.setCharacterEscapes( _characterEscapes ); } return gen; } }; factory.disable( JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM ); return factory; }
/** * Method that will define global setting of which * bean/map properties are to be included in serialization. * Can be overridden by class annotations (overriding * settings to use for instances of that class) and * method/field annotations (overriding settings for the value * bean for that getter method or field) * * @deprecated since 1.9 should either use {@link #withSerializationInclusion} * to construct new instance, or configure through {@link ObjectMapper} */ @Deprecated public void setSerializationInclusion(JsonSerialize.Inclusion props) { _serializationInclusion = props; // And for some level of backwards compatibility, also... if (props == JsonSerialize.Inclusion.NON_NULL) { disable(Feature.WRITE_NULL_PROPERTIES); } else { enable(Feature.WRITE_NULL_PROPERTIES); } }
/** * Method for enabling or disabling specified feature. */ public void set(Feature f, boolean state) { if (state) { enable(f); } else { disable(f); } }
/** * Method for enabling or disabling specified feature. */ public void set(Feature f, boolean state) { if (state) { enable(f); } else { disable(f); } }
/** * Method that will define global setting of which * bean/map properties are to be included in serialization. * Can be overridden by class annotations (overriding * settings to use for instances of that class) and * method/field annotations (overriding settings for the value * bean for that getter method or field) */ public void setSerializationInclusion(JsonSerialize.Inclusion props) { _serializationInclusion = props; // And for some level of backwards compatibility, also... if (props == JsonSerialize.Inclusion.NON_NULL) { disable(Feature.WRITE_NULL_PROPERTIES); } else { enable(Feature.WRITE_NULL_PROPERTIES); } }
/** * Method that will define global setting of which * bean/map properties are to be included in serialization. * Can be overridden by class annotations (overriding * settings to use for instances of that class) and * method/field annotations (overriding settings for the value * bean for that getter method or field) */ public void setSerializationInclusion(JsonSerialize.Inclusion props) { _serializationInclusion = props; // And for some level of backwards compatibility, also... if (props == JsonSerialize.Inclusion.NON_NULL) { disable(Feature.WRITE_NULL_PROPERTIES); } else { enable(Feature.WRITE_NULL_PROPERTIES); } }
/** * Method that will define global setting of which * bean/map properties are to be included in serialization. * Can be overridden by class annotations (overriding * settings to use for instances of that class) and * method/field annotations (overriding settings for the value * bean for that getter method or field) * * @deprecated since 1.9 should either use {@link #withSerializationInclusion} * to construct new instance, or configure through {@link ObjectMapper} */ @SuppressWarnings("deprecation") @Deprecated public void setSerializationInclusion(JsonSerialize.Inclusion props) { _serializationInclusion = props; // And for some level of backwards compatibility, also... if (props == JsonSerialize.Inclusion.NON_NULL) { disable(Feature.WRITE_NULL_PROPERTIES); } else { enable(Feature.WRITE_NULL_PROPERTIES); } }
/** * Method that will define global setting of which * bean/map properties are to be included in serialization. * Can be overridden by class annotations (overriding * settings to use for instances of that class) and * method/field annotations (overriding settings for the value * bean for that getter method or field) * * @deprecated since 1.9 should either use {@link #withSerializationInclusion} * to construct new instance, or configure through {@link ObjectMapper} */ @Deprecated public void setSerializationInclusion(JsonSerialize.Inclusion props) { _serializationInclusion = props; // And for some level of backwards compatibility, also... if (props == JsonSerialize.Inclusion.NON_NULL) { disable(Feature.WRITE_NULL_PROPERTIES); } else { enable(Feature.WRITE_NULL_PROPERTIES); } }
private JsonFactory createJsonFactory() { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.getSerializationConfig().disable( SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE ); JsonFactory factory = new JsonFactory( objectMapper ) { @Override protected JsonGenerator _createUTF8JsonGenerator( OutputStream out, IOContext ctxt ) { final int bufferSize = 1024 * 8; Utf8Generator gen = new Utf8Generator( ctxt, _generatorFeatures, _objectCodec, out, new byte[bufferSize], 0, true ); if ( _characterEscapes != null ) { gen.setCharacterEscapes( _characterEscapes ); } return gen; } }; factory.disable( JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM ); return factory; }