Trillo Java SDK
Search
K

BaseApi (Basic APIs)

asJSONPrettyString

Convert a map object to a json formatted string.
BaseApi.asJSONPrettyString(Object obj)
Parameters
obj: the object (can be a hashmap)
Returns
the formatted string​

asJSONString

Convert map object to a json string​ without formatting.
BaseApi.asJSONString(Object obj)
Parameters
obj: object
Returns
the json string​

fromJSONString

Convert a json string​ to a map object.
BaseApi.fromJSONString(String json)
Parameters
json: string representation of json
Returns
constructed hashmap​

fromJSONStringAsArray

Convert a json string​ as a linked hashmap. The map can be interpreted later on.
BaseApi.fromJSONStringAsArray(String json)
Parameters
json: string representation of json
Returns
the array of json objects

readJSON

Read the JSON from a file name​ located in a specific directory. It is converted into an map object.
BaseApi.readJSON(String dir, String fileName)
Parameters
dir: the directory
fileName: name of the file
Returns
json document object​

writeJSON

Write a map object into a file​ located on a specific directory.
BaseApi.writeJSON(String dir, String fileName, Object obj)
Parameters
dir: directory
fileName: name of the file
obj: json document object
Returns
result of the operation​

writePrettyJSON

Write a map object into a file​ located on a specific directory. The JSON information is a formatted inside the file.
BaseApi.writePrettyJSON(String dir, String fileName, Object obj)
Parameters
dir: directory
fileName: name of the file
obj: json formatted document
Returns
result of the operation​

successResult

Build and return a successful result map object.​
BaseApi.successResult()
or
BaseApi.successResult(String msg)
or
BaseApi.successResult(String msg, Object data)
Parameters
msg message to be sent
data
Returns
result of the operation​

errorResult

Build and return an error result map object.​
BaseApi.errorResult(String msg)
or
BaseApi.errorResult(String msg, int code)
Parameters
msg: message to be sent
code: return code
Returns
the result of the operation​

extractMessage

Extract the message from the result object​. The result object has a detailed message in it therefore it will be returned.
BaseApi.extractMessage(Object obj)
Parameters
obj: object as a hashmap
Returns
message string​

isResult

Checking whether the object is a result object​.
BaseApi.isResult(Object obj)
Parameters
obj: the object as a hashmap
Returns
status of the result​

isResultOrNull

Checking if result object is a valid one or a just a NuLL
BaseApi.isResultOrNull(Object obj)
Parameters
obj: the object as a hashmap
Returns
the status of the result​

UUID

Generate a UUID sequence.
BaseApi.UUID()
Parameters
none​
Returns
the uuid​

uidToClassName

Extract class name​ from an input string.
BaseApi.uidToClassName(String uid)
Parameters
uid: the className id
Returns
the class name​

uidToId

Extract an long id number from a string UID.
BaseApi.uidToId(String uid)
Parameters
uid:
Returns

uidToIdStr

Retrieves​ the ID as a string from uid.
BaseApi.uidToIdStr(String uid)
Parameters
uid:
Returns

waitForMillis

Wait for certain MS​ given as a long number. It is a blocking function call.
BaseApi.waitForMillis(long tm)
Parameters
tm:
Returns

remoteCall

// Basic Description //
BaseApi.remoteCall(String javaClassName, String javaMethodName, Object... args)
Parameters
javaClassName
javaMethodName

Returns

// Some code

remoteCallAsResult

// Description //
BaseApi.remoteCallAsResult(String javaClassName, String javaMethodName, Object... args)

Parameters

javaClassName
javaMethodName

Returns

// Some code

remoteCallAsMap

// Description //
BaseApi.remoteCallAsMap(String javaClassName, String javaMethodName, Object... args)

Parameters

javaClassName
javaMethodName

Returns

// Some code

remoteCallAsString

// Description //
BaseApi.remoteCallAsString(String javaClassName, String javaMethodName, Object... args)

Parameters

javaClassName
javaMethodName

Returns

// Some code

remoteCallAsList

// Description //
BaseApi.remoteCallAsList(String javaClassName, String javaMethodName, Object... args)

Parameters

javaClassName
javaMethodName

Returns

// Some code

remoteCallAsListOfMaps

// Description //
BaseApi.remoteCallAsListOfMaps(String javaClassName, String javaMethodName, Object... args)

Parameters

javaClassName
javaMethodName

Returns

// Some code