1 /*******************************************************************************
2 * Copyright (c) 2017 Politecnico di Torino and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Apache License, Version 2.0
6 * which accompanies this distribution, and is available at
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *******************************************************************************/
9 package it.polito.verigraph.serializer;
11 import java.io.IOException;
13 import com.fasterxml.jackson.core.JsonGenerator;
14 import com.fasterxml.jackson.databind.JsonSerializer;
15 import com.fasterxml.jackson.databind.SerializerProvider;
16 import it.polito.verigraph.exception.InternalServerErrorException;
18 public class CustomMapSerializer extends JsonSerializer<Map<?, ?>> {
20 public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) {
22 jgen.writeObject(value.values());
23 } catch (IOException e) {
24 throw new InternalServerErrorException("I/O error serializing a map: " + e.getMessage());