-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract SourceMatching out of Matching for more safety
- Loading branch information
1 parent
5d924ca
commit 41b5e0b
Showing
14 changed files
with
101 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
chimney/src/main/scala/io/scalaland/chimney/internal/runtime/Path.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
package io.scalaland.chimney.internal.runtime | ||
|
||
/** Represents the path passed into `withField*` methods. */ | ||
sealed abstract class Path | ||
object Path { | ||
|
||
/** Represents _ (anonymous argument) path. */ | ||
final class Root extends Path | ||
|
||
/** Represents $init.$fieldName path. */ | ||
final class Select[Init <: Path, FieldName <: String] extends Path | ||
|
||
/** Represents $init.matching[$Subtype] path BUT ALSO is used for `matchingSome`, `matchingLeft` and `matchingRight`. | ||
* | ||
* Currently there is some special casing - `.matchingSome`, `.matchingLeft` and `.matchingRight` not only matches | ||
* the subtype but also extracts the inner value AND running `_.option.matching[Some[A]].value` would NOT work. | ||
*/ | ||
final class Matching[Init <: Path, Subtype] extends Path | ||
|
||
/** Used only for withSealedSubtypeMatching to denote that type is matched on the source side!!! */ | ||
final class SourceMatching[Init <: Path, SourceSubtype] extends Path | ||
|
||
/** Represents $init.everyItem path. */ | ||
final class EveryItem[Init <: Path] extends Path | ||
|
||
/** Represents $init.everyMapKey path. */ | ||
final class EveryMapKey[Init <: Path] extends Path | ||
|
||
/** Represents $init.everyMapValue path. */ | ||
final class EveryMapValue[Init <: Path] extends Path | ||
} |