Packages

  • package root
    Definition Classes
    root
  • package io
    Definition Classes
    root
  • package circe
    Definition Classes
    io
  • package config

    circe-config: A Typesafe config wrapper powered by circe.

    circe-config: A Typesafe config wrapper powered by circe.

    Example:
    1. scala> import com.typesafe.config.ConfigFactory
      scala> import io.circe.generic.auto._
      scala> import io.circe.config.syntax._
      
      scala> case class ServerSettings(host: String, port: Int, ssl: Option[String])
      scala> case class HttpSettings(server: ServerSettings, version: Double)
      scala> case class AppSettings(http: HttpSettings)
      
      scala> val config = ConfigFactory.parseString("http { version = 1.1, server { host = localhost, port = 8080 } }")
      
      scala> config.as[ServerSettings]("http.server")
      res0: Either[io.circe.Error, ServerSettings] = Right(ServerSettings(localhost,8080,None))
      
      scala> config.as[HttpSettings]("http")
      res1: Either[io.circe.Error, HttpSettings] = Right(HttpSettings(ServerSettings(localhost,8080,None),1.1))
      
      scala> config.as[AppSettings]
      res2: Either[io.circe.Error, AppSettings] = Right(AppSettings(HttpSettings(ServerSettings(localhost,8080,None),1.1)))
      
      scala> import cats.effect.IO
      scala> config.asF[IO, AppSettings]
      res3: IO[AppSettings] = IO(AppSettings(HttpSettings(ServerSettings(localhost,8080,None),1.1)))
      
      scala> import io.circe.config.parser
      scala> val settings = parser.decodeF[IO, AppSettings]()
      scala> settings.unsafeRunSync()
      res4: AppSettings = AppSettings(HttpSettings(ServerSettings(localhost,8080,None),1.1))
    Note

    Limitations for numerical types: Typesafe config uses Java's int, long and double types to represent numbers. In some cases, double values may be represented internally as long after a roundtrip since the HOCON formatting is not stable. Also, precision may be lost when converting from circe's JsonNumber to Typesafe config's number representation (as can be seen in the test for the printer laws).

p

io

circe

package circe

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. circe
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package config

    circe-config: A Typesafe config wrapper powered by circe.

    circe-config: A Typesafe config wrapper powered by circe.

    Example:
    1. scala> import com.typesafe.config.ConfigFactory
      scala> import io.circe.generic.auto._
      scala> import io.circe.config.syntax._
      
      scala> case class ServerSettings(host: String, port: Int, ssl: Option[String])
      scala> case class HttpSettings(server: ServerSettings, version: Double)
      scala> case class AppSettings(http: HttpSettings)
      
      scala> val config = ConfigFactory.parseString("http { version = 1.1, server { host = localhost, port = 8080 } }")
      
      scala> config.as[ServerSettings]("http.server")
      res0: Either[io.circe.Error, ServerSettings] = Right(ServerSettings(localhost,8080,None))
      
      scala> config.as[HttpSettings]("http")
      res1: Either[io.circe.Error, HttpSettings] = Right(HttpSettings(ServerSettings(localhost,8080,None),1.1))
      
      scala> config.as[AppSettings]
      res2: Either[io.circe.Error, AppSettings] = Right(AppSettings(HttpSettings(ServerSettings(localhost,8080,None),1.1)))
      
      scala> import cats.effect.IO
      scala> config.asF[IO, AppSettings]
      res3: IO[AppSettings] = IO(AppSettings(HttpSettings(ServerSettings(localhost,8080,None),1.1)))
      
      scala> import io.circe.config.parser
      scala> val settings = parser.decodeF[IO, AppSettings]()
      scala> settings.unsafeRunSync()
      res4: AppSettings = AppSettings(HttpSettings(ServerSettings(localhost,8080,None),1.1))
    Note

    Limitations for numerical types: Typesafe config uses Java's int, long and double types to represent numbers. In some cases, double values may be represented internally as long after a roundtrip since the HOCON formatting is not stable. Also, precision may be lost when converting from circe's JsonNumber to Typesafe config's number representation (as can be seen in the test for the printer laws).

Deprecated Type Members

  1. type ArrayEncoder[A] = AsArray[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use Encoder.AsArray

  2. type ObjectEncoder[A] = AsObject[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use Encoder.AsObject

  3. type RootEncoder[A] = AsRoot[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use Encoder.AsRoot

Deprecated Value Members

  1. val ArrayEncoder: AsArray.type
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use Encoder.AsArray

  2. val ObjectEncoder: AsObject.type
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use Encoder.AsObject

  3. val RootEncoder: AsRoot.type
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use Encoder.AsRoot

Inherited from AnyRef

Inherited from Any

Ungrouped