-
Notifications
You must be signed in to change notification settings - Fork 6
Parsers
Javier Diaz edited this page Aug 19, 2018
·
4 revisions
A parser is what knows how to convert from ConfigObject
to T
where T
is any type. It is really simple:
object IntParser : Parser<Int> {
override fun parse(value: ConfigObject, type: Class<*>, parser: Parser<*>?): Int {
return value.asString().toInt()
}
}
After that, register your parser in Parsers
class, method addParser()
List of the types supported out of the box:
- Int
- Long
- Double
- Short
- Float
- Double
- Byte
- String
- Boolean
- List
- Set
- Enum
- BigInteger
- BigDecimal
- LocalDateTime
- LocalDate
- ZonedDateTime
- OffsetDateTime
- OffsetTime
- Calendar
- Date
- URI
- URL
- File
- Path
- Class<*>
- Regex
- Pattern
- InetAddress
- Connection
- Driver
- UUID