Class LabeledMapItem

All Implemented Interfaces:
LabeledItem, Callable, FunctionItem, GroundedValue, Item, Sequence

public class LabeledMapItem extends DelegatingMapItem implements LabeledItem
n A LabeledMapItem represents an XDM map together with a label, which is a map: the map typically contains retained information about how the map was selected within a JSON-like tree.
  • Constructor Details

    • LabeledMapItem

      public LabeledMapItem(MapItem base, MapItem label)
      Create a LabeledMapItem with a supplied label
      Parameters:
      base - the subject map item
      label - the label
  • Method Details

    • getSubject

      public Item getSubject()
      Get the subject item without its label
      Specified by:
      getSubject in interface LabeledItem
      Returns:
      the subject item
    • makePinnedMapItem

      public static LabeledMapItem makePinnedMapItem(MapItem base)
    • get

      public GroundedValue get(AtomicValue key)
      Get the value of the entry in the map with a specified key, retaining information about how that value was selected
      Overrides:
      get in class DelegatingMapItem
      Parameters:
      key - the key of the required entry
      Returns:
      the corresponding value, which will itself have a pedigree if it is a singleton map or array; or null if there is no entry with this key
    • keyValuePairs

      public Iterable<KeyValuePair> keyValuePairs()
      Get an iterable collection of key-value pairs representing the entries in this map; any entry whose value is a singleton array or map will itself have a pedigree indicating how it was selected
      Overrides:
      keyValuePairs in class DelegatingMapItem
      Returns:
      the entries in this map as an iterable collection
    • remove

      public MapItem remove(AtomicValue key)
      Description copied from class: MapItem
      Remove an entry from the map
      Overrides:
      remove in class DelegatingMapItem
      Parameters:
      key - the key of the entry to be removed
      Returns:
      a new map in which the requested entry has been removed; or this map unchanged if the specified key was not present
    • adaptValue

      public static GroundedValue adaptValue(LabeledItem parent, AtomicValue key, GroundedValue value)
    • getLabel

      public MapItem getLabel()
      Get the pedigree of this map item, providing information as to how it was selected.
      Specified by:
      getLabel in interface Item
      Specified by:
      getLabel in interface LabeledItem
      Returns:
      the pedigree of this map item
    • toString

      public String toString()
      Overrides:
      toString in class DelegatingMapItem