Class ItemParser

java.lang.Object
org.rumbledb.items.parsing.ItemParser
All Implemented Interfaces:
Serializable

public class ItemParser extends Object implements Serializable
See Also:
  • Constructor Details

    • ItemParser

      public ItemParser()
  • Method Details

    • getItemFromString

      public static Item getItemFromString(String string, ExceptionMetadata metadata)
      Parses a JSON string to an item.
      Parameters:
      string - the JSON string.
      metadata - exception metadata is an error is thrown.
      Returns:
      the parsed item.
    • getItemFromObject

      public static Item getItemFromObject(com.google.gson.stream.JsonReader object, ExceptionMetadata metadata)
      Parses a JSON string, accessible via a reader, to an item.
      Parameters:
      object - the JSON reader.
      metadata - exception metadata is an error is thrown.
      Returns:
      the parsed item.
    • getItemFromYAML

      public static Item getItemFromYAML(com.fasterxml.jackson.dataformat.yaml.YAMLParser parser, com.fasterxml.jackson.core.JsonToken lookahead, ExceptionMetadata metadata)
      Parses a JSON string, accessible via a reader, to an item.
      Parameters:
      parser - the YAML parser.
      lookahead - the lookahead token.
      metadata - exception metadata is an error is thrown.
      Returns:
      the parsed item.
    • getItemFromRow

      public static Item getItemFromRow(org.apache.spark.sql.Row row, ExceptionMetadata metadata, ItemType itemType)
      Converts a DataFrame row to an item.
      Parameters:
      row - the DataFrame row.
      metadata - exception metadata is an error is thrown.
      itemType - the type to annotate the output item with (for now, it can be null for no annotation).
      Returns:
      the converted item.
    • convertValueToItem

      public static Item convertValueToItem(Object o, org.apache.spark.sql.types.DataType fieldType, ExceptionMetadata metadata, ItemType itemType)
    • getItemFromXML

      public static Item getItemFromXML(Node currentNode, String path, boolean removeParentPointers)
      Parses an XML document to an item.
      Parameters:
      currentNode - The current node
      path - The path of the original file
      Returns:
      the parsed item