Skip to content

KdbDict

Jas edited this page Mar 9, 2017 · 1 revision

KdbDict

This object is a replacement for c.Dict. The main features provided by this are are:

  • Conversion to and from c.Dict

    • new KdbDict(Dict) to create a new object from a kdb Dict
    • KdbDict.convertToDict for conversion to a Dict ready for serialisation by c.java
  • Null detection with add(Object, Object, Class)

    • Java null cannot be serialised by c.java. This add function provides a way of specific which type you are expecting to add. Then at runtime, if the dictionary value is null, the appropriate kdb null is used instead.
  • Standard Java collection methods

    • get, add, isEmpty, has are provided to make it easier to interact with the dictionary data
  • Value get with cast

    • getAs retrieves the requested value with casting to the expected to type, to make your code easier to read

Example Usage

public Dict buildPlayerDictQuery() {
    return new KdbDict()
                    .add("sym", null, Long.class)
                    .add("gameId", 4544332, Long.class)
                    .add("playerId", 1234, Long.class)
                    .convertToDict();
}
Clone this wiki locally