Does Scala offer a way to "proxy" or "decorate" a function without repeating the argument list?

Viewed 763

I have a class with the (admittedly stupid) name Application. There is also a class ApplicationRepository that features a private save(Application) method.

I would like to add a method to ApplicationRepository that creates an Application instance (from exactly the constructor parameters) and saves it. I do not want to expose save or use a parameter of type Application.

def createApplication(firstDay:String, lastDay:String, details:String, substitute:User, projectManager:User) = {
  val a = Application(firstDay, lastDay, details, substitute, projectManager)
  save(a)
}

Basically my question boils down to:

In Scala - can I create a "proxy" function with the same parameter list as a "proxied" function, pass all the arguments without caring about them, and then do different stuff?

3 Answers
Related