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

me.jeffshaw.digitalocean.Inet4AddressSerializer.scala Maven / Gradle / Ivy

package me.jeffshaw.digitalocean

import java.net.{Inet4Address, InetAddress}

import org.json4s.CustomSerializer
import org.json4s.JsonAST.JString

private[digitalocean] case object Inet4AddressSerializer extends CustomSerializer[Inet4Address](format =>
  (
    {
      case JString(ip) =>
        InetAddress.getByName(ip).asInstanceOf[Inet4Address]
    },
    {
      case address: Inet4Address =>
        JString(address.getHostAddress)
    }
  )
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy