I have got a class with many methods.
class C{
def f1(x:String,....):...=..
def f2(..)...
.
.
.
}
I want now that every method defined in my class is decorated with a trait of my choice automatically.
Something like to create a tricky implicit ore something what decorates every method and perhaps returns an instance of the class with decorated methods. Perhaps wrapped or modified or something. I can not describe more of the way because i dont know the way.
Do you know a way to do that?
Methods are not functions, although they will automatically be lifted when you pass them to a method that requires a function. See also http://jim-mcbeath.blogspot.com/2009/05/scala-functions-vs-methods.html
If you really have functions:
and you want them to mix in a trait, like:
the only way I can think of is submit your class to something like Scala-Refactoring: http://scala-refactoring.org/