Val., Alex G., Igniters,
Who knows why fields of Object[] type returned from PortableBuilderImpl.getField() are wrapped by PortableBuilderReader.LazyCollection internally by the builder while String[], UUID[] and many others are processed as PortablePlainLazyValue? This leads to an inconsistent behavior. I can get an Object[] field with PortableBuilderImpl.getField("arr_field"), then modify its content and after calling PortableBuilderImpl.build().deserailize() I'll have an object that has "arr_field" with the latest modifications. This doesn't work for String[] and others more type specific arrays (see PortableBuilderReader starting from line 391). However, according to GridPortableBuilderAdditionalSelfTest.testModifyObjectArray() the behavior for fields of Object[] type that is currently implemented is incorrect. It means that Object[] fields must be wrapped by PortablePlainLazyValue as well. So I want to make the behavior consistent across arrays of all types. Two possible approaches: 1) All arrays will be wrapped by PortablePlainLazyValue; 2) All arrays will be wrapped by PortableBuilderReader.LazyCollection. I'm prefer 2) cause it looks more natural allowing the user to get an array field, modify it and then serialize/deserialize the whole object with the latest changes. Any ideas on this? -- Denis |
Since no one has responded yet I've implemented what I suppose a proper
behavior is. Modifications for arrays of any kind returned from PortableBuilder.getField() method are reflected. Under these modifications I mean an ability to change an array's content in a way that when a portable object is being serialized/deserialized all content changes will be taken into account. Changes will be sent for review a bit later when I fix other functionality that was reported as broken as a part of this issue: https://issues.apache.org/jira/browse/IGNITE-1273 -- Denis On 8/28/2015 5:06 PM, Denis Magda wrote: > Val., Alex G., Igniters, > > Who knows why fields of Object[] type returned from > PortableBuilderImpl.getField() are wrapped by > PortableBuilderReader.LazyCollection internally by the builder while > String[], UUID[] and many others are processed as PortablePlainLazyValue? > > This leads to an inconsistent behavior. > I can get an Object[] field with > PortableBuilderImpl.getField("arr_field"), then modify its content and > after calling PortableBuilderImpl.build().deserailize() I'll have an > object that has "arr_field" with the latest modifications. > This doesn't work for String[] and others more type specific arrays > (see PortableBuilderReader starting from line 391). > > However, according to > GridPortableBuilderAdditionalSelfTest.testModifyObjectArray() the > behavior for fields of Object[] type that is currently implemented is > incorrect. > It means that Object[] fields must be wrapped by > PortablePlainLazyValue as well. > > So I want to make the behavior consistent across arrays of all types. > Two possible approaches: > 1) All arrays will be wrapped by PortablePlainLazyValue; > 2) All arrays will be wrapped by PortableBuilderReader.LazyCollection. > > I'm prefer 2) cause it looks more natural allowing the user to get an > array field, modify it and then serialize/deserialize the whole object > with the latest changes. > > Any ideas on this? > > -- > Denis |
Free forum by Nabble | Edit this page |