How to get a list with the Typesafe config library

Martin

I'm trying in Scala to get a list from a config file like something.conf with TypeSafe.

In something.conf I set the parameter:

mylist=["AA","BB"]

and in my Scala code I do:

val myList = modifyConfig.getStringList("mylist")

Simple configuration parameters works fine but could somebody give me an example of how to extract a list?

0__

As @ghik notes, the Typesafe Config library is Java based, so you get a java.util.List[String] instead of a scala.List[String]. So either you make a conversion to a scala.List:

import collection.JavaConversions._
val myList = modifyConfig.getStringList("mylist").toList

Or (probably less awkward) you look for a Scala library. The tools wiki links at least to these maintained libraries:

(Disclaimer: I don't use these, so you will have to check that they support your types and format)

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Typesafe Config环境变量

来自分类Dev

如何覆盖Typesafe Config设置?

来自分类Dev

Typesafe Config:从src / test / resources加载配置

来自分类Dev

从Typesafe Config实例化案例类

来自分类Dev

Typesafe config:如何遍历配置项

来自分类Dev

由Typesafe Config支持的Spring Environment

来自分类Dev

Typesafe config:如何遍历配置项

来自分类Dev

Typesafe Config-reference.conf的不同行为?

来自分类Dev

如何在Typesafe Config中获取未包装的密钥?

来自分类Dev

Typesafe config HOCON - 列表的环境变量替换指南?

来自分类Dev

typesafe.config - 外部配置文件不起作用

来自分类Dev

项目目录结构中Typesafe Config文件的标准位置是什么?

来自分类Dev

合并多个TypeSafe Config文件并仅在它们全部合并后再解析

来自分类Dev

我如何创建一个ConfigValue代表Typesafe.Config中的一个对象

来自分类Dev

我如何创建一个ConfigValue代表Typesafe.Config中的一个对象

来自分类Dev

scala / typesafe Config是否提供某种方式来配置特征的可插入实现?

来自分类Dev

How to get the deltas of a list collection

来自分类Dev

java.lang.NoClassDefFoundError: 在 STS 中运行 akka-quickstart-java 时出现 com/typesafe/config/Config

来自分类Dev

How to get a value from keyvalue pair list?

来自分类Dev

How to get file path + file name into a list?

来自分类Dev

How to get list of latest tags in remote git?

来自分类Dev

在dotnet核心中,对config.GetSection()。Get <List <object >>的调用不会将值加载到对象中

来自分类Dev

覆盖get_config(Codeigniter)

来自分类Dev

语法检查〜/ .config / mimeapps.list

来自分类Dev

〜/ .config / mimeapps.list中的评论

来自分类Dev

How can I get a list of PHP errors occurred in a page?

来自分类Dev

How to get and set Local Variable List for a process in JBPM 6?

来自分类Dev

how to get the list of all table of a key space in cassandra

来自分类Dev

How to get list of packages used in a knitr .Rnw document?

Related 相关文章

  1. 1

    Typesafe Config环境变量

  2. 2

    如何覆盖Typesafe Config设置?

  3. 3

    Typesafe Config:从src / test / resources加载配置

  4. 4

    从Typesafe Config实例化案例类

  5. 5

    Typesafe config:如何遍历配置项

  6. 6

    由Typesafe Config支持的Spring Environment

  7. 7

    Typesafe config:如何遍历配置项

  8. 8

    Typesafe Config-reference.conf的不同行为?

  9. 9

    如何在Typesafe Config中获取未包装的密钥?

  10. 10

    Typesafe config HOCON - 列表的环境变量替换指南?

  11. 11

    typesafe.config - 外部配置文件不起作用

  12. 12

    项目目录结构中Typesafe Config文件的标准位置是什么?

  13. 13

    合并多个TypeSafe Config文件并仅在它们全部合并后再解析

  14. 14

    我如何创建一个ConfigValue代表Typesafe.Config中的一个对象

  15. 15

    我如何创建一个ConfigValue代表Typesafe.Config中的一个对象

  16. 16

    scala / typesafe Config是否提供某种方式来配置特征的可插入实现?

  17. 17

    How to get the deltas of a list collection

  18. 18

    java.lang.NoClassDefFoundError: 在 STS 中运行 akka-quickstart-java 时出现 com/typesafe/config/Config

  19. 19

    How to get a value from keyvalue pair list?

  20. 20

    How to get file path + file name into a list?

  21. 21

    How to get list of latest tags in remote git?

  22. 22

    在dotnet核心中,对config.GetSection()。Get <List <object >>的调用不会将值加载到对象中

  23. 23

    覆盖get_config(Codeigniter)

  24. 24

    语法检查〜/ .config / mimeapps.list

  25. 25

    〜/ .config / mimeapps.list中的评论

  26. 26

    How can I get a list of PHP errors occurred in a page?

  27. 27

    How to get and set Local Variable List for a process in JBPM 6?

  28. 28

    how to get the list of all table of a key space in cassandra

  29. 29

    How to get list of packages used in a knitr .Rnw document?

热门标签

归档