From b0e32c659e334b334e3f1e1a835328b32f20e759 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Fri, 10 Nov 2017 04:15:47 -0800 Subject: Kill `Router.main` annotation and make routing dependent on the `Command` return type --- core/src/main/scala/forge/discover/Router.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'core/src/main/scala/forge/discover/Router.scala') diff --git a/core/src/main/scala/forge/discover/Router.scala b/core/src/main/scala/forge/discover/Router.scala index 2c92d847..1034b46e 100644 --- a/core/src/main/scala/forge/discover/Router.scala +++ b/core/src/main/scala/forge/discover/Router.scala @@ -16,7 +16,6 @@ import scala.language.experimental.macros */ object Router{ class doc(s: String) extends StaticAnnotation - class main extends StaticAnnotation def generateRoutes[T]: Seq[Router.EntryPoint[T]] = macro generateRoutesImpl[T] def generateRoutesImpl[T: c.WeakTypeTag](c: Context): c.Expr[Seq[EntryPoint[T]]] = { import c.universe._ @@ -385,7 +384,7 @@ class Router [C <: Context](val c: C) { def getAllRoutesForClass(curCls: Type): Iterable[c.universe.Tree] = { for{ t <- getValsOrMeths(curCls) - if t.annotations.exists(_.tpe =:= typeOf[Router.main]) + if t.returnType <:< typeOf[forge.define.Command[_]] } yield { extractMethod(t, curCls) } -- cgit v1.2.3