PatcherUsing

io.scalaland.chimney.dsl.PatcherUsing
final class PatcherUsing[A, Patch, Overrides <: PatcherOverrides, Flags <: PatcherFlags](val obj: A, val objPatch: Patch, val pd: PatcherDefinition[A, Patch, Overrides, Flags]) extends WithRuntimeDataStore

Provides operations to customize io.scalaland.chimney.Patcher logic for specific object value and patch value.

Type parameters

A

type of object to apply patch to

Flags

type-level encoded flags

Overrides

type-level encoded config

Patch

type of patch object

Value parameters

obj

object to patch

objPatch

patch object

pd

patcher definition

Attributes

Since

0.4.0

Graph
Supertypes
trait WithRuntimeDataStore
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(obj: A, objPatch: Patch)

Concrete methods

inline def patch[ImplicitScopeFlags <: PatcherFlags](using tc: PatcherConfiguration[ImplicitScopeFlags]): A

Applies configured patching in-place.

Applies configured patching in-place.

Attributes

Returns

patched value

Since

0.4.0

transparent inline def withFieldComputed[T, U](inline selectorObj: A => T, inline f: Patch => U)(using U <:< T): PatcherUsing[A, Patch, _ <: PatcherOverrides, Flags]

Use the function f to compute a value of the field picked using the selectorObj.

Use the function f to compute a value of the field picked using the selectorObj.

By default, if Patch is missing a field, the original A's field value is taken.

Type parameters

T

type of patched value field

U

type of computed value

Value parameters

f

function used to compute value of the target field

selectorObj

patched value field in A, defined like _.name

Attributes

Returns

io.scalaland.chimney.dsl.PatcherDefinition

See also
Since

1.7.0

transparent inline def withFieldComputedFrom[S, T, U](inline selectorPatch: Patch => S)(inline selectorObj: A => T, inline f: S => U)(using U <:< T): PatcherUsing[A, Patch, _ <: PatcherOverrides, Flags]

Use the function f to compute a value of the field picked using the selectorObj from a value extracted with selectorPatch as an input.

Use the function f to compute a value of the field picked using the selectorObj from a value extracted with selectorPatch as an input.

By default, if Patch is missing a field, the original A's field value is taken.

Type parameters

S

type of patch field

T

type of patched value field

U

type of computed value

Value parameters

f

function used to compute value of the target field

selectorObj

patched value field in A, defined like _.name

selectorPatch

patch field in Patch, defined like _.name

Attributes

Returns

io.scalaland.chimney.dsl.PatcherUsing

See also
Since

1.7.0

transparent inline def withFieldConst[T, U](inline selectorObj: A => T, value: U)(using U <:< T): PatcherUsing[A, Patch, _ <: PatcherOverrides, Flags]

Use the value provided here for the field picked using the selectorObj.

Use the value provided here for the field picked using the selectorObj.

By default, if Patch is missing a field, the original A's field value is taken.

Attributes

Returns

io.scalaland.chimney.dsl.PatcherUsing

See also
Since

1.7.0

transparent inline def withFieldIgnored[T](inline selectorPatch: Patch => T): PatcherUsing[A, Patch, _ <: PatcherOverrides, Flags]

Mark `Patch`` field as expected to be ignored, so that the orignial value would be used.

Mark `Patch`` field as expected to be ignored, so that the orignial value would be used.

Type parameters

T

type of patch field

Value parameters

selectorPatch

patch field in Patch, defined like _.originalName

Attributes

Returns

io.scalaland.chimney.dsl.PatcherUsing

See also
Since

1.7.0

transparent inline def withPatchedValueFlag[T](inline selectorObj: A => T): OfPatcherUsing[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.

Type parameters

T

type of the target field

Value parameters

selectorObj

patched value field in A, defined like _.name

Attributes

Returns

io.scalaland.chimney.dsl.PatcherPatchedValueFlagsDsl.OfPatcherUsing

See also
Since

1.7.0

Inherited methods

def appendCollectionInPatch: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][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.

Attributes

See also
Since

1.7.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)
def clearOnNoneInPatch: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][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.

Attributes

See also
Since

0.8.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)
def disableMacrosLogging: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][Disable[MacrosLogging, Flags]]

Disable printing the logs from the derivation process.

Disable printing the logs from the derivation process.

Attributes

See also
Since

0.8.0

Inherited from:
PatcherFlagsDsl (hidden)
def enableMacrosLogging: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][Enable[MacrosLogging, Flags]]

Enable printing the logs from the derivation process.

Enable printing the logs from the derivation process.

Attributes

See also
Since

0.8.0

Inherited from:
PatcherFlagsDsl (hidden)
def failRedundantPatcherFields: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][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.

Attributes

See also
Since

0.8.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)
def ignoreLeftInPatch: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][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.

Attributes

See also
Since

1.7.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)
def ignoreNoneInPatch: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][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.

Attributes

See also
Since

0.4.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)
def ignoreRedundantPatcherFields: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][Enable[IgnoreRedundantPatcherFields, Flags]]

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.

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.

Attributes

See also
Since

0.4.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)
def overrideCollectionInPatch: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][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.

Attributes

See also
Since

1.7.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)
def useLeftOnLeftInPatch: [Flags1 <: PatcherFlags] =>> PatcherUsing[A, Patch, Overrides, Flags1][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.

Attributes

See also
Since

1.7.0

Inherited from:
PatcherPatchedValueFlagsDsl (hidden)

Concrete fields

val obj: A
val objPatch: Patch
val pd: PatcherDefinition[A, Patch, Overrides, Flags]