co.com.sofka.infraestructure.event.ErrorEventSerializer Maven / Gradle / Ivy
package co.com.sofka.infraestructure.event;
import co.com.sofka.infraestructure.AbstractSerializer;
import java.lang.reflect.Type;
/**
* The type Event serializer.
*/
public final class ErrorEventSerializer extends AbstractSerializer {
private static ErrorEventSerializer eventSerializer;
private ErrorEventSerializer() {
super();
}
/**
* Instance event serializer.
*
* @return the event serializer
*/
public static synchronized ErrorEventSerializer instance() {
if (ErrorEventSerializer.eventSerializer == null) {
ErrorEventSerializer.eventSerializer = new ErrorEventSerializer();
}
return ErrorEventSerializer.eventSerializer;
}
/**
* Deserialize t.
*
* @param the type parameter
* @param aSerialization the a serialization
* @param aType the a type
* @return the t
*/
public T deserialize(String aSerialization, final Class> aType) {
return gson.fromJson(aSerialization, (Type) aType);
}
/**
* Serialize string.
*
* @param object the object
* @return the string
*/
public String serialize(ErrorEvent object) {
return gson.toJson(object);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy