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

endless.core.protocol.EntityIDCodec.scala Maven / Gradle / Ivy

There is a newer version: 0.31.0
Show newest version
package endless.core.protocol

/** Encode/decode entity IDs to/from strings
  * @tparam ID
  *   entity id
  */
trait EntityIDCodec[ID] extends EntityIDEncoder[ID] with EntityIDDecoder[ID]

object EntityIDCodec {
  def apply[ID](encoder: ID => String, decoder: String => ID): EntityIDCodec[ID] =
    new EntityIDCodec[ID] {
      override def encode(id: ID): String = encoder(id)
      override def decode(str: String): ID = decoder(str)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy