package com.megatim.fdxconsultation.service.impl.sockets.encoders; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; import java.util.Map; import javax.websocket.EncodeException; import javax.websocket.Encoder; import javax.websocket.EndpointConfig; /** * * @author lenovo */ public class ParticipantToFichiersEncoder implements Encoder.Text>> { private final ObjectMapper objectMapper = new ObjectMapper(); @Override public String encode(Map> map) throws EncodeException { try { return objectMapper.writeValueAsString(map); } catch (JsonProcessingException e) { throw new EncodeException(map, "Unable to encode map", e); } } @Override public void init(EndpointConfig endpointConfig) { } @Override public void destroy() { } }