object Router
More or less a minimal version of Autowire's Server that lets you generate a set of "routes" from the methods defined in an object, and call them using passing in name/args/kwargs via Java reflection, without having to generate/compile code or use Scala reflection. This saves us spinning up the Scala compiler and greatly reduces the startup time of cached scripts.
- Alphabetic
- By Inheritance
- Router
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class ArgSig[T, V](name: String, typeString: String, doc: Option[String], default: Option[(T) => V])(implicit reads: Read[V]) extends Product with Serializable
Models what is known by the router about a single argument: that it has a name, a human-readable typeString describing what the type is (just for logging and reading, not a replacement for a
TypeTag
) and possible a function that can compute its default value - case class EntryPoint[T](name: String, argSignatures: Seq[ArgSig[T, _]], doc: Option[String], varargs: Boolean, invoke0: (T, Map[String, String], Seq[String], Seq[ArgSig[T, _]]) => Result[Any], overrides: Int) extends Product with Serializable
What is known about a single endpoint for our routes.
What is known about a single endpoint for our routes. It has a name, argSignatures for each argument, and a macro-generated invoke0 that performs all the necessary argument parsing and de-serialization.
Realistically, you will probably spend most of your time calling invoke instead, which provides a nicer API to call it that mimmicks the API of calling a Scala method.
- type FailAll = Either[Seq[ParamError], Seq[Any]]
- type FailMaybe = Either[Seq[ParamError], Any]
- case class Overrides(value: Int) extends Product with Serializable
Allows you to query how many things are overriden by the enclosing owner.
- sealed trait Result[+T] extends AnyRef
Represents what comes out of an attempt to invoke an EntryPoint.
Represents what comes out of an attempt to invoke an EntryPoint. Could succeed with a value, but could fail in many different ways.
- class doc extends Annotation with StaticAnnotation
- class main extends Annotation with StaticAnnotation
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- macro def generateRoutes[T]: Seq[EntryPoint[T]]
- def generateRoutesImpl[T](c: Context)(implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.blackbox.Context.Expr[Seq[EntryPoint[T]]]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def makeReadCall(dict: Map[String, String], default: => Option[Any], arg: ArgSig[_, _]): FailMaybe
- def makeReadVarargsCall(arg: ArgSig[_, _], values: Seq[String]): Either[Seq[ParamError], Seq[Any]]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def read(dict: Map[String, String], default: => Option[Any], arg: ArgSig[_, _], thunk: (String) => Any): FailMaybe
- def readVarargs(arg: ArgSig[_, _], values: Seq[String], thunk: (String) => Any): Either[Seq[ParamError], Seq[Any]]
- def stripDashes(s: String): String
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tryEither[T](t: => T, error: (Throwable) => ParamError): Either[ParamError, T]
- def validate(args: Seq[FailMaybe]): Result[Seq[Any]]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object Overrides extends Serializable
- object Result
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.