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 *******************************************************************************/
10 package it.polito.escape.verify.serializer;
12 import java.io.IOException;
15 import com.fasterxml.jackson.core.JsonGenerator;
16 import com.fasterxml.jackson.databind.JsonSerializer;
17 import com.fasterxml.jackson.databind.SerializerProvider;
19 import it.polito.escape.verify.exception.InternalServerErrorException;
21 public class CustomMapSerializer extends JsonSerializer<Map<?, ?>> {
23 public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) {
25 jgen.writeObject(value.values());
26 } catch (IOException e) {
27 throw new InternalServerErrorException("I/O error serializing a map: " + e.getMessage());