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 urldsl.language.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](fromTToU: (T) => U, fromUToT: (U) => T): PathSegment[U, A]

    Casts this PathSegment to the new type U.

    Casts this PathSegment to the new type U. The conversion functions should form an exception-free bijection between T and U (or at least an embedding, if you know that you are doing).

  7. 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 (or at least an embedding, if you know that you are doing).

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

    Sugar when T =:= Unit

  12. def createPath(t: T, encoder: UrlStringGenerator = UrlStringGenerator.default): String

    Concatenates the segments generated by createSegments

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

    Sugar when T =:= Unit

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

    Sugar for when A =:= DummyError

  17. 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 urldsl.language.PathSegment.

    Adds an extra satisfying criteria to the de-serialized output of this urldsl.language.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...)

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

    Matches the given raw url using the given urldsl.url.UrlStringParserGenerator for creating a urldsl.url.UrlStringParser.

    Matches the given raw url using the given urldsl.url.UrlStringParserGenerator for creating a urldsl.url.UrlStringParser.

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

    url

    the url to parse. It has to be a well formed URL, otherwise this could raise an exception, depending on the provided urldsl.url.UrlStringParserGenerator.

    urlStringParserGenerator

    the urldsl.url.UrlStringParserGenerator used to create the urldsl.url.UrlStringParser that will actually parse the url to create the segments. The default one is usually a good choice. It has different implementations in JVM and JS, but they *should* behave the same way.

    returns

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

  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  32. 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