Package org.rumbledb.items.parsing
Class ItemParser
java.lang.Object
org.rumbledb.items.parsing.ItemParser
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ItemconvertValueToItem(Object o, org.apache.spark.sql.types.DataType fieldType, ExceptionMetadata metadata, ItemType itemType) static ItemgetItemFromObject(com.google.gson.stream.JsonReader object, ExceptionMetadata metadata) Parses a JSON string, accessible via a reader, to an item.static ItemgetItemFromRow(org.apache.spark.sql.Row row, ExceptionMetadata metadata, ItemType itemType) Converts a DataFrame row to an item.static ItemgetItemFromString(String string, ExceptionMetadata metadata) Parses a JSON string to an item.static ItemgetItemFromXML(Node currentNode, String path, boolean removeParentPointers) Parses an XML document to an item.static ItemgetItemFromYAML(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.
-
Constructor Details
-
ItemParser
public ItemParser()
-
-
Method Details
-
getItemFromString
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
Parses an XML document to an item.- Parameters:
currentNode- The current nodepath- The path of the original file- Returns:
- the parsed item
-