/*
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
*/
|
package com.megatim.fdxconsultation.model.message.systeme;
|
|
import com.google.gson.Gson;
|
import javax.websocket.DecodeException;
|
import javax.websocket.Decoder;
|
import javax.websocket.EndpointConfig;
|
|
/**
|
*
|
* @author Lenovo P53
|
*/
|
public class MessageDecoder implements Decoder.Text<ApplicationData> {
|
|
private static Gson gson = new Gson();
|
|
@Override
|
public ApplicationData decode(String s) throws DecodeException {
|
return gson.fromJson(s, ApplicationData.class);
|
}
|
|
@Override
|
public boolean willDecode(String s) {
|
return (s != null);
|
}
|
|
@Override
|
public void init(EndpointConfig endpointConfig) {
|
// Custom initialization logic
|
}
|
|
@Override
|
public void destroy() {
|
// Close resources
|
}
|
}
|