ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Setrakyan <dsetrak...@apache.org>
Subject Re: BinaryObjectBuilder in EntryProcessor
Date Fri, 11 Dec 2015 13:58:11 GMT
On Fri, Dec 11, 2015 at 3:44 AM, Yakov Zhdanov <yzhdanov@apache.org> wrote:

> how about "toBuilder()"?
>

I like it. Also, does it make sense to pass a copy of the BinaryObject into
the EntryProcessor?


>
> --Yakov
>
> 2015-12-11 13:02 GMT+03:00 Alexey Goncharuk <alexey.goncharuk@gmail.com>:
>
> > Igniters,
> >
> > I was creating an example showing how to use BinaryObjects and
> > EntryProcessor for the case when server nodes do not have cache classes
> > definitions and realized that there is no straightforward way to get an
> > instance of BinaryObjectBuilder inside of an EntryProcessor.
> >
> > Currently the only way to do this is to inject an instance of Ignite to
> the
> > instance of EntryProcessor and get a reference to IgniteBinary from it,
> > which looks a bit too verbose to me:
> >
> > class MyEntryProcessor {
> >     @IgniteInstanceResource
> >     private Ignite ignite;
> >
> >     BinaryObject invoke(...) {
> >         BinaryObjectBulder bld =
> ignite.binary().builder(entry.getValue());
> >
> >         entry.setValue(bld.setField("a", 2).build());
> >     }
> > }
> >
> > I think we can add something like a "BinaryBuilder buildCopy();" method
> to
> > the BinaryObject interface which will create a new binary builder
> > initialized with the current binary object. Now the above EntryProcessor
> > will look as follows:
> >
> > class MyEntryProcessor {
> >     BinaryObject invoke(...) {
> >         entry.setValue(entry.getValue().buildCopy().setField("a",
> > 2).build());
> >     }
> > }
> >
> > Thoughts?
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message