Class TemplateParser
java.lang.Object
com.github.perdia.queries.parsing.TemplateParser
Class for parsing template queries in JSON format from the database to Template objects
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionParses all the JSON objects in the JSON array to Template objects in an ArrayListParses the first JSON object present in the JSON array to a Template objectparseSingle
(int index) Parses the JSON object at the given index in the JSON array to a Template objectint
Returns the amount of JSON objects in the JSON arraytoString()
Returns the JSON array as a String (with indentation)
-
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
Parses the first JSON object present in the JSON array to a Template object- Returns:
- The parsed Template object
-
parseSingle
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
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
Returns the JSON array as a String (with indentation)
-