tech.deepdreams.security.serializers.UserRecoveredEventSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of identity-events Show documentation
Show all versions of identity-events Show documentation
Mangement security project for Spring Boot
The newest version!
package tech.deepdreams.security.serializers;
import java.io.IOException;
import java.time.format.DateTimeFormatter;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import tech.deepdreams.security.events.UserDisabledEvent;
public class UserRecoveredEventSerializer extends JsonSerializer{
@Override
public void serialize(UserDisabledEvent event, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeNumberField("id", event.getId());
jsonGenerator.writeStringField("nickname", event.getNickname()) ;
jsonGenerator.writeStringField("email", event.getEmail()) ;
jsonGenerator.writeStringField("eventDate", event.getEventDate().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
jsonGenerator.writeStringField("description", event.getDescription());
jsonGenerator.writeNumberField("subscriberId", event.getSubscriberId());
jsonGenerator.writeEndObject();
}
}