Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2981

Manage Enum type as Map keys

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0
    • Component/s: BSON, POJO
    • Labels:
      None

      Hello,

      Current limitation of the MapCodec is that it only manages Map<K,V> with K being necessarily String.

      It could be quite easy and useful to extend this to Enums in a first step, and to any type that can be serialized/deserialized to/from String.

      An idea to be able to manage any type as a map's key is to introduce a kind of "key codec" interface that defines how should a certain type be encoded/decoded if it appears as a map's key. It could even be a converter rather than a general codec since we know that the target type is necessarily String.

       

      Cheers

      Farid

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            fbg Farid BG
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: