Built-in Supported Types
PureConfig comes with baked-in support for many types, most of them from the standard Java and Scala libraries. When using those types, users don’t have to provide anything else in order to be able to load a config.
The currently supported basic types are:
String
,Boolean
,Double
(standard and percentage format ending with%
),Float
(also supporting percentage),Int
,Long
,Short
,Byte
,Char
,URL
,URI
,Duration
,FiniteDuration
;java.lang.Enum
;- everything in
java.time
(must be configured first - see Configurable Converters); java.io.File
;java.util.UUID
;java.nio.file.Path
;java.util.regex.Pattern
andscala.util.matching.Regex
;java.math.BigDecimal
,java.math.BigInteger
,scala.math.BigDecimal
, andscala.math.BigInt
;- Typesafe
ConfigValue
,ConfigObject
andConfigList
; - value classes (for which readers and writers of the inner type are directly used).
Additionally, PureConfig also handles the following collections and composite Scala structures:
Option
for optional values, i.e. values that can or cannot be in the configuration, of types on this list;- collections implementing the
TraversableOnce
trait, where the type of the elements is on this list; Map
s fromString
keys to any value type that is on this list;Map
s from types convertible toString
to any value type that is on this list (must be configured first - see Configurable Converters);shapeless.HList
s of elements whose type is on this list;- case classes;
- classes with only public
val
andvar
parameters in their constructor; - sealed families of case classes (ADTs).
Finally, on Scala 3 PureConfig has early support for native type class derivation. See Scala 3 Derivation for more details.
The support for these types already covers most simple cases, such as the one shown in Quick Start. See Supporting New Types to see how to support types that are not on those lists and Overriding Behavior for Types to change how PureConfig reads the built-in types above.