Package: org.apache.groovy.transform.copywith

## [Java] Class NestedCopyWithSupport

- org.apache.groovy.transform.copywith.NestedCopyWithSupport

-     @Incubating
      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.

  Since:
    6.0.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static Object` | `applyBlock(Object self, Closure<?> block)` Transactional-block form.
    `` | `public static Map<Object, Object>` | `flatten(Object self, Map<Object, Object> raw)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### public static Object applyBlock(Object self, Closure<?> block)

      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.

    - #### public static Map<Object, Object> flatten(Object self, Map<Object, Object> raw)