Say I have a trait:
trait Foo {
def getFoo: Int
def setFoo(i: Int): Unit
}
I would like to wrap all methods of this trait (and others), without actually specifying all the signatures again.
Something like:
class LoggingWrapper[T](wrappedInstance: T) extends T {
// what to do here if I wanted to log every call to methods in T
// without redefining the signatures?
}
Logging is just a simple usecase, others would be adding timeouts, memoizing/caching etc.
How would I do this in Scala 2.11? Runtime reflection? Compiler macro?