public ExecutionResultSerializer( OutputStream output, URI baseUri, LogProvider logProvider, TransitionalPeriodTransactionMessContainer container ) { this.baseUri = baseUri; this.log = logProvider.getLog( getClass() ); this.container = container; JSON_FACTORY.setCodec( new Neo4jJsonCodec( container ) ); JsonGenerator generator = null; try { generator = JSON_FACTORY.createJsonGenerator( output ); } catch ( IOException e ) { loggedIOException( e ); } this.out = generator; }
_jsonFactory = jf; if (jf.getCodec() == null) { // as per [JACKSON-741] _jsonFactory.setCodec(this);
_jsonFactory = jf; if (jf.getCodec() == null) { // as per [JACKSON-741] _jsonFactory.setCodec(this);
public ExecutionResultSerializer( OutputStream output, URI baseUri, LogProvider logProvider, TransitionalPeriodTransactionMessContainer container ) { this.baseUri = baseUri; this.log = logProvider.getLog( getClass() ); this.container = container; JSON_FACTORY.setCodec( new Neo4jJsonCodec( container ) ); JsonGenerator generator = null; try { generator = JSON_FACTORY.createJsonGenerator( output ); } catch ( IOException e ) { loggedIOException( e ); } this.out = generator; }
public String toJSON(T object) throws IOException { JsonFactory jsonFactory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(jsonFactory); mapper.getSerializationConfig().setAnnotationIntrospector(new JacksonAnnotationIntrospector()); mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); jsonFactory.setCodec(mapper); StringWriter writer = new StringWriter(); JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(writer); jsonGenerator.useDefaultPrettyPrinter(); jsonGenerator.writeObject(object); return writer.getBuffer().toString(); } }
private JsonFactory createJsonFactory() { JsonFactory jsonFactory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(jsonFactory); mapper.getSerializationConfig().setAnnotationIntrospector(new JacksonAnnotationIntrospector()); mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); jsonFactory.setCodec(mapper); return jsonFactory; }
public JsonFactory createJsonFactory() { JsonFactory jsonFactory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(jsonFactory); mapper.getSerializationConfig().setAnnotationIntrospector(new JacksonAnnotationIntrospector()); mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); jsonFactory.setCodec(mapper); return jsonFactory; }
private static JsonFactory createJsonFactory() { JsonFactory jsonFactory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(jsonFactory); mapper.getSerializationConfig().setAnnotationIntrospector(new JacksonAnnotationIntrospector()); mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); mapper.getDeserializationConfig().disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); jsonFactory.setCodec(mapper); return jsonFactory; }
_jsonFactory = jf; if (jf.getCodec() == null) { // as per [JACKSON-741] _jsonFactory.setCodec(this);