# @BeforeMapping / @AfterMapping on a record target versus a bean target (call order, recorded)


--- target is a record: toRecord(Pair) ---
@BeforeMapping(source)
@BeforeMapping(source, @MappingTarget Boxed) target=Boxed[name=pen, qty=3]
@AfterMapping(source, @MappingTarget Boxed) target=Boxed[name=pen, qty=3]
@AfterMapping(source)

--- target is a mutable bean: toBean(Pair) ---
@BeforeMapping(source)
@BeforeMapping(source, @MappingTarget BoxedBean) name=null
  BoxedBean.setName(pen)
  BoxedBean.setQty(3)
@AfterMapping(source, @MappingTarget BoxedBean) name=pen
@AfterMapping(source)

--- the generated toRecord, which is why ---
    public Probes.Boxed toRecord(Probes.Pair pair) {
        beforeSource( pair );

        if ( pair == null ) {
            return null;
        }

        String name = null;
        int qty = 0;

        name = pair.name();
        qty = pair.qty();

        Probes.Boxed boxed = new Probes.Boxed( name, qty );

        beforeRecord( pair, boxed );

        afterRecord( pair, boxed );
        afterSource( pair );

        return boxed;
    }
