Commit 398ce3a
Add TransformedNamesComparison.IgnorePrefix name comparison
Adds a base `IgnorePrefix(prefix)` comparison that matches a source name to
a target name after stripping a fixed prefix from the source side. This is
common for code-generated types such as Protobuf enums whose variants repeat
the enum name as a prefix.
`IgnorePrefix` is intentionally not `sealed` so downstream code can extend it
(`case object Foo extends TransformedNamesComparison.IgnorePrefix("Foo")`),
which is the documented usage; a test object defined in another file guards
this. Ships with unit tests and a user-facing entry in
supported-transformations.md.
Co-authored-by: Mateusz Kubuszok <mateusz.kubuszok@gmail.com>1 parent ca63484 commit 398ce3a
3 files changed
Lines changed: 36 additions & 1 deletion
File tree
- chimney/src
- main/scala/io/scalaland/chimney/dsl
- test/scala/io/scalaland/chimney
- docs/docs
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
113 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6227 | 6227 | | |
6228 | 6228 | | |
6229 | 6229 | | |
| 6230 | + | |
| 6231 | + | |
| 6232 | + | |
| 6233 | + | |
| 6234 | + | |
6230 | 6235 | | |
6231 | | - | |
| 6236 | + | |
6232 | 6237 | | |
6233 | 6238 | | |
6234 | 6239 | | |
| |||
0 commit comments