Skip to content

Instantly share code, notes, and snippets.

@klg71
Created July 26, 2020 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klg71/cbae0eda5c7e4e4c00d7cdd74e276840 to your computer and use it in GitHub Desktop.
Save klg71/cbae0eda5c7e4e4c00d7cdd74e276840 to your computer and use it in GitHub Desktop.
internal class Converter<T : Any>(private val type:Class<T>) : AttributeConverter<List<T>, String> {
private val objectMapper = ObjectMapper()
override fun convertToDatabaseColumn(attribute: List<T>?): String {
TODO("Not yet implemented")
}
override fun convertToEntityAttribute(dbData: String?): List<T> {
return objectMapper.readValue(dbData,
objectMapper.typeFactory.constructCollectionLikeType(List::class.java, type))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment