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 BigDecimaltoBigDecimal(String stringValue) MapsstringValuetoBigDecimal.static BigIntegertoBigInteger(String stringValue) MapsstringValuetoBigInteger.static BooleanMapsstringValuetoboolean.static ByteMapsstringValuetobyte.static CalendartoCalendar(String stringValue) Deprecated.static CharacterMapsstringValuetochar.static CharsetMapsstringValuetoCharset.static Class<?> MapsstringValuetoClass<?>.static DateDeprecated.Use one of the time API classes, such asInstantorZonedDateTimestatic DoubleMapsstringValuetodouble.static DurationtoDuration(String stringValue) MapsstringValuetoDuration.static FileMapsstringValuetoFile.static FloatMapsstringValuetofloat.static GregorianCalendartoGregorianCalendar(String stringValue) Deprecated.use new time API, such asZonedDateTimestatic InstantMapsstringValuetoInstant.static IntegerMapsstringValuetoint.static LocalDatetoLocalDate(String stringValue) MapsstringValuetoLocalDate.static LocalDateTimetoLocalDateTime(String stringValue) MapsstringValuetoLocalDateTime.static LocalTimetoLocalTime(String stringValue) MapsstringValuetoLocalTime.static LongMapsstringValuetolong.Transform all leaf nodes (values) into Map instance.static OffsetDateTimetoOffsetDateTime(String stringValue) MapsstringValuetoOffsetDateTime.static OffsetTimetoOffsetTime(String stringValue) MapsstringValuetoOffsetTime.static PathMapsstringValuetoPath.static PatternMapsstringValuetoPattern.static PeriodMapsstringValuetoPeriod.static PropertiestoProperties(Config config) Transform all leaf nodes (values) into Properties instance.static ShortMapsstringValuetoshort.static SimpleTimeZonetoSimpleTimeZone(String stringValue) Deprecated.use new time API, such asZoneIdstatic TimeZonetoTimeZone(String stringValue) Deprecated.use new time API, such asZoneIdstatic URIMapsstringValuetoURI.static URLMapsstringValuetoURL.static UUIDMapsstringValuetoUUID.static ZonedDateTimetoZonedDateTime(String stringValue) MapsstringValuetoZonedDateTime.static ZoneIdMapsstringValuetoZoneId.static ZoneOffsettoZoneOffset(String stringValue) MapsstringValuetoZoneOffset.
-
Method Details
-
toByte
MapsstringValuetobyte.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetobyte
-
toShort
MapsstringValuetoshort.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoshort
-
toInt
MapsstringValuetoint.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoint
-
toLong
MapsstringValuetolong.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetolong
-
toFloat
MapsstringValuetofloat.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetofloat
-
toDouble
MapsstringValuetodouble.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetodouble
-
toBoolean
MapsstringValuetoboolean.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoboolean
-
toChar
MapsstringValuetochar.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetochar
-
toClass
MapsstringValuetoClass<?>.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoClass<?>
-
toUUID
MapsstringValuetoUUID.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoUUID
-
toBigDecimal
MapsstringValuetoBigDecimal.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoBigDecimal
-
toBigInteger
MapsstringValuetoBigInteger.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoBigInteger
-
toFile
MapsstringValuetoFile.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoFile
-
toPath
MapsstringValuetoPath.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoPath
-
toCharset
MapsstringValuetoCharset.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoCharset
-
toPattern
MapsstringValuetoPattern.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoPattern
-
toUri
MapsstringValuetoURI.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoURI
-
toUrl
MapsstringValuetoURL.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoURL
-
toDate
Deprecated.Use one of the time API classes, such asInstantorZonedDateTimeMapsstringValuetoDate.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoDate - See Also:
-
toCalendar
Deprecated.use new time API, such asZonedDateTimeMapsstringValuetoCalendar.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoCalendar - See Also:
-
toGregorianCalendar
Deprecated.use new time API, such asZonedDateTimeMapsstringValuetoGregorianCalendar.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoGregorianCalendar - See Also:
-
toLocalDate
MapsstringValuetoLocalDate.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoLocalDate - See Also:
-
toLocalTime
MapsstringValuetoLocalTime.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoLocalTime - See Also:
-
toLocalDateTime
MapsstringValuetoLocalDateTime.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoLocalDateTime - See Also:
-
toZonedDateTime
MapsstringValuetoZonedDateTime.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoZonedDateTime - See Also:
-
toZoneId
MapsstringValuetoZoneId.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoZoneId - See Also:
-
toZoneOffset
MapsstringValuetoZoneOffset.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoZoneOffset - See Also:
-
toTimeZone
Deprecated.use new time API, such asZoneIdMapsstringValuetoTimeZone.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoTimeZone - See Also:
-
toSimpleTimeZone
Deprecated.use new time API, such asZoneIdMapsstringValuetoSimpleTimeZone.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoSimpleTimeZone - See Also:
-
toInstant
MapsstringValuetoInstant.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoInstant - See Also:
-
toOffsetDateTime
MapsstringValuetoOffsetDateTime.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoOffsetDateTime - See Also:
-
toOffsetTime
MapsstringValuetoOffsetTime.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoOffsetTime - See Also:
-
toDuration
MapsstringValuetoDuration.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoDuration - See Also:
-
toPeriod
MapsstringValuetoPeriod.- Parameters:
stringValue- source value as aString- Returns:
- mapped
stringValuetoPeriod - 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.
Detachconfig 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 = WARNINGMapapp1contains two keys:app.name,app.page-size.Map<String, String> app1 = ConfigMappers.toMap(config.get("app"));Detachingappconfig node returns new Config instance with "reset" local root.
MapMap<String, String> app2 = ConfigMappers.toMap(config.get("app").detach());app2contains two keys withoutappprefix: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.
Detachconfig 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 = WARNINGPropertiesapp1contains two keys:app.name,app.page-size.Properties app1 = ConfigMappers.toProperties(config.get("app"));Detachingappconfig node returns new Config instance with "reset" local root.Properties app2 = ConfigMappers.toProperties(config.get("app").detach());Propertiesapp2contains two keys withoutappprefix: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