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.

    Definition Classes
    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).

  • object syntax

    Implicits for decoding Typesafe Config values and instances using circe decoders.

    Implicits for decoding Typesafe Config values and instances using circe decoders.

    In addition to syntax.durationDecoder and syntax.memorySizeDecoder for reading Typesafe Config specific value formats, this module also provides syntax.CirceConfigOps for decoding loaded configurations.

    Definition Classes
    config
    Example:
    1. scala> import io.circe.generic.auto._
      scala> import io.circe.config.syntax._
      scala> import scala.concurrent.duration.FiniteDuration
      scala> case class ServerSettings(port: Int, host: String, timeout: FiniteDuration)
      scala> val config = com.typesafe.config.ConfigFactory.parseString("port = 7357, host = localhost, timeout = 5 s")
      scala> config.as[ServerSettings]
      res0: Either[io.circe.Error, ServerSettings] = Right(ServerSettings(7357,localhost,5 seconds))
  • CirceConfigOps
c

io.circe.config.syntax

CirceConfigOps

implicit final class CirceConfigOps extends AnyVal

Enriches com.typesafe.config.Config instances with methods to decode to a specific type.

Source
syntax.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CirceConfigOps
  2. AnyVal
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new CirceConfigOps(config: Config)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toany2stringadd[CirceConfigOps] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (CirceConfigOps, B)
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toArrowAssoc[CirceConfigOps] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  6. def as[A](path: String)(implicit arg0: Decoder[A]): Either[Error, A]

    Read config settings at given path into the specified type.

  7. def as[A](implicit arg0: Decoder[A]): Either[Error, A]

    Read config settings into the specified type.

  8. def asF[F[_], A](path: String)(implicit arg0: Decoder[A], ev: ApplicativeError[F, Throwable]): F[A]

    Read config settings at given path into the specified type.

  9. def asF[F[_], A](implicit arg0: Decoder[A], ev: ApplicativeError[F, Throwable]): F[A]

    Read config settings into the specified type.

  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. val config: Config
  12. def ensuring(cond: (CirceConfigOps) => Boolean, msg: => Any): CirceConfigOps
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toEnsuring[CirceConfigOps] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (CirceConfigOps) => Boolean): CirceConfigOps
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toEnsuring[CirceConfigOps] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: => Any): CirceConfigOps
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toEnsuring[CirceConfigOps] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): CirceConfigOps
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toEnsuring[CirceConfigOps] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toStringFormat[CirceConfigOps] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  17. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def toString(): String
    Definition Classes
    Any

Deprecated Value Members

  1. def [B](y: B): (CirceConfigOps, B)
    Implicit
    This member is added by an implicit conversion from CirceConfigOps toArrowAssoc[CirceConfigOps] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from AnyVal

Inherited from Any

Inherited by implicit conversion any2stringadd fromCirceConfigOps to any2stringadd[CirceConfigOps]

Inherited by implicit conversion StringFormat fromCirceConfigOps to StringFormat[CirceConfigOps]

Inherited by implicit conversion Ensuring fromCirceConfigOps to Ensuring[CirceConfigOps]

Inherited by implicit conversion ArrowAssoc fromCirceConfigOps to ArrowAssoc[CirceConfigOps]

Ungrouped