Class TemplateParser

java.lang.Object
com.github.perdia.queries.parsing.TemplateParser

public class TemplateParser extends Object
Class for parsing template queries in JSON format from the database to Template objects
  • Constructor Details

    • TemplateParser

      public TemplateParser(byte[] bytes)
      Constructor in which the parsing takes place
      Parameters:
      bytes - Byte array containing the single characters of the JSON object to be parsed encoded in UTF-8
  • Method Details

    • parseSingle

      public Template parseSingle()
      Parses the first JSON object present in the JSON array to a Template object
      Returns:
      The parsed Template object
    • parseSingle

      public Template parseSingle(int index)
      Parses the JSON object at the given index in the JSON array to a Template object
      Parameters:
      index - The index of the JSON object to be parsed
      Returns:
      The parsed Template object
    • parseMultiple

      public ArrayList<Template> parseMultiple()
      Parses all the JSON objects in the JSON array to Template objects in an ArrayList
      Returns:
      ArrayList containing all the parsed Template objects
    • templateAmount

      public int templateAmount()
      Returns the amount of JSON objects in the JSON array
      Returns:
      Amount of JSON objects in the JSON array
    • toString

      public String toString()
      Returns the JSON array as a String (with indentation)
      Overrides:
      toString in class Object
      Returns:
      JSON array as a String