Conditional

final case class Conditional[Page, Props](condition: Function0[Boolean], underlying: RoutingRule[Page, Props], otherwise: Page => Option[Action[Page, Props]]) extends RoutingRule[Page, Props]
trait Serializable
trait Product
trait Equals
trait RoutingRule[Page, Props]
class Object
trait Matchable
class Any

Value members

Concrete methods

override def modPath(onCreate: Path => Path, onParse: Path => Option[Path]): RoutingRule[Page, Props]
Definition Classes
override def pmapF[W](f: Page => W)(g: W => Option[Page]): RoutingRule[W, Props]
Definition Classes
override def xmap[A](f: Page => A)(g: A => Page): RoutingRule[A, Props]
Definition Classes

Inherited methods

final def addCondition[G[_]](condition: G[Boolean])(implicit G: Sync[G]): RoutingRule[Page, Props]

Prevent this rule from functioning unless some condition holds.

Prevent this rule from functioning unless some condition holds.

Value parameters:
condition

Sync[Unit] that requested page and returns true if the page should be rendered.

Inherited from:
RoutingRule
final def addConditionBy[G[_]](condition: Page => G[Boolean])(implicit G: Sync[G]): RoutingRule[Page, Props]

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.

Value parameters:
condition

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

Inherited from:
RoutingRule
final def addConditionWithFallback[G[_]](condition: G[Boolean], fallback: Action[Page, Props])(implicit G: Sync[G]): RoutingRule[Page, Props]

Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, a fallback action is performed.

Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, a fallback action is performed.

Value parameters:
condition

Sync[Unit] that requested page and returns true if the page should be rendered.

fallback

Response when rule matches but condition doesn't hold.

Inherited from:
RoutingRule
final def addConditionWithFallbackBy[G[_]](condition: Page => G[Boolean], fallback: Action[Page, Props])(implicit G: Sync[G]): RoutingRule[Page, Props]

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, a fallback action is performed.

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, a fallback action is performed.

Value parameters:
condition

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

fallback

Response when rule matches but condition doesn't hold.

Inherited from:
RoutingRule
final def addConditionWithOptionalFallback[G[_]](condition: G[Boolean], fallback: Option[Action[Page, Props]])(implicit G: Sync[G]): RoutingRule[Page, Props]

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

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

Value parameters:
condition

Sync[Unit] that requested page and returns true if the page should be rendered.

fallback

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.

Inherited from:
RoutingRule
final def addConditionWithOptionalFallback[G[_]](condition: G[Boolean], fallback: Page => Option[Action[Page, Props]])(implicit G: Sync[G]): RoutingRule[Page, Props]

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

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

Value parameters:
condition

Sync[Unit] that requested page and returns true if the page should be rendered.

fallback

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.

Inherited from:
RoutingRule
final def addConditionWithOptionalFallbackBy[G[_]](condition: Page => G[Boolean], fallback: Option[Action[Page, Props]])(implicit G: Sync[G]): RoutingRule[Page, Props]

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 optional fallback action may be performed.

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 optional fallback action may be performed.

Value parameters:
condition

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

fallback

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.

Inherited from:
RoutingRule
final def addConditionWithOptionalFallbackBy[G[_]](condition: Page => G[Boolean], fallback: Page => Option[Action[Page, Props]])(implicit G: Sync[G]): RoutingRule[Page, Props]

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 optional fallback action may be performed.

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 optional fallback action may be performed.

Value parameters:
condition

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

fallback

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.

Inherited from:
RoutingRule
final def autoCorrect(redirectVia: SetRouteVia): RoutingRule[Page, Props]

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.

Inherited from:
RoutingRule
final def autoCorrect: RoutingRule[Page, Props]
Inherited from:
RoutingRule
final def fallback(fallbackPath: Page => Path, fallbackAction: (Path, Page) => Action[Page, Props]): WithFallback[Page, Props]

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

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

Inherited from:
RoutingRule
final def noFallback: WithFallback[Page, Props]

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.

Inherited from:
RoutingRule
final def pmap[W](f: Page => W)(pf: PartialFunction[W, Page]): RoutingRule[W, Props]
Inherited from:
RoutingRule
final def pmapCT[W](f: Page => W)(implicit ct: ClassTag[Page]): RoutingRule[W, Props]
Inherited from:
RoutingRule
final def prefixPath(prefix: String): RoutingRule[Page, Props]

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.

Inherited from:
RoutingRule
final def prefixPath_/(prefix: String): RoutingRule[Page, Props]

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.

Inherited from:
RoutingRule
def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product
final def widen[W >: Page](pf: PartialFunction[W, Page]): RoutingRule[W, Props]
Inherited from:
RoutingRule
final def widenCT[W >: Page](implicit ct: ClassTag[Page]): RoutingRule[W, Props]
Inherited from:
RoutingRule
final def widenF[W >: Page](f: W => Option[Page]): RoutingRule[W, Props]
Inherited from:
RoutingRule
final def |(that: RoutingRule[Page, Props]): RoutingRule[Page, Props]

Compose rules.

Compose rules.

Inherited from:
RoutingRule