0

I'm trying to create a MappedCOlumnType for an abstract case class that I have.

sealed abstract class Address(address: String)
implicit val addressToString = MappedColumnType.base[Address, String](
  addr => addr.address,
  addr => AddressUtil.address(addr)
)

but I am getting a compiler error stating that:

value address is not a member of com.suredbits.core.protocol.Address
[error]  Note: implicit value addressToString is not applicable here because it comes after the application point and it lacks an explicit result type
[error]   {addr => addr.address } , { addr => AddressUtil.address(addr) }

when I am clearly declaring address as a field inside of the case class. I feel like this might be an extremely silly error on my part. Why isn't my address field visible?

bjfletcher
  • 11,168
  • 4
  • 52
  • 67
Chris Stewart
  • 1,641
  • 2
  • 28
  • 60

1 Answers1

0

The address in your example is private to the constructor. To make it public with a getter, add val to the front of it like so:

sealed abstract class Address(val address: String)

HTH.

bjfletcher
  • 11,168
  • 4
  • 52
  • 67