tcMenuJavaAPI
Public Member Functions | Static Public Attributes | List of all members
com.thecoderscorner.menu.remote.protocol.TagValTextParser Class Reference

Public Member Functions

 TagValTextParser (ByteBuffer buffer) throws IOException
 
String getValue (String keyMsgType) throws TcProtocolException
 
String getValueWithDefault (String keyMsgType, String defaultVal)
 
int getValueAsInt (String keyIdField) throws TcProtocolException
 
int getValueAsIntWithDefault (String keyIdField, int defaultVal) throws TcProtocolException
 
String toString ()
 

Static Public Attributes

static final char FIELD_TERMINATOR = '|'
 

Detailed Description

This is the parser implementation that understands tag value format and can convert the tags back into a series of tags and values suitable for the protocol to decode messages.

Constructor & Destructor Documentation

◆ TagValTextParser()

com.thecoderscorner.menu.remote.protocol.TagValTextParser.TagValTextParser ( ByteBuffer  buffer) throws IOException

Creates an instance that contains all the tags and values in a map, that can then be used to extract the message.

Parameters
buffera buffer containing a message.
Exceptions
IOExceptionif the buffer is invalid

Member Function Documentation

◆ getValue()

String com.thecoderscorner.menu.remote.protocol.TagValTextParser.getValue ( String  keyMsgType) throws TcProtocolException

Gets the value associated with the key from the message. This version throws an exception if the key is not available and should be used for mandatory fields

Parameters
keyMsgTypethe key to obtain
Returns
the associated value

◆ getValueAsInt()

int com.thecoderscorner.menu.remote.protocol.TagValTextParser.getValueAsInt ( String  keyIdField) throws TcProtocolException

Calls the getValue method first and the converts to an integer.

Parameters
keyIdFieldthe key to obtain
Returns
the integer value associated

◆ getValueAsIntWithDefault()

int com.thecoderscorner.menu.remote.protocol.TagValTextParser.getValueAsIntWithDefault ( String  keyIdField,
int  defaultVal 
) throws TcProtocolException

Calls the getValue method first and the converts to an integer.

Parameters
keyIdFieldthe key to obtain
Returns
the integer value associated

◆ getValueWithDefault()

String com.thecoderscorner.menu.remote.protocol.TagValTextParser.getValueWithDefault ( String  keyMsgType,
String  defaultVal 
)

Gets the value associated with the key from the message if it exists in the underlying map. This version returns the default value if it does not exist.

Parameters
keyMsgTypethe key to obtain
Returns
the associated value or the default

The documentation for this class was generated from the following file: