trait QueryParameters[Q, A] extends AnyRef
- Alphabetic
- By Inheritance
- QueryParameters
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
createParams(q: Q): Map[String, Param]
Generate a map of parameters representing the argument
q.Generate a map of parameters representing the argument
q.matchParamsandcreateParamsshould be (functional) inverse of each other. That is,this.matchParams(this.createParams(q)) == Right(ParamMathOutput(q, Map()))(this property is called "LeftInverse" in the tests) -
abstract
def
matchParams(params: Map[String, Param]): Either[A, ParamMatchOutput[Q]]
Tries to match the map of urldsl.vocabulary.Params to create an instance of
Q.Tries to match the map of urldsl.vocabulary.Params to create an instance of
Q. If it can not, it returns an error indicating the reason of the failure. If it could, it returns the value ofQ, as well as the list of unused parameters.- params
The map of urldsl.vocabulary.Param to match this path segment again.
- returns
The "de-serialized" element with unused parameters, if successful.
For example, if you try to match a param "name" as String and "age" as Int, calling matchParams on Map("name" -> Param(List("Alice")), "age" -> Param(List("24"), "year" -> Param(List("2020"))) will return Right(ParamMatchOutput(("Alice", 24), Map("year" -> Param(List("2020")))
Example:
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
&[R](that: QueryParameters[R, A])(implicit ev: Tupler[Q, R]): QueryParameters[Out, A]
Adds
thatQueryParameters tothisone, "tupling" the returned type with the implicit urldsl.language.TuplerAdds
thatQueryParameters tothisone, "tupling" the returned type with the implicit urldsl.language.TuplerThe matching and writing of strings is functionally commutative under
&, but the returned typeQis not. So, if you have two parameters, one matching an Int and the other one a String, depending on the order in which&is called, you can end up with "Q = (Int, String)" or "Q = (String, Int)". This property is called "QuasiCommutativity" in the tests. -
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
?: QueryParameters[Option[Q], A]
When these query parameters return an error, transform it to None instead.
When these query parameters return an error, transform it to None instead.
This should be used to represent (possibly) missing parameters.
-
final
def
as[R](implicit codec: Codec[Q, R]): QueryParameters[R, A]
Casts this QueryParameters to the new type R.
Casts this QueryParameters to the new type R. Note that the urldsl.vocabulary.Codec must be an exception-free bijection between Q and R.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- final def createParamsString[Generator <: UrlStringGenerator](q: Q)(implicit generator: Generator): String
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
filter(predicate: (Q) ⇒ Boolean)(implicit ev: =:=[DummyError, A]): QueryParameters[Q, A]
Sugar for when
A =:= DummyError. -
final
def
filter(predicate: (Q) ⇒ Boolean, error: (Map[String, Param]) ⇒ A): QueryParameters[Q, A]
Adds an extra satisfying criteria to the output of this QueryParameters.
Adds an extra satisfying criteria to the output of this QueryParameters. If the output satisfies the given
predicate, then it is left unchanged. Otherwise, it returns the givenerror.Note that it doesn't check that arguments given to
createParamssatisfy this predicate // todo[behaviour]: should that change?- predicate
the additional predicate that the output must satisfy
- error
the generated error in case it does not satisfy it
- returns
a new QueryParameters instance with the same types
param[Int]("age").filter(_ >= 0, (params: Map[String, Param]) => someError(params))
Example: -
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def matchQueryString(queryString: String, decoder: UrlStringDecoder = UrlStringDecoder.defaultDecoder): Either[A, Q]
- def matchRawUrl(url: String, urlStringParserGenerator: UrlStringParserGenerator = ...): Either[A, Q]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()