Class FileTypeConverter

java.lang.Object
com.endurancetrio.data.event.model.converter.FileTypeConverter
All Implemented Interfaces:
jakarta.persistence.AttributeConverter<FileType,String>

public class FileTypeConverter extends Object implements jakarta.persistence.AttributeConverter<FileType,String>
The FileTypeConverter class is responsible for converting the FileType enum to its corresponding database column representation and vice versa.

This converter is used to persist the FileType enum as a string in the database. It converts the enum to its code when storing it in the database and converts the code back to the enum when retrieving it from the database.

  • Constructor Details

    • FileTypeConverter

      public FileTypeConverter()
  • Method Details

    • convertToDatabaseColumn

      public String convertToDatabaseColumn(FileType fileType)
      Specified by:
      convertToDatabaseColumn in interface jakarta.persistence.AttributeConverter<FileType,String>
    • convertToEntityAttribute

      public FileType convertToEntityAttribute(String code)
      Specified by:
      convertToEntityAttribute in interface jakarta.persistence.AttributeConverter<FileType,String>