Class JsonBuilder
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.util.JsonBuilder
-
- All Implemented Interfaces:
AutoCloseable
public class JsonBuilder extends Object implements AutoCloseable
The type Json builder.
-
-
Field Summary
Fields Modifier and Type Field Description introot
-
Constructor Summary
Constructors Constructor Description JsonBuilder()Instantiates a new Json builder.JsonBuilder(SafeHandle handle, int root)Instantiates a new Json builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddItem(int item, int index, String find)Adds an item to the specified ajv itemvoidclose()CloseintsetBoolean(int item, boolean value)Sets the boolean of the specified ajv itemintsetDouble(int item, double value)Sets the double of the specified ajv itemintsetInteger(int item, int integer)Sets the integer of the specified ajv itemintsetJson(int item, String json)Sets the json of the specified ajv itemintsetString(int item, String str)Sets the string of the specified ajv itemStringtoString()Returns the string representation of the json.
-
-
-
Constructor Detail
-
JsonBuilder
public JsonBuilder()
Instantiates a new Json builder.
-
JsonBuilder
public JsonBuilder(SafeHandle handle, int root)
Instantiates a new Json builder.- Parameters:
handle- the handle
-
-
Method Detail
-
addItem
public int addItem(int item, int index, String find)Adds an item to the specified ajv item- Parameters:
item- the specified ajv item to add toindex- the index to add the new item atfind- the json key to associate with the new item- Returns:
- the ajv item added
-
setJson
public int setJson(int item, String json)Sets the json of the specified ajv item- Parameters:
item- the specified ajv item to set the value ofjson- the json value to associate with the item- Returns:
- HR indicating success or failure
-
setString
public int setString(int item, String str)Sets the string of the specified ajv item- Parameters:
item- the specified ajv item to set the value ofstr- the string value to associate with the item- Returns:
- HR indicating success or failure
-
setBoolean
public int setBoolean(int item, boolean value)Sets the boolean of the specified ajv item- Parameters:
item- the specified ajv item to set the value ofvalue- the boolean value to associate with the item- Returns:
- HR indicating success or failure
-
setInteger
public int setInteger(int item, int integer)Sets the integer of the specified ajv item- Parameters:
item- the specified ajv item to set the value ofinteger- the integer value to associate with the item- Returns:
- HR indicating success or failure
-
setDouble
public int setDouble(int item, double value)Sets the double of the specified ajv item- Parameters:
item- the specified ajv item to set the value ofvalue- the double value to associate with the item- Returns:
- HR indicating success or failure
-
toString
public String toString()
Returns the string representation of the json.
-
close
public void close() throws ExceptionClose- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- will throw if private handle.close fails.
-
-