Packages

final case class Rule[Page](parse: (Path) ⇒ Option[Parsed[Page]], path: (Page) ⇒ Option[Path], action: (Path, Page) ⇒ Option[Action[Page]]) extends Product with Serializable

A single routing rule. Intended to be composed with other Rules. When all rules are composed, this is turned into a Rules instance.

Page

The type of legal pages.

parse

Attempt to parse a given path.

path

Attempt to determine the path for some page.

action

Attempt to determine the action when a route resolves to some page.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Rule
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Rule(parse: (Path) ⇒ Option[Parsed[Page]], path: (Page) ⇒ Option[Path], action: (Path, Page) ⇒ Option[Action[Page]])

    parse

    Attempt to parse a given path.

    path

    Attempt to determine the path for some page.

    action

    Attempt to determine the action when a route resolves to some page.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val action: (Path, Page) ⇒ Option[Action[Page]]
  5. def addCondition(cond: (Page) ⇒ CallbackTo[Boolean])(condUnmet: (Page) ⇒ Option[Action[Page]]): Rule[Page]

    Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context.

    Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context. When the condition doesn't hold, an alternative action may be performed.

    cond

    Function that takes the requested page and returns true if the page should be rendered.

    condUnmet

    Response when rule matches but condition doesn't hold. If response is None it will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.

  6. def addCondition(cond: CallbackTo[Boolean])(condUnmet: (Page) ⇒ Option[Action[Page]]): Rule[Page]

    Prevent this rule from functioning unless some condition holds.

    Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an alternative action may be performed.

    condUnmet

    Response when rule matches but condition doesn't hold. If response is None it will be as if this rule doesn't exist and will likely end in the route-not-found fallback behaviour.

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def autoCorrect(redirectMethod: Method): Rule[Page]

    When a route matches a page, compare its Path to what the route would generate for the same page and if they differ, redirect to the generated one.

    When a route matches a page, compare its Path to what the route would generate for the same page and if they differ, redirect to the generated one.

    Example: If a route matches /issue/dev-23 and returns a Page("DEV", 23) for which the generate path would be /issue/DEV-23, this would automatically redirect /issue/dev-23 to /issue/DEV-23, and process /issue/DEV-23 normally using its associated action.

  9. def autoCorrect: Rule[Page]

    See autoCorrect().

  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def fallback(fp: (Page) ⇒ Path, fa: (Path, Page) ⇒ Action[Page]): Rules[Page]

    Specify behaviour when a Page doesn't have an associated Path or Action.

  13. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def modPath(add: (Path) ⇒ Path, remove: (Path) ⇒ Option[Path]): Rule[Page]

    Modify the path(es) generated and parsed by this rule.

  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def noFallback: Rules[Page]

    When a Page doesn't have an associated Path or Action, throw a runtime error.

    When a Page doesn't have an associated Path or Action, throw a runtime error.

    This is the trade-off for keeping the parsing and generation of known Pages in sync - compiler proof of Page exhaustiveness is sacrificed.

    It is recommended that you call RouterConfig.verify as a sanity-check.

  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. val parse: (Path) ⇒ Option[Parsed[Page]]
  22. val path: (Page) ⇒ Option[Path]
  23. def pmap[W](f: (Page) ⇒ W)(pf: PartialFunction[W, Page]): Rule[W]
  24. def pmapCT[W](f: (Page) ⇒ W)(implicit ct: ClassTag[Page]): Rule[W]
  25. def pmapF[W](f: (Page) ⇒ W)(g: (W) ⇒ Option[Page]): Rule[W]
  26. def prefixPath(prefix: String): Rule[Page]

    Add a prefix to the path(es) generated and parsed by this rule.

  27. def prefixPath_/(prefix: String): Rule[Page]

    Add a prefix to the path(es) generated and parsed by this rule.

    Add a prefix to the path(es) generated and parsed by this rule.

    Unlike prefixPath() when the suffix is non-empty, a slash is added between prefix and suffix.

  28. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  32. def widen[W >: Page](pf: PartialFunction[W, Page]): Rule[W]
  33. def widenCT[W >: Page](implicit ct: ClassTag[Page]): Rule[W]
  34. def widenF[W >: Page](f: (W) ⇒ Option[Page]): Rule[W]
  35. def xmap[A](f: (Page) ⇒ A)(g: (A) ⇒ Page): Rule[A]
  36. def |(that: Rule[Page]): Rule[Page]

    Compose rules.

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped