Class JKCSVConvertor

java.lang.Object
com.jk.core.jpa.JKCSVConvertor
All Implemented Interfaces:
jakarta.persistence.AttributeConverter<List<String>,String>

public class JKCSVConvertor extends Object implements jakarta.persistence.AttributeConverter<List<String>,String>
This class is can be used to convert entity attribute state into database column representation and back again.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • JKCSVConvertor

      public JKCSVConvertor()
  • Method Details

    • convertToDatabaseColumn

      public String convertToDatabaseColumn(List<String> attribute)
      Converts the value stored in the entity attribute into the data representation to be stored in the database.
      Specified by:
      convertToDatabaseColumn in interface jakarta.persistence.AttributeConverter<List<String>,String>
      Parameters:
      attribute - the entity attribute value to be converted
      Returns:
      the converted data to be stored in the database column
    • convertToEntityAttribute

      public List convertToEntityAttribute(String dbData)
      Converts the data stored in the database column into the value to be stored in the entity attribute. Note that it is the responsibility of the converter writer to specify the correct dbData type for the corresponding column for use by the JDBC driver: i.e., persistence providers are not expected to do such type conversion.
      Specified by:
      convertToEntityAttribute in interface jakarta.persistence.AttributeConverter<List<String>,String>
      Parameters:
      dbData - the data from the database column to be converted
      Returns:
      the converted value to be stored in the entity attribute