diff options
author | Kseniya Tomskikh <ktomskikh@driver.xyz> | 2018-10-08 17:56:10 +0800 |
---|---|---|
committer | Kseniya Tomskikh <ktomskikh@driver.xyz> | 2018-10-08 17:56:10 +0800 |
commit | de97eebf217f9e934decdb80bc840b9e1365a890 (patch) | |
tree | a94b26b9b4ff07163fc451f82f785a8357521371 /src/main/scala/xyz/driver/core/rest/directives/PathMatchers.scala | |
parent | 60ad2abd17a50c8bd73bfe75084984b4de27bd79 (diff) | |
download | driver-core-de97eebf217f9e934decdb80bc840b9e1365a890.tar.gz driver-core-de97eebf217f9e934decdb80bc840b9e1365a890.tar.bz2 driver-core-de97eebf217f9e934decdb80bc840b9e1365a890.zip |
Created GenericId and typized id classes
Diffstat (limited to 'src/main/scala/xyz/driver/core/rest/directives/PathMatchers.scala')
-rw-r--r-- | src/main/scala/xyz/driver/core/rest/directives/PathMatchers.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/rest/directives/PathMatchers.scala b/src/main/scala/xyz/driver/core/rest/directives/PathMatchers.scala index 183ad9a..8ba184f 100644 --- a/src/main/scala/xyz/driver/core/rest/directives/PathMatchers.scala +++ b/src/main/scala/xyz/driver/core/rest/directives/PathMatchers.scala @@ -27,6 +27,12 @@ trait PathMatchers { } } + def UuidIdInPath[T]: PathMatcher1[UuidId[T]] = + AkkaPathMatchers.JavaUUID.map((id: UUID) => UuidId[T](id)) + + def NumericIdInPath[T]: PathMatcher1[NumericId[T]] = + AkkaPathMatchers.LongNumber.map((id: Long) => NumericId[T](id)) + def NameInPath[T]: PathMatcher1[Name[T]] = new PathMatcher1[Name[T]] { def apply(path: Path) = path match { case Path.Segment(segment, tail) => Matched(tail, Tuple1(Name[T](segment))) |