trait PathSegment[T, A] extends AnyRef

Represents a part of the path string of an URL, containing an information of type T, or an error of type A.

T

type represented by this PathSegment

A

type of the error that this PathSegment produces on "illegal" url paths.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PathSegment
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def createSegments(t: T): List[Segment]

    Generate a list of segments representing the argument t.

    Generate a list of segments representing the argument t.

    matchSegments and createSegments should be (functional) inverse of each other. That is, this.matchSegments(this.createSegments(t)) == Right(PathMathOutput(t, Nil))

  2. abstract def matchSegments(segments: List[Segment]): Either[A, PathMatchOutput[T]]

    Tries to match the list of urldsl.vocabulary.Segments to create an instance of T.

    Tries to match the list of urldsl.vocabulary.Segments to create an instance of T. If it can not, it returns an error indicating the reason of the failure. If it could, it returns the value of T, as well as the list of unused segments.

    segments

    The list of urldsl.vocabulary.Segment to match this path segment again.

    returns

    The "de-serialized" element with unused segment, if successful.

    Example:
    1. For example, a segment that matches simply a String in the first segment, when giving segments like List(Segment("hello"), Segment("3")) will return Right(PathMatchOutput("hello", List(Segment("3")))

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def /[U](that: PathSegment[U, A])(implicit ev: Tupler[T, U]): PathSegment[Out, A]

    Concatenates this PathSegment with that one, "tupling" the types with the Tupler rules.

  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def ?[ParamsType, QPError](params: QueryParameters[ParamsType, QPError]): PathSegmentWithQueryParams[T, A, ParamsType, QPError]
  6. final def as[U](implicit codec: Codec[T, U]): PathSegment[U, A]

    Casts this PathSegment to the new type U.

    Casts this PathSegment to the new type U. Note that the urldsl.vocabulary.Codec must be an exception-free bijection between T and U.

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  9. final def createPath[Generator <: UrlStringGenerator]()(implicit ev: =:=[Unit, T], generator: Generator): String

    Sugar when T =:= Unit

  10. def createPath[Generator <: UrlStringGenerator](t: T)(implicit generator: Generator): String

    Concatenates the segments generated by createSegments

  11. final def createSegments()(implicit ev: =:=[Unit, T]): List[Segment]

    Sugar when T =:= Unit

  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  14. final def filter(predicate: (T) => Boolean)(implicit ev: =:=[DummyError, A]): PathSegment[T, A]

    Sugar for when A =:= DummyError

  15. final def filter(predicate: (T) => Boolean, error: (List[Segment]) => A): PathSegment[T, A]

    Adds an extra satisfying criteria to the de-serialized output of this PathSegment.

    Adds an extra satisfying criteria to the de-serialized output of this PathSegment.

    The new de-serialization works as follows: - if the initial de-serialization fails, then it returns the generated error - otherwise, if the de-serialized element satisfies the predicate, then it returns the element - if the predicate is false, generates the given error by feeding it the segments that it tried to match.

    This can be useful in, among others, two scenarios: - enforce bigger restriction on a segment (e.g., from integers to positive integer, regex match...) - in a multi-part segment, ensure consistency between the different component (e.g., a range of two integers that should not be too large...)

  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def matchPath(path: String, decoder: UrlStringDecoder = UrlStringDecoder.defaultDecoder): Either[A, T]
  21. def matchRawUrl(url: String, urlStringParserGenerator: UrlStringParserGenerator = UrlStringParserGenerator.defaultUrlStringParserGenerator): Either[A, T]

    Matches the given raw url using the implicit UrlStringParser of type UrlParser.

    Matches the given raw url using the implicit UrlStringParser of type UrlParser.

    This method doesn't return the information about the remaining unused segments. The thought leading to this is that PathMatchOutput are supposed to be internal mechanics, while this method is supposed to be the exposed interface the this PathSegment.

    url

    the url to parse

    urlStringParserGenerator

    the UrlStringParserGenerator used to create the UrlStringParser that will actually parse the url to create the segments. The urldsl.url.JavaNetUrlGenerator is often a good choice on both the JVM and JS (which are currently the two only targeted platforms)

    returns

    the output contained in the url, or the error is something fails.

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  30. final def ||[U](that: PathSegment[U, A]): PathSegment[Either[T, U], A]

    Builds a PathSegment that first tries to match with this one, then tries to match with that one.

    Builds a PathSegment that first tries to match with this one, then tries to match with that one. If both fail, the error of the second is returned (todo[behaviour]: should that change?)

Inherited from AnyRef

Inherited from Any

Ungrouped