Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
e21b49e2
Commit
e21b49e2
authored
Jul 27, 2015
by
Peter van 't Hof
Browse files
Better support for sets
parent
9605d702
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/ConfigUtils.scala
View file @
e21b49e2
...
...
@@ -267,6 +267,22 @@ object ConfigUtils extends Logging {
any2list
(
any
).
map
(
_
.
toString
)
}
/** Convert Any to List[Any], fallback on list with 1 value */
def
any2set
(
any
:
Any
)
:
Set
[
Any
]
=
{
if
(
any
==
null
)
return
null
any
match
{
case
s
:
Set
[
_
]
=>
s
.
toSet
case
l
:
List
[
_
]
=>
l
.
toSet
case
_
=>
Set
(
any
)
}
}
/** Convert Any to List[String] */
def
any2stringSet
(
any
:
Any
)
:
Set
[
String
]
=
{
if
(
any
==
null
)
return
null
any2set
(
any
).
map
(
_
.
toString
)
}
/** Convert Any to List[File] */
def
any2fileList
(
any
:
Any
)
:
List
[
File
]
=
{
if
(
any
==
null
)
return
null
...
...
@@ -414,7 +430,7 @@ object ConfigUtils extends Logging {
/** Convert ConfigValue to Set[String] */
implicit
def
configValue2stringSet
(
value
:
ConfigValue
)
:
Set
[
String
]
=
{
if
(
requiredValue
(
value
))
any2string
Lis
t
(
value
.
value
)
.
toSet
if
(
requiredValue
(
value
))
any2string
Se
t
(
value
.
value
)
else
Set
()
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment