diff options
Diffstat (limited to 'cask/src/cask/main/Decorators.scala')
-rw-r--r-- | cask/src/cask/main/Decorators.scala | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cask/src/cask/main/Decorators.scala b/cask/src/cask/main/Decorators.scala index e395d5b..dd445a4 100644 --- a/cask/src/cask/main/Decorators.scala +++ b/cask/src/cask/main/Decorators.scala @@ -9,7 +9,7 @@ import cask.model.{Request, Response} * Annotates a Cask endpoint that returns a HTTP [[Response]]; similar to a * [[Decorator]] but with additional metadata and capabilities. */ -trait Endpoint[InnerReturned] extends BaseEndpoint[InnerReturned] { +trait Endpoint[InnerReturned, Input] extends BaseEndpoint[InnerReturned, Input] { type OuterReturned = Router.Result[Response.Raw] } @@ -17,7 +17,7 @@ trait Endpoint[InnerReturned] extends BaseEndpoint[InnerReturned] { * An [[Endpoint]] that may return something else than a HTTP response, e.g. * a websocket endpoint which may instead return a websocket event handler */ -trait BaseEndpoint[InnerReturned] extends BaseDecorator[InnerReturned]{ +trait BaseEndpoint[InnerReturned, Input] extends BaseDecorator[InnerReturned, Input]{ /** * What is the path that this particular endpoint matches? */ @@ -55,10 +55,10 @@ trait BaseEndpoint[InnerReturned] extends BaseDecorator[InnerReturned]{ /** * A [[Decorator]] that may deal with values other than HTTP [[Response]]s */ -trait BaseDecorator[InnerReturned]{ - type Input +trait BaseDecorator[InnerReturned, Input]{ + final type InputTypeAlias = Input type InputParser[T] <: ArgReader[Input, T, Request] - type Delegate = Map[String, Input] => Router.Result[InnerReturned] + final type Delegate = Map[String, Input] => Router.Result[InnerReturned] type OuterReturned <: Router.Result[Any] def wrapFunction(ctx: Request, delegate: Delegate): OuterReturned def getParamParser[T](implicit p: InputParser[T]) = p @@ -75,10 +75,9 @@ trait BaseDecorator[InnerReturned]{ * to `wrapFunction`, which takes a `Map` representing any additional argument * lists (if any). */ -trait Decorator extends BaseDecorator[Response.Raw]{ +trait Decorator extends BaseDecorator[Response.Raw, Any]{ type OuterReturned = Router.Result[Response.Raw] - type Input = Any - type InputParser[T] = NoOpParser[Input, T] + type InputParser[T] = NoOpParser[Any, T] } class NoOpParser[Input, T] extends ArgReader[Input, T, Request] { |