You can use a type alias to define a type constructor like this:
type Context[A,B,C,D] = Mapper[A,B,C,D]#Context
def setup(ctx: Context[_,_,_,_]) = println(ctx)
Alternatively you can refer to mapper as an existential type:
def setup(ctx: Mapper[A,B,C,D]#Context forSome { type A; type B; type C; type D})
EDIT:
As Kris pointed out that setup() is defined in Mapper and overridden in your subclass a possible solution would rather look something like this:
trait SMapper[A,B,C,D] extends Mapper[A,B,C,D] {
type Base = Mapper[A,B,C,D]
type Ctx = Base#Context
}
// Now use it:
class M extends SMapper[String,Int,Int,String] {
override def setup(ctx: Ctx) { println("setup..."); }
}
EDIT 2: After you changed your description I had a look at appengine-mapreduce and this definitely works:
class TestMapper extends AppEngineMapper[Key, Entity, NullWritable, NullWritable] {
type Ctx = Mapper[Key, Entity, NullWritable, NullWritable]#Context
override def setup(ctx: Ctx) {}
}
Moritz
2010-07-26 00:18:27