Derivation configuration
Derivation configuration
used for grouping new derivation if target of annotation has nested case class
new derivation class name
define which fields have to be excluded from new derivation
define how to rename fields during derivation
Macro creates new structure in companion object for @see dev.nigredo.derivation.Derivation according to configuration.
Macro creates new structure in companion object for @see dev.nigredo.derivation.Derivation according to configuration.
@Derive(Def("Bar", "MyNewCaseClass")) case class Foo(value: Int) object Foo { object Bar { case class MyNewCaseClass(value: Int) } } @Derive(Def("Bar", "MyNewCaseClass", List("value")) case class Foo(value: Int, value2: String) object Foo { object Bar { case class MyNewCaseClass(value2: String) } } @Derive(Def("Bar", "MyNewCaseClass", List("value"), List("value2" -> "renamedValue2")) case class Foo(value: Int, value2: String) object Foo { object Bar { case class MyNewCaseClass(renamedValue2: String) } }
If macro is applied to sealed trait then trait SealedDerivation will be created in companion object as a phantom type.
@Derive("Bar", "MyDerivedClass") sealed trait Foo object Foo { object Bar { sealed trait SealedDerivation } }
Value classes will be simplified during application
case class FooAnyVal(value: String) extends AnyVal @Derive(Def("Bar", "MyNewCaseClass")) case class Foo(value: FooAnyVal) object Foo { object Bar { case class MyNewCaseClass(value: String) } }
Restriction: All data structure has to be define in top level.
Base simple implementation for Derivation.
Base simple implementation for Derivation. Take derivation name A and case class B and produce derivation A from B
Store annotation params between macros