Class InstanceParser
java.lang.Object
com.github.perdia.queries.parsing.InstanceParser
Class for parsing instance queries in JSON format from the database to Instance objects
-
Constructor Summary
ConstructorDescriptionInstanceParser
(byte[] bytes) Constructor in which the byte array turns in to a JSON array which then gets processed further -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the amount of JSON objects in the JSON arrayParses all the JSON objects in the JSON array to Instance objects in an ArrayListParses the first JSON object present in the JSON array to an Instance objectparseSingle
(int index) Parses the JSON object at the given index in the JSON array to an Instance objecttoString()
Returns the JSON array as a String (with indentation)
-
Constructor Details
-
InstanceParser
public InstanceParser(byte[] bytes) Constructor in which the byte array turns in to a JSON array which then gets processed further- Parameters:
bytes
- Byte array containing the single characters of the JSON objects to be parsed encoded in UTF-8
-
-
Method Details
-
parseSingle
Parses the first JSON object present in the JSON array to an Instance object- Returns:
- The parsed Instance object
-
parseSingle
Parses the JSON object at the given index in the JSON array to an Instance object- Parameters:
index
- The index of the JSON object to be parsed- Returns:
- The parsed Instance object
-
parseMultiple
Parses all the JSON objects in the JSON array to Instance objects in an ArrayList- Returns:
- ArrayList containing all the parsed Instance objects
-
instanceAmount
public int instanceAmount()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)
-