final class PatcherDefinition[A, Patch, Overrides <: PatcherOverrides, Flags <: PatcherFlags] extends PatcherFlagsDsl[[Flags1]PatcherDefinition[A, Patch, Overrides, Flags1], Flags] with PatcherDefinitionCommons[[Overrides1]PatcherDefinition[A, Patch, Overrides1, Flags]] with WithRuntimeDataStore
Allows customization of io.scalaland.chimney.Patcher derivation.
- A
type of object to apply patch to
- Patch
type of patch object
- Overrides
type-level encoded config
- Flags
type-level encoded flags
- Since
0.8.0
- Alphabetic
- By Inheritance
- PatcherDefinition
- WithRuntimeDataStore
- PatcherDefinitionCommons
- PatcherFlagsDsl
- PatcherPatchedValueFlagsDsl
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new PatcherDefinition()
- new PatcherDefinition(runtimeData: RuntimeDataStore)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def appendCollectionInPatch: PatcherDefinition[A, Patch, Overrides, Enable[AppendCollectionInPatch, Flags]]
In case when both object to patch and patch value contain field with a collection, this option allows to append value from patch to the source value, rather than overriding it.
In case when both object to patch and patch value contain field with a collection, this option allows to append value from patch to the source value, rather than overriding it.
By default, patch's collection overrides the content of a field.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#appending-to-collection-instead-of-replacing-it for more details
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- macro def buildPatcher[ImplicitScopeFlags <: PatcherFlags](implicit pc: PatcherConfiguration[ImplicitScopeFlags]): Patcher[A, Patch]
Build Patcher using current configuration.
Build Patcher using current configuration.
It runs macro that tries to derive instance of
Patcher[From, To]. When transformation can't be derived, it results with compilation error.- returns
io.scalaland.chimney.Patcher type class instance
- Since
0.8.0
- def castedTarget: Any
- Attributes
- protected
- Definition Classes
- PatcherPatchedValueFlagsDsl
- def clearOnNoneInPatch: PatcherDefinition[A, Patch, Overrides, Disable[IgnoreNoneInPatch, Flags]]
When scala.Option is patching scala.Option, on scala.None value will be cleared.
When scala.Option is patching scala.Option, on scala.None value will be cleared.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
0.8.0
- See also
https://chimney.readthedocs.io/supported-patching/#treating-none-as-no-update-instead-of-set-to-none for more details
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def disableMacrosLogging: PatcherDefinition[A, Patch, Overrides, Disable[MacrosLogging, Flags]]
Disable printing the logs from the derivation process.
Disable printing the logs from the derivation process.
- Definition Classes
- PatcherFlagsDsl
- Since
0.8.0
- See also
https://chimney.readthedocs.io/troubleshooting/#debugging-macros for more details
- def enableMacrosLogging: PatcherDefinition[A, Patch, Overrides, Enable[MacrosLogging, Flags]]
Enable printing the logs from the derivation process.
Enable printing the logs from the derivation process.
- Definition Classes
- PatcherFlagsDsl
- Since
0.8.0
- See also
https://chimney.readthedocs.io/troubleshooting/#debugging-macros for more details
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def failRedundantPatcherFields: PatcherDefinition[A, Patch, Overrides, Disable[IgnoreRedundantPatcherFields, Flags]]
Fail the compilation if there is a redundant field in patching object.
Fail the compilation if there is a redundant field in patching object.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
0.8.0
- See also
https://chimney.readthedocs.io/supported-patching/#ignoring-fields-in-patches for more details
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def ignoreLeftInPatch: PatcherDefinition[A, Patch, Overrides, Enable[IgnoreLeftInPatch, Flags]]
In case when both object to patch and patch value contain field of type scala.Either, this option allows to treat scala.Left value in patch as if the value was not provided.
In case when both object to patch and patch value contain field of type scala.Either, this option allows to treat scala.Left value in patch as if the value was not provided.
By default, when scala.Left is delivered in patch, Chimney used this new value.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#treating-left-as-no-update-instead-of-set-to-left for more details
- def ignoreNoneInPatch: PatcherDefinition[A, Patch, Overrides, Enable[IgnoreNoneInPatch, Flags]]
In case when both object to patch and patch value contain field of type scala.Option, this option allows to treat scala.None value in patch as if the value was not provided.
In case when both object to patch and patch value contain field of type scala.Option, this option allows to treat scala.None value in patch as if the value was not provided.
By default, when scala.None is delivered in patch, Chimney clears the value of such field on patching.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
0.4.0
- See also
https://chimney.readthedocs.io/supported-patching/#treating-none-as-no-update-instead-of-set-to-none for more details
- def ignoreRedundantPatcherFields: PatcherDefinition[A, Patch, Overrides, Enable[IgnoreRedundantPatcherFields, Flags]]
In case that patch object contains a redundant field (i.e.
In case that patch object contains a redundant field (i.e. field that is not present in patched object type), this option enables ignoring value of such fields and generate patch successfully.
By default, when Chimney detects a redundant field in patch object, it fails the compilation in order to prevent silent oversight of field name typos.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
0.4.0
- See also
https://chimney.readthedocs.io/supported-patching/#ignoring-fields-in-patches for more details
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def overrideCollectionInPatch: PatcherDefinition[A, Patch, Overrides, Disable[AppendCollectionInPatch, Flags]]
When collection is patching collection, the value will be simply overriden.
When collection is patching collection, the value will be simply overriden.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#appending-to-collection-instead-of-replacing-it for more details
- val runtimeData: RuntimeDataStore
Runtime storage for values and functions that Patcher definition is customized with.
Runtime storage for values and functions that Patcher definition is customized with.
- Definition Classes
- PatcherDefinition → PatcherDefinitionCommons
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def useLeftOnLeftInPatch: PatcherDefinition[A, Patch, Overrides, Disable[IgnoreLeftInPatch, Flags]]
When scala.Either is patching scala.Either, on scala.Left value will be overrides.
When scala.Either is patching scala.Either, on scala.Left value will be overrides.
- Definition Classes
- PatcherPatchedValueFlagsDsl
- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#treating-left-as-no-update-instead-of-set-to-left for more details
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- macro def withFieldComputed[T, U](selectorObj: (A) => T, f: (Patch) => U)(implicit ev: <:<[U, T]): PatcherDefinition[A, Patch, _ <: PatcherOverrides, Flags]
Use the function
fto compute a value of the field picked using theselectorObj.Use the function
fto compute a value of the field picked using theselectorObj.By default, if
Patchis missing a field, the originalA's field value is taken.- T
type of patched value field
- U
type of computed value
- selectorObj
patched value field in
A, defined like_.name- f
function used to compute value of the target field
- returns
- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#updating-field-with-a-computed-value for more details
- macro def withFieldComputedFrom[S, T, U](selectorPatch: (Patch) => S)(selectorObj: (A) => T, f: (S) => U)(implicit ev: <:<[U, T]): PatcherDefinition[A, Patch, _ <: PatcherOverrides, Flags]
Use the function
fto compute a value of the field picked using theselectorObjfrom a value extracted withselectorPatchas an input.Use the function
fto compute a value of the field picked using theselectorObjfrom a value extracted withselectorPatchas an input.By default, if
Patchis missing a field, the originalA's field value is taken.- S
type of patch field
- T
type of patched value field
- U
type of computed value
- selectorPatch
patch field in
Patch, defined like_.name- selectorObj
patched value field in
A, defined like_.name- f
function used to compute value of the target field
- returns
- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#updating-field-with-a-computed-value for more details
- macro def withFieldConst[T, U](selectorObj: (A) => T, value: U)(implicit ev: <:<[U, T]): PatcherDefinition[A, Patch, _ <: PatcherOverrides, Flags]
Use the
valueprovided here for the field picked using theselectorObj.Use the
valueprovided here for the field picked using theselectorObj.By default, if
Patchis missing a field, the originalA's field value is taken.- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#updating-field-with-a-provided-value for more details
- macro def withFieldIgnored[T](selectorPatch: (Patch) => T): PatcherDefinition[A, Patch, _ <: PatcherOverrides, Flags]
Mark
Patchfield as expected to be ignored, so that the orignial value would be used.Mark
Patchfield as expected to be ignored, so that the orignial value would be used.- T
type of patch field
- selectorPatch
patch field in
Patch, defined like_.originalName- returns
- Since
1.7.0
- See also
https://chimney.readthedocs.io/supported-patching/#ignoring-fields-in-patches for more details
- macro def withPatchedValueFlag[T](selectorObj: (A) => T): OfPatcherDefinition[A, Patch, Overrides, Flags, _ <: Path]
Define a flag only on some source value using the
selectorTo, rather than globally.Define a flag only on some source value using the
selectorTo, rather than globally.- T
type of the target field
- selectorObj
patched value field in
A, defined like_.name- returns
io.scalaland.chimney.dsl.PatcherPatchedValueFlagsDsl.OfPatcherDefinition
- Since
1.7.0
- See also
https://chimney.readthedocs.io/cookbook/#constraining-flags-to-a-specific-fieldsubtype for more details