I want to create a factory object with the given method method, which would create the base case class - here is an example code
object DeptEntry { def apply(url: String, fullName: String, address: String, city: String): DeptEntry = { new DeptEntry(url.toLowerCase, fullName.toLowerCase, address.toLowerCase, city.toLowerCase) } } case class DeptEntry private(url: String, fullName: String, address: String, city: String) { }
The problem is that the apply method in the constructor of the object class and case have the same list of parameters. Therefore, the compiler gives me this error:
method apply is defined twice conflicting symbols both originated in file 'DeptEntry.scala' case class DeptEntry private(url: String, fullName: String, ^
Is there any solution to this problem?
thanks a lot
source share