package com.megatim.fdxconsultation.service.impl.sockets.encoders; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.fdx.messaging.common.ConnexionStatut; import java.util.List; import javax.websocket.DecodeException; import javax.websocket.Decoder; import javax.websocket.EndpointConfig; /** * * @author lenovo */ public class ConnexionStatutsDecoder implements Decoder.Text> { private ObjectMapper objectMapper = new ObjectMapper(); @Override public List decode(String s) throws DecodeException { try { return objectMapper.readValue(s, new TypeReference>() {}); } catch (Exception e) { throw new DecodeException(s, "Unable to decode message", e); } } @Override public boolean willDecode(String s) { return s != null; } @Override public void init(EndpointConfig endpointConfig) { } @Override public void destroy() { } }