Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following new or modificated operators are provided in keyvalue feature.

KeyValueToTuple (Deprecated, use ToTuple operator instead.)

Transforms key-value object to tuples. Use the SCHEMA attribute to define:

...

Code Block
          ['$','root','KeyValueObject'],
          ['monday', 'List(Integer)'],
          ['$..monday.length()','MondaySize','mondayCount','Integer'],
          ['$.uuid', 'String'],
          ['$.monday[0]',MondayFirst, 'Integer'],

 


WIth the type field you can set the type of the tuple.

...

There are some MEP-Functions that can be used in the MAP-Operator:

  • KeyValueObject: asKeyValue(Object kv): Cast an object to a KeyValueObject (could be necessary if Odysseus can not determine the type of an object). KV must be a KeyValueObject, else there will be a ClassCastException
  • KeyValueObject: toKeyValue(String): Creates a new KeyValueObject from a String JSON Expression
  • Object: getElement(KeyValueObject kv, String path): Returns the one element identified by the path expression. 
  • Tuple:

...

  • getElements(KeyValueObject kv, String path): Returns a tuple of elements identified by the path expression.
  • Object: path(KeyValueObject kv, String path): Returns the one object that is identified by the JSONPATH epxression. Slower than getElement(s) but more expressive.TODO

Wrapper

The feature adds protocol handler for the common key-value data formats JSON and BSON (binary JSON).

...