Migrating from 3.3.0 to 3.4.0
Changes to the Wrapper Factory API
Control classes SynControl
and AsyncControl
have been slightly modified,
those are immutable now but do support 'withers' to setup the desired control.
Factories SynControl.control()
and AsyncControl.control()
were
renamed to #defaults()
.
WrapperFactory.asyncWrap
and other async*
sibling methods no longer return a Future<T>
but an AsyncProxy<T>
which allows interaction with the proxied domain
in a more type safe manner.
Example usage
// transaction scoped call to retrieve an attached counter entity
var counter = bookmarkService
.lookup(bookmark, Counter.class).orElseThrow();
// returns a Future<Counter>
var proxy = wrapperFactory.asyncWrap(counter)
.applyAsync(Counter::bumpUsingDeclaredAction);
// then later ...
// returns the detached counter entity
var counter2 = proxy
.tryGet(5, TimeUnit.SECONDS) // blocking
.valueAsNonNullElseFail();
assertThat(counter2.getNum()).isEqualTo(2L);