Class ObjectItem

java.lang.Object
org.rumbledb.items.ObjectItem
All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable, Serializable, Item

public class ObjectItem extends Object implements Item
See Also:
  • Constructor Details

    • ObjectItem

      public ObjectItem()
    • ObjectItem

      public ObjectItem(List<String> keys, List<Item> values, ExceptionMetadata itemMetadata)
    • ObjectItem

      public ObjectItem(Map<String,?> keyValuePairs)
      ObjectItem constructor from the given map data structure. For each key, the corresponding values list is turned into an ArrayItem if it contains more than a single element.
      Parameters:
      keyValuePairs - LinkedHashMap -- this map implementation preserves order of the keys -- essential for functionality
  • Method Details

    • equals

      public boolean equals(Object otherItem)
      Description copied from interface: Item
      Tests for logical equality. The semantics are that of the eq operator.
      Specified by:
      equals in interface Item
      Overrides:
      equals in class Object
      Parameters:
      otherItem - another item.
      Returns:
      true it is equal to other, false otherwise.
    • isMap

      public boolean isMap()
      Description copied from interface: Item
      Tests whether the item is a map.
      Specified by:
      isMap in interface Item
      Returns:
      true if it is a map, false otherwise.
    • isObject

      public boolean isObject()
      Description copied from interface: Item
      Tests whether the item is an object. Object items are legacy JSONiq objects, that allow only for - string keys - singleton values
      Specified by:
      isObject in interface Item
      Returns:
      true if it is an object, false otherwise.
    • getKeys

      public List<String> getKeys()
      Description copied from interface: Item
      Returns the string keys of the item, if it is a map.
      Specified by:
      getKeys in interface Item
      Returns:
      the list of the keys.
    • getStringKeys

      public List<String> getStringKeys()
      Description copied from interface: Item
      Returns the string keys of the item, if it is a map.
      Specified by:
      getStringKeys in interface Item
      Returns:
      a list of strings, corresponding to the keys of the map.
    • getItemKeys

      public List<Item> getItemKeys()
      Description copied from interface: Item
      Returns the (possibly non-string) atomic keys of the item, if it is a map-like object.
      Specified by:
      getItemKeys in interface Item
      Returns:
      the list of atomic keys as items.
    • getValues

      public List<Item> getValues()
      Description copied from interface: Item
      Returns the values of the item, if it is a map.
      Specified by:
      getValues in interface Item
      Returns:
      the list of the value items.
    • getItemValues

      public List<Item> getItemValues()
      Description copied from interface: Item
      Returns the values of the item, if it is a map.
      Specified by:
      getItemValues in interface Item
      Returns:
      a list containing, for each key in the map, the item associated with that key.
    • getSequenceValues

      public List<List<Item>> getSequenceValues()
      Description copied from interface: Item
      Returns the value sequences of the item, if it is a map.
      Specified by:
      getSequenceValues in interface Item
      Returns:
      a list containing, for each key in the map, the sequence of items associated with that key.
    • getItemByKey

      public Item getItemByKey(String key)
      Description copied from interface: Item
      Returns the value item associated with a specific key, if it is a map.
      Specified by:
      getItemByKey in interface Item
      Parameters:
      key - a string key.
      Returns:
      the item associated with the key, or null if absent.
    • getItemByKey

      public Item getItemByKey(Item key)
      Description copied from interface: Item
      Returns the value item associated with a specific key, if it is an object.
      Specified by:
      getItemByKey in interface Item
      Parameters:
      key - a key item.
      Returns:
      the item associated with the key, or null if absent.
    • getSequenceByKey

      public List<Item> getSequenceByKey(String key)
      Description copied from interface: Item
      Returns the value sequence associated with a string key, if it is a map.
      Specified by:
      getSequenceByKey in interface Item
      Parameters:
      key - a string key.
      Returns:
      the value sequence for the key, or null if absent.
    • getSequenceByKey

      public List<Item> getSequenceByKey(Item key)
      Description copied from interface: Item
      Returns the value sequence associated with a key, if it is a map-like object.
      Specified by:
      getSequenceByKey in interface Item
      Parameters:
      key - an atomic key item.
      Returns:
      the value sequence for the key, or null if absent.
    • putItemByKey

      public void putItemByKey(String key, Item value)
      Description copied from interface: Item
      Adds a key-value pair, if it is a map.
      Specified by:
      putItemByKey in interface Item
      Parameters:
      key - a key.
      value - a value.
    • putItemByKey

      public void putItemByKey(Item key, Item value)
      Description copied from interface: Item
      Adds a key-value pair, if it is a map.
      Specified by:
      putItemByKey in interface Item
      Parameters:
      key - an atomic key.
      value - a value.
    • putSequenceByKey

      public void putSequenceByKey(String key, List<Item> valueSequence)
      Description copied from interface: Item
      Adds a key-sequence pair, if it is a map.
      Specified by:
      putSequenceByKey in interface Item
      Parameters:
      key - an atomic key.
      valueSequence - a value sequence.
    • putSequenceByKey

      public void putSequenceByKey(Item key, List<Item> valueSequence)
      Description copied from interface: Item
      Adds a key-sequence pair, if it is a map.
      Specified by:
      putSequenceByKey in interface Item
      Parameters:
      key - an atomic key.
      valueSequence - a value sequence.
    • removeItemByKey

      public void removeItemByKey(String key)
      Description copied from interface: Item
      Removes a key-value pair, if it is a map.
      Specified by:
      removeItemByKey in interface Item
      Parameters:
      key - a key.
    • removeItemByKey

      public void removeItemByKey(Item key)
      Description copied from interface: Item
      Removes a key-value pair, if it is a map.
      Specified by:
      removeItemByKey in interface Item
      Parameters:
      key - an atomic key.
    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
    • hashCode

      public int hashCode()
      Description copied from interface: Item
      Computes a hash code.
      Specified by:
      hashCode in interface Item
      Overrides:
      hashCode in class Object
      Returns:
      a hash code as an int.
    • getDynamicType

      public ItemType getDynamicType()
      Description copied from interface: Item
      Returns the dynamic type of the item (only for error message purposes).
      Specified by:
      getDynamicType in interface Item
      Returns:
      the dynamic type as an item type.
    • getEffectiveBooleanValue

      public boolean getEffectiveBooleanValue()
      Description copied from interface: Item
      Returns the effective boolean value of the item, if atomic.
      Specified by:
      getEffectiveBooleanValue in interface Item
      Returns:
      the effective boolean value.
    • getMutabilityLevel

      public int getMutabilityLevel()
      Description copied from interface: Item
      Returns the mutability level of the item.
      Specified by:
      getMutabilityLevel in interface Item
      Returns:
      an int representing nestedness of the item inside transform expressions.
    • setMutabilityLevel

      public void setMutabilityLevel(int mutabilityLevel)
      Description copied from interface: Item
      Sets the mutability level of the item to a supplied value.
      Specified by:
      setMutabilityLevel in interface Item
      Parameters:
      mutabilityLevel - new mutability level.
    • getTopLevelID

      public long getTopLevelID()
      Description copied from interface: Item
      Returns the top level ID of the item.
      Specified by:
      getTopLevelID in interface Item
      Returns:
      int representing the rowID of the item within a DeltaFile.
    • setTopLevelID

      public void setTopLevelID(long topLevelID)
      Description copied from interface: Item
      Sets the top level ID of the item to a supplied value.
      Specified by:
      setTopLevelID in interface Item
      Parameters:
      topLevelID - new top level ID.
    • getTopLevelOrder

      public double getTopLevelOrder()
      Description copied from interface: Item
      Returns the top level order (sequence number) identifier
      Specified by:
      getTopLevelOrder in interface Item
      Returns:
      double representing rowOrder of the tuple
    • setTopLevelOrder

      public void setTopLevelOrder(double topLevelOrder)
      Description copied from interface: Item
      Sets the top level order parameter (rowOrder)
      Specified by:
      setTopLevelOrder in interface Item
      Parameters:
      topLevelOrder - new rowOrder value
    • getPathIn

      public String getPathIn()
      Description copied from interface: Item
      Returns the path from the top level object of a DeltaFile for the item.
      Specified by:
      getPathIn in interface Item
      Returns:
      String representing the path of the item from the top level within a DeltaFile.
    • setPathIn

      public void setPathIn(String pathIn)
      Description copied from interface: Item
      Sets the path from the top level object of a DeltaFile for the item to a supplied value.
      Specified by:
      setPathIn in interface Item
      Parameters:
      pathIn - new path from top level.
    • getTableLocation

      public String getTableLocation()
      Description copied from interface: Item
      Returns the location of the DeltaFile for the item.
      Specified by:
      getTableLocation in interface Item
      Returns:
      String representing the location of the DeltaFile for the item.
    • setTableLocation

      public void setTableLocation(String location)
      Description copied from interface: Item
      Sets the location of the DeltaFile for the item to a supplied value.
      Specified by:
      setTableLocation in interface Item
      Parameters:
      location - new location of the DeltaFile for the item.
    • getSparkSQLValue

      public String getSparkSQLValue()
      Description copied from interface: Item
      Returns the SparkSQL value of the item for use in a query.
      Specified by:
      getSparkSQLValue in interface Item
      Returns:
      String representing the SparkSQL value of the item.
    • getSparkSQLValue

      public String getSparkSQLValue(ItemType itemType)
      Description copied from interface: Item
      Returns the SparkSQL value of the item for use in a query.
      Specified by:
      getSparkSQLValue in interface Item
      Returns:
      String representing the SparkSQL value of the item.
    • getSparkSQLType

      public String getSparkSQLType()
      Description copied from interface: Item
      Returns the SparkSQL type of the item for use in a query.
      Specified by:
      getSparkSQLType in interface Item
      Returns:
      String representing the SparkSQL type of the item.
    • atomizedValue

      public List<Item> atomizedValue()
      Description copied from interface: Item
      XDM 3.1 Section 5.12 string-value Accessor. dm:string-value($n as node()) as xs:string "The dm:string-value accessor returns the string-value of the node as defined for each node kind." In this API, node string values are exposed via getStringValue() and the default implementation of dm:typed-value delegates to atomizedValue().
      Specified by:
      atomizedValue in interface Item
    • getStringValue

      public String getStringValue()
      Description copied from interface: Item
      Returns the string value of the item, if it is an atomic item.
      Specified by:
      getStringValue in interface Item
      Returns:
      the string value.
    • getVariantValue

      public Object getVariantValue()
      Description copied from interface: Item
      Returns the Object containing the converted value of the item for a DataFrame. For use to build Variant columns.
      Specified by:
      getVariantValue in interface Item
      Returns:
      Object representing the converted value of the item.
    • getCollection

      public Collection getCollection()
      Description copied from interface: Item
      Returns the collection to which the item belongs, if any. Only defined for top-level items.
      Specified by:
      getCollection in interface Item
      Returns:
      the collection.
    • setCollection

      public void setCollection(Collection collection)
      Description copied from interface: Item
      Sets the collection to which the item belongs. Only defined for top-level items.
      Specified by:
      setCollection in interface Item
      Parameters:
      collection - the collection.