Class FunctionMessage
java.lang.Object
com.jbstrap.core.websocket.messages.BaseMessage
com.jbstrap.core.websocket.messages.FunctionMessage
- All Implemented Interfaces:
MessageWithReturnValue
- Since:
- 4.0
- Author:
- JBStrap
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal FunctionMessage
Adds a parameterfinal FunctionMessage
Adds multiple parameters to the messagefinal String
Gets the JavaScript function name, that will be called.final <T> T
getParam
(int index) Gets the value of the parameter, that is specified by its index.Gets the previously assigned parameters in a list.final long
Gets the timeout amountfinal FunctionMessage
setFunctionName
(String functionName) Sets the JavaScript function name, that will be called.final FunctionMessage
setTimeout
(long timeout) Sets the timeout for the reply message.Methods inherited from class com.jbstrap.core.websocket.messages.BaseMessage
getMessageId, getMessageType
-
Constructor Details
-
FunctionMessage
public FunctionMessage()Creates a function message type message
-
-
Method Details
-
setFunctionName
Sets the JavaScript function name, that will be called.- Parameters:
functionName
- The name of the JavaScript that will be called- Returns:
- The Function call type message
-
getFunctionName
Gets the JavaScript function name, that will be called.- Returns:
- The name of the JavaScript that will be called
-
addParam
Adds a parameter- Parameters:
value
- The parameter value- Returns:
- The function call type message
-
addParams
Adds multiple parameters to the message- Parameters:
values
- The parameter values- Returns:
- The function call type message
-
getParams
Gets the previously assigned parameters in a list.- Returns:
- The list of the assigned parameters. If none were assigned, the list will be empty.
-
setTimeout
Sets the timeout for the reply message.- Parameters:
timeout
- The amount of time for waiting for the reply- Returns:
- The function call type message
-
getTimeout
public final long getTimeout()Gets the timeout amount- Returns:
- The timeout amount
-
getParam
public final <T> T getParam(int index) Gets the value of the parameter, that is specified by its index.- Parameters:
index
- The index of the parameter- Returns:
- The parameter value, or
null
, if not found
-