You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Vladimir Ozerov <vo...@gridgain.com> on 2015/11/24 09:23:51 UTC

Enums and binary types.

Folks,

Recently we revealed an inconsistency in our binary serialization when
BinaryObject.field() is called (*IGNITE-1956*):
- When field is an object, BinaryObject is returned, i.e. it is not
deserialized.
- When field is enum, we always try to deserialize it. This way, user
cannot work with enums if corresponding class is not loaded to JVM (or type
is not loaded to .NET).

The problem can be solved using three new methods:
1) BinaryType.isEnum() - to let user know whether type is enum or not.
2) BinaryObject.enumOrdinal() - to get ordinal is this object is enum.
Exception will be thrown otherwise.
3) IgniteBinaries.createEnum(String typeName, int ordinal) - to create
enums when there is not matching class/type in runtime.

Thoughts?

Vladimir.

Re: Enums and binary types.

Posted by Dmitriy Setrakyan <ds...@apache.org>.
On Tue, Nov 24, 2015 at 11:23 AM, Vladimir Ozerov <vo...@gridgain.com>
wrote:

> Folks,
>
> Recently we revealed an inconsistency in our binary serialization when
> BinaryObject.field() is called (*IGNITE-1956*):
> - When field is an object, BinaryObject is returned, i.e. it is not
> deserialized.
> - When field is enum, we always try to deserialize it. This way, user
> cannot work with enums if corresponding class is not loaded to JVM (or type
> is not loaded to .NET).
>
> The problem can be solved using three new methods:
> 1) BinaryType.isEnum() - to let user know whether type is enum or not.
> 2) BinaryObject.enumOrdinal() - to get ordinal is this object is enum.
> Exception will be thrown otherwise.
> 3) IgniteBinaries.createEnum(String typeName, int ordinal) - to create
> enums when there is not matching class/type in runtime.
>
> Thoughts?
>

I think it makes sense. Would be nice to see the updated javadoc. Can you
please send the links whenever the javadoc is updated?


>
> Vladimir.
>