[ 
https://issues.apache.org/jira/browse/IGNITE-3422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15874371#comment-15874371
 ] 

Vladimir Ozerov commented on IGNITE-3422:
-----------------------------------------

[~daradurvs],
Is it correct that special constructor will be called only in case object 
implements {{Binarylizable}} interface? This logic looks over-restricted to me, 
because in order to properly initialize {{final}} fields user will have to 
implement {{readBinary}} and {{writeBinary}} methods, what looks strange as you 
will have to write two routines - constructor and {{writeBinary}}. 

All in all, we have a kind of consistency problem here. In .NET custom write is 
implemented as separate method, while read is implemented as special 
constructor. In Java we follow {{Externalizable}} ideas where both read and 
write happen in separate methods. If we add another constructor which also 
perform reads, then we will split read logic between two methods - {{ctor}} and 
{{readBinary}}. This looks overcomplicated to me. Moreover, this doesn't fit 
well to {{BinarySerializer}} interface.

[~dmagda], 
Do you really think we need this? Honestly, I've never see any serious demand 
for this feature from user side.

> No way to control object initialization during deserialization/unmarshalling 
> -----------------------------------------------------------------------------
>
>                 Key: IGNITE-3422
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3422
>             Project: Ignite
>          Issue Type: Improvement
>          Components: binary, general
>    Affects Versions: 1.6
>            Reporter: Denis Magda
>            Assignee: Vyacheslav Daradur
>
> Presently there is no way to control instantiation of a {{BinaryObject}} that 
> is being deserialized. The object is created using 
> {{BinaryClassDescriptor#newInstance}} all the time.
> It makes sense to add {{BinaryConfiguration.setInitializationFactory()}} 
> method that will provide with such support.
> Use case and details are provided in this discussion
> http://apache-ignite-users.70518.x6.nabble.com/Properly-Immutable-Keys-values-with-Binary-objects-tp6082.html



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to