I am using typesafe config to read some initial configurations.
Is there a way to check if a part of key is present in the type config. For example I have the below config:
foo {
bar {
x = 42
y = 92
}
}
Here I want to check if my conf contains any configuration for foo.bar I don't care if x
or y
both are present of either one is present.
I just want to check if configuration for bar is present in config. Is it possible?
Config has method for checking if a path exists
config.hasPath("foo.bar");
Given the following
foo {
bar {
x = 42
}
}
System.out.println(config.hasPath("foo.bar"));
System.out.println(config.hasPath("foo.bar.x"));
I get
true
true
If I remove x = 42
I get
true
false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With