All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.deepdreams.employee.serializers.EmployeeAccessRevokedEventSerializer Maven / Gradle / Ivy

The newest version!
package tech.deepdreams.employee.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.employee.events.EmployeeAccessRevokedEvent;

public class EmployeeAccessRevokedEventSerializer extends JsonSerializer{
	
	
	@Override
    public void serialize(EmployeeAccessRevokedEvent event, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeStartObject();
        jsonGenerator.writeNumberField("id", event.getId());
        jsonGenerator.writeNumberField("employeeId", event.getEmployeeId());
        jsonGenerator.writeStringField("eventDate", event.getEventDate().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
        jsonGenerator.writeStringField("accessCode", event.getAccessCode());
        jsonGenerator.writeStringField("username", event.getUsername());
        jsonGenerator.writeEndObject();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy