Package: org.apache.groovy.transform.copywith

## [Java] Class CopyWithRecorder

- org.apache.groovy.transform.copywith.CopyWithRecorder

-     @Incubating
      public class CopyWithRecorder
      extends GroovyObjectSupport

  Recording delegate for the transactional `copyWith {` } block. It does not mutate anything: property assignments and `prop.modify {` } calls are recorded as a (possibly dotted) path-keyed map which is then handed to the nested-aware `copyWith(Map)` for reconstruction.

  Reads of a property return a child recorder bound to the extended path, so `address.city = 'NYC'` records `'address.city'`.

  The reserved name `old` resolves to the original (root) object — aligning with the `old` of `@Ensures`/`@Contract` in design-by-contract — so a value may be derived from the pre-state: `address.city = old.address.city.reverse()` or, cross-field, `name = old.company.name`. The concise single-field shorthand `address.city.modify { it.reverse()` } remains for the common transform-this-same-field case.

  On a navigated path the recorder intercepts `modify`, so a same-named real method on the value type is shadowed there. `old` is the escape hatch: past `old` the RHS is the real object, so a genuine `modify(Closure)` (or any other domain method) runs and its result is recorded — e.g. `balance = old.balance.modify { it + 50` }. `old` may equally be preferred purely for style, when `.modify` on a path could be misread, even if no real method exists.

  Since:
    6.0.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `CopyWithRecorder(Object self, String prefix, Map<Object, Object> sink)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Object` | `getProperty(String name)`
    `` | `public Object` | `invokeMethod(String name, Object args)`
    `` | `public void` | `setProperty(String name, Object value)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class GroovyObjectSupport` | `getMetaClass, setMetaClass`

- - ### Constructor Detail

    - #### public CopyWithRecorder(Object self, String prefix, Map<Object, Object> sink)

  - ### Method Detail

    - #### public Object getProperty(String name)

    - #### public Object invokeMethod(String name, Object args)

    - #### public void setProperty(String name, Object value)