rescrv/HyperDex — pull request #66 by neikos (2012-08-03 15:04:03+00:00)
Title: More user-friendly querying of retrieved java collection types w.r.t. string types

If a retrieved attribute value was a hyperdex map (string,XXX). In java, it would come in the form a **Map** interface keyed by the **ByteArray** class. To lookup a value in the map, you would have to do **map.get(new ByteArray("my string key","UTF-8"))** or **map.get(ByteArray.encode("my string key","UTF-8"))** -- essentially wrapping the non-**ByteArray** key. Because **"my string key"** is not of type **ByteArray**, **map.get("my string key")** would return **null**

Now, with this fix, if an application knows that the bytes in the map were encoded with the HyperClient instance's default string encoding then **map.get("my string key")** will do the job. Likewise, for hyperdex list(string) or set(string), **list.contains("my string element")** and **set.contains("my string element")** will work. You don't have to do **list.contains(new ByteArray("my string element","UTF-8"))** or **set.contains(new ByteArray("my string element","UTF-8"))** anymore.

You can also query with a java primitive **byte[]** in all of the above cases. For instance, if the application knows that a given key in a map was encoded using **UTF-16BE**, different from HyperClient instance's current default, then **map.get((new String("my 16BE string")).getBytes("UTF-16BE"))** will do the job. Or if a value in the retrieved map was keyed by arbitrary bytes -- not following any String encoding, you can now just do **map.get(myBytes)** where **myBytes** is of type **byte[]**. You don't have to wrap it like, **map.get(new ByteArray(myBytes))** or **map.get(ByteArray.wrap(myBytes))**, anymore.