Enums and binary types.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Enums and binary types.

Vladimir Ozerov
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.
Reply | Threaded
Open this post in threaded view
|

Re: Enums and binary types.

dsetrakyan
On Tue, Nov 24, 2015 at 11:23 AM, Vladimir Ozerov <[hidden email]>
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.
>