java.lang.Object
io.helidon.config.ConfigMappers
Utility methods for converting configuration to Java types.
Note that this class defines many methods of the form <type> to<type>(String)
which are automatically registered with each Config.Builder
.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimal
toBigDecimal
(String stringValue) MapsstringValue
toBigDecimal
.static BigInteger
toBigInteger
(String stringValue) MapsstringValue
toBigInteger
.static Boolean
MapsstringValue
toboolean
.static Byte
MapsstringValue
tobyte
.static Calendar
toCalendar
(String stringValue) Deprecated.static Character
MapsstringValue
tochar
.static Charset
MapsstringValue
toCharset
.static Class<?>
MapsstringValue
toClass<?>
.static Date
Deprecated.Use one of the time API classes, such asInstant
orZonedDateTime
static Double
MapsstringValue
todouble
.static Duration
toDuration
(String stringValue) MapsstringValue
toDuration
.static File
MapsstringValue
toFile
.static Float
MapsstringValue
tofloat
.static GregorianCalendar
toGregorianCalendar
(String stringValue) Deprecated.use new time API, such asZonedDateTime
static Instant
MapsstringValue
toInstant
.static Integer
MapsstringValue
toint
.static LocalDate
toLocalDate
(String stringValue) MapsstringValue
toLocalDate
.static LocalDateTime
toLocalDateTime
(String stringValue) MapsstringValue
toLocalDateTime
.static LocalTime
toLocalTime
(String stringValue) MapsstringValue
toLocalTime
.static Long
MapsstringValue
tolong
.Transform all leaf nodes (values) into Map instance.static OffsetDateTime
toOffsetDateTime
(String stringValue) MapsstringValue
toOffsetDateTime
.static OffsetTime
toOffsetTime
(String stringValue) MapsstringValue
toOffsetTime
.static Path
MapsstringValue
toPath
.static Pattern
MapsstringValue
toPattern
.static Period
MapsstringValue
toPeriod
.static Properties
toProperties
(Config config) Transform all leaf nodes (values) into Properties instance.static Short
MapsstringValue
toshort
.static SimpleTimeZone
toSimpleTimeZone
(String stringValue) Deprecated.use new time API, such asZoneId
static TimeZone
toTimeZone
(String stringValue) Deprecated.use new time API, such asZoneId
static URI
MapsstringValue
toURI
.static URL
MapsstringValue
toURL
.static UUID
MapsstringValue
toUUID
.static ZonedDateTime
toZonedDateTime
(String stringValue) MapsstringValue
toZonedDateTime
.static ZoneId
MapsstringValue
toZoneId
.static ZoneOffset
toZoneOffset
(String stringValue) MapsstringValue
toZoneOffset
.
-
Method Details
-
toByte
MapsstringValue
tobyte
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
tobyte
-
toShort
MapsstringValue
toshort
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toshort
-
toInt
MapsstringValue
toint
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toint
-
toLong
MapsstringValue
tolong
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
tolong
-
toFloat
MapsstringValue
tofloat
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
tofloat
-
toDouble
MapsstringValue
todouble
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
todouble
-
toBoolean
MapsstringValue
toboolean
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toboolean
-
toChar
MapsstringValue
tochar
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
tochar
-
toClass
MapsstringValue
toClass<?>
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toClass<?>
-
toUUID
MapsstringValue
toUUID
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toUUID
-
toBigDecimal
MapsstringValue
toBigDecimal
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toBigDecimal
-
toBigInteger
MapsstringValue
toBigInteger
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toBigInteger
-
toFile
MapsstringValue
toFile
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toFile
-
toPath
MapsstringValue
toPath
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toPath
-
toCharset
MapsstringValue
toCharset
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toCharset
-
toPattern
MapsstringValue
toPattern
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toPattern
-
toUri
MapsstringValue
toURI
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toURI
-
toUrl
MapsstringValue
toURL
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toURL
-
toDate
Deprecated.Use one of the time API classes, such asInstant
orZonedDateTime
MapsstringValue
toDate
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toDate
- See Also:
-
toCalendar
Deprecated.use new time API, such asZonedDateTime
MapsstringValue
toCalendar
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toCalendar
- See Also:
-
toGregorianCalendar
Deprecated.use new time API, such asZonedDateTime
MapsstringValue
toGregorianCalendar
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toGregorianCalendar
- See Also:
-
toLocalDate
MapsstringValue
toLocalDate
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toLocalDate
- See Also:
-
toLocalTime
MapsstringValue
toLocalTime
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toLocalTime
- See Also:
-
toLocalDateTime
MapsstringValue
toLocalDateTime
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toLocalDateTime
- See Also:
-
toZonedDateTime
MapsstringValue
toZonedDateTime
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toZonedDateTime
- See Also:
-
toZoneId
MapsstringValue
toZoneId
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toZoneId
- See Also:
-
toZoneOffset
MapsstringValue
toZoneOffset
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toZoneOffset
- See Also:
-
toTimeZone
Deprecated.use new time API, such asZoneId
MapsstringValue
toTimeZone
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toTimeZone
- See Also:
-
toSimpleTimeZone
Deprecated.use new time API, such asZoneId
MapsstringValue
toSimpleTimeZone
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toSimpleTimeZone
- See Also:
-
toInstant
MapsstringValue
toInstant
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toInstant
- See Also:
-
toOffsetDateTime
MapsstringValue
toOffsetDateTime
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toOffsetDateTime
- See Also:
-
toOffsetTime
MapsstringValue
toOffsetTime
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toOffsetTime
- See Also:
-
toDuration
MapsstringValue
toDuration
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toDuration
- See Also:
-
toPeriod
MapsstringValue
toPeriod
.- Parameters:
stringValue
- source value as aString
- Returns:
- mapped
stringValue
toPeriod
- See Also:
-
toMap
Transform all leaf nodes (values) into Map instance.Fully qualified key of config node is used as a key in returned Map.
Detach
config node before transforming to Map in case you want to cut current Config node key prefix.Let's say we work with following configuration:
app: name: Example 1 page-size: 20 logging: app.level = INFO level = WARNING
Mapapp1
contains two keys:app.name
,app.page-size
.Map<String, String> app1 = ConfigMappers.toMap(config.get("app"));
Detaching
app
config node returns new Config instance with "reset" local root.
MapMap<String, String> app2 = ConfigMappers.toMap(config.get("app").detach());
app2
contains two keys withoutapp
prefix:name
,page-size
.- Parameters:
config
- config node used to transform into Properties- Returns:
- new Map instance that contains all config leaf node values
- See Also:
-
toProperties
Transform all leaf nodes (values) into Properties instance.Fully qualified key of config node is used as a key in returned Properties.
Detach
config node before transforming to Properties in case you want to cut current Config node key prefix.Let's say we work with following configuration:
app: name: Example 1 page-size: 20 logging: app.level = INFO level = WARNING
Propertiesapp1
contains two keys:app.name
,app.page-size
.Properties app1 = ConfigMappers.toProperties(config.get("app"));
Detaching
app
config node returns new Config instance with "reset" local root.Properties app2 = ConfigMappers.toProperties(config.get("app").detach());
Propertiesapp2
contains two keys withoutapp
prefix:name
,page-size
.- Parameters:
config
- config node used to transform into Properties- Returns:
- Properties instance that contains all config leaf node values.
- See Also:
-
ZonedDateTime