@Incubating
@GroovyABI(since = "6.0.0")
public final class NestedCopyWithSupport
extends Object
Runtime support for nested-path copyWith. Resolves dotted keys such
as 'address.city' into a flat map of top-level property to its
replacement value, by recursively applying copyWith to the affected
nested nodes. Plain (non-dotted) keys pass through unchanged.
A nested node whose type does not provide copyWith(Map) fails with
a clear, specific error rather than silent or partial behaviour. Identity
is preserved transitively: an unchanged nested node yields its original
reference, so an unchanged graph yields the original root.
Transactional-block form. Runs block against a recording
delegate that captures plain assignments, nested-path navigation, and
prop.modify { old -> ... } updates, then delegates to the
(nested-aware) copyWith(Map). The block is thus pure sugar over
the map form, inheriting its closed-type-domain and identity guarantees.
Flattens dotted copyWith keys against self. A null
raw map yields an empty map. A key with no dot is copied
through. A key head.rest is grouped under head, and
the current value of that property is replaced by calling
copyWith on it with the remaining entries. Using one name
both as a whole value and as a dotted path is rejected. A null
nested value, a Class value, or a value that does not answer
copyWith(Map) is rejected as well.
self - object whose nested properties are copiedraw - plain and dotted keys supplied to copyWith