public class MethodParser extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MethodParser.Operation |
| Constructor and Description |
|---|
MethodParser()
CONSTRUCTOR
Create a MethodParser instance with provided values.
|
MethodParser(Object payload)
CONSTRUCTOR
Create a MethodParser instance with provided values.
|
MethodParser(String name,
Long responseTimeout,
Long connectTimeout,
Object payload)
CONSTRUCTOR
Create a MethodParser instance with provided values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromJson(String json)
Set the Method collection with the provided information in the json.
|
Object |
getPayload()
Return an Object with the payload.
|
Integer |
getStatus()
Return an Integer with the response status.
|
String |
toJson()
Create a String with a json content that represents all the information in the method collection.
|
com.google.gson.JsonElement |
toJsonElement()
Create a JsonElement with a content that represents all the information in the method collection.
|
public MethodParser()
public MethodParser(String name, Long responseTimeout, Long connectTimeout, Object payload) throws IllegalArgumentException
name - - method name [required].responseTimeout - - maximum interval of time, in seconds, that the Direct Method will wait for answer. It can be null.connectTimeout - - maximum interval of time, in seconds, that the Direct Method will wait for the connection. It can be null.payload - - Object that contains the payload defined by the user. It can be null.IllegalArgumentException - This exception is thrown if the one of the provided information do not fits the requirements.public MethodParser(Object payload)
payload - - Object that contains the payload defined by the user. It can be null.public void fromJson(String json) throws IllegalArgumentException
json - - Json with the information to change the collection.
- If contains `methodName`, it is a full method including `methodName`, `responseTimeoutInSeconds`, `connectTimeoutInSeconds`, and `payload`.
- If contains `status`, it is a response with `status` and `payload`.
- Otherwise, it is only `payload`.IllegalArgumentException - This exception is thrown if the one of the provided information do not fits the requirements.public Integer getStatus() throws IllegalArgumentException
null.IllegalArgumentException - This exception is thrown if the operation is not type of `response`.public Object getPayload()
null.public String toJson() throws IllegalArgumentException
IllegalArgumentException - This exception is thrown if the one of the provided information do not fits the requirements.public com.google.gson.JsonElement toJsonElement()
throws IllegalArgumentException
IllegalArgumentException - This exception is thrown if the one of the provided information do not fits the requirements.Copyright © 2019. All rights reserved.