A Scala library that allows copying a case class using a dynamic property name.
dynamic is available for the JVM Runtime using Scala 2.12, 2.13.
Add as a dependency:
libraryDependencies +="io.github.reugn"%%"dynamic"% versionBuild from source:
sbt clean +packagecaseclassFoo(i: Int, s: String)
caseclassBar(f: Foo, b: Boolean)
caseclassBaz(b: Bar, i1: Int, i2: Int, s2: String)
importio.github.reugn.dynamic.copyvalfoo=Foo(1, "str")
valbar=Bar(foo, b =false)
valbaz=Baz(bar, 4, 5, "str2")
valnew_bar=Bar(Foo(10, "str10"), b =true)
valcopied_baz= copy(baz, "b", new_bar)
copied_baz.b shouldBe new_barLicensed under the Apache 2.0 License.