Hi, You need to set the key and value type. In Java, there is no other way to get hold of the class (that's the way generics work).
Regards, Thomas On Mon, Aug 14, 2017 at 2:09 PM, <tez...@gmail.com> wrote: > Hi, > > > H2 version 1.4.196; I implemented a custom data type. After opening map > : MVMap<CustomType, String> map = store.openMap("any"); > > > CustomType's methods wont be called. It is treated as a Object, so instead of > my implementation, Java serialization is called. > > > > > > *Builder object in method MVStore.java line 441 :* > > > *..... *openMap( String name, MVMap.MapBuilder<M, K, V> builder) > > > > The builder object used in this method does not set keyType and valueType, > they are still null, > > > so they will be set to ObjectDataType whenever builder.create() is called ( > at *MVMap.java line 456 or 468*) > > > > > > This is builder.create() : > > > *MVMap.java line 1333 :* > > > @Override > public MVMap<K, V> create() { > if (keyType == null) { > keyType = new ObjectDataType(); > } > if (valueType == null) { > valueType = new ObjectDataType(); > } > return new MVMap<K, V>(keyType, valueType); > } > > > > > > > If I set key and value type as in below, it works but looks horrible :) > > > .... = store.openMap("mymap", new MVMap.Builder<CustomType, > String>().keyType(CustomType.INSTANCE).valueType(StringDataType.INSTANCE)); > > > > > Is there a proper way to do it or does it need a fix? > > > > Thanks, > > > Ozan. > > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to h2-database+unsubscr...@googlegroups.com. > To post to this group, send email to h2-database@googlegroups.com. > Visit this group at https://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.