I'm trying to refactor some Scala code in Eclipse and run into this compilation error:
value filter is not a member of java.util.Map
import java.io.File
import com.typesafe.config._
class ConfigLoader {
def parseFile( confFile : File) {
val conf = ConfigFactory.parseFile(confFile).root().unwrapped();
for((k,v) <- conf; (dk, dv) = (k, v.toString())) config.param += (dk -> dv);
}
(config is an object with "param" being a Map of String:String)
This code was pull exactly from Main() where it worked fine like so:
object Main extends Logging {
def main(args: Array[String]) {
//code cropped for readability.
//config.param["properties"] is absolute path to a passed-in properties file.
val conf = ConfigFactory.parseFile(new java.io.File(config.param("properties"))).root().unwrapped();
for((k,v) <- conf; (dk, dv) = (k, v.toString())) config.param+=(dk -> dv);
as you can see the code is exactly the same. I've imported the same libraries. All i'm doing different in main now is instantiating ConfigLoader
and calling it like so:
cfgLoader.parseFile(config.param("properties"))
Any ideas what's causing the error just by moving it to a class?
I've googled the error and it seems to be pretty generic.