I have a case class in a Scala application, and a static function which I prefer to write within that class, as it makes the best sense. This is the class:
case class At (
date : DateTime,
id : String,
location : Coordinate
)
{
...
def getParsedValues(line : String) : At =
{
val mappedFields : Array[String] = Utils.splitFields(line)
val atObject = new At(mappedFields)
return atObject;
}
...
}
And then from another Scala object, I would like to call the method getParsedValues()
as static method:
object Reader{
...
var atObject = At.getParsedValues(line)
...
}
But it get an error value getParsedEvent is not a member of object At
How can I make it work? Thanks