Platform SDK Java 8.5 API Reference

com.genesyslab.platform.commons.connection
Class ConnectionMessage

java.lang.Object
  extended by com.genesyslab.platform.commons.connection.ConnectionMessage
All Implemented Interfaces:
java.lang.Cloneable

public final class ConnectionMessage
extends java.lang.Object
implements java.lang.Cloneable

Message to/from server. The message usually consists of its id and set of attributes. Each attribute has its own id (or type). The message can't contain two (or more) attributes with the same id, so calling put method several times with the same id will replace attributes in the message.


Constructor Summary
ConnectionMessage(int id)
          Creates the message.
ConnectionMessage(int id, int attrCount)
          Creates the message with known attribute count.
 
Method Summary
 void add(int id, byte[] val)
          Adds binary (byte array) attribute to this message.
 void add(int id, int val)
          Adds integer attribute to this message.
 void add(int id, java.lang.Integer val)
          Adds integer attribute to this message.
 void add(int id, KeyValueCollection val)
          Adds KeyValueCollection attribute to this message.
 void add(int id, KeyValueCollection val, java.lang.String encoding)
          Adds KeyValueCollection attribute to this message.
 void add(int id, long val)
          Adds long attribute to this message.
 void add(int id, java.lang.Long val)
          Adds long attribute to this message.
 void add(int id, java.lang.String val)
          Adds string attribute to this message.
 java.lang.Object clone()
           
 java.lang.Object deleteAttrib(int id)
          Deletes attribute by ID.
 int getAttributeCount()
          Gets number of attributes in this Message.
 java.util.Iterator getAttributeIds()
          Gets attribute ids in this message as Iterator through Integer objects.
 byte[] getBinary(int id)
          Gets binary (byte array) attribute value from the Message by ID.
 java.util.Iterator getEntries()
          Gets attributes and their ids in this message as Iterator through Map.Entry objects.
 java.lang.Integer getInt(int id)
          Gets integer attribute value from the Message by ID.
 KeyValueCollection getKeyValueCollection(int id)
          Gets KeyValueCollection attribute value from the Message by ID.
 KeyValueCollection getKeyValueCollection(int id, java.lang.String encoding)
          Gets KeyValueCollection attribute value from the Message by ID.
 java.lang.Long getLong(int id)
          Gets long attribute value from the Message by ID.
 int getMessageId()
          Returns message id (type).
 java.lang.Object getObject(int id)
          Gets attribute value from the Message by ID.
 java.lang.String getString(int id)
          Gets string attribute value from the Message by ID.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionMessage

public ConnectionMessage(int id)
Creates the message.

Parameters:
id - message id (or type)

ConnectionMessage

public ConnectionMessage(int id,
                         int attrCount)
Creates the message with known attribute count.

Parameters:
id - message id (or type)
Method Detail

getMessageId

public int getMessageId()
Returns message id (type).

Returns:
message id

add

public void add(int id,
                int val)
Adds integer attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value

add

public void add(int id,
                java.lang.Integer val)
Adds integer attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value

add

public void add(int id,
                long val)
Adds long attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value

add

public void add(int id,
                java.lang.Long val)
Adds long attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value

add

public void add(int id,
                java.lang.String val)
Adds string attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value

add

public void add(int id,
                byte[] val)
Adds binary (byte array) attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value

add

public void add(int id,
                KeyValueCollection val)
Adds KeyValueCollection attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value

add

public void add(int id,
                KeyValueCollection val,
                java.lang.String encoding)
         throws java.io.UnsupportedEncodingException
Adds KeyValueCollection attribute to this message.

Parameters:
id - Attribute ID
val - Attribute value
Throws:
java.io.UnsupportedEncodingException

deleteAttrib

public java.lang.Object deleteAttrib(int id)
Deletes attribute by ID.

Parameters:
id - Attribute ID
Returns:
deleted attribute as an Object, or null if no such attribute in the ConnectionMessage

getInt

public java.lang.Integer getInt(int id)
Gets integer attribute value from the Message by ID.

Parameters:
id - Attribute ID
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type

getLong

public java.lang.Long getLong(int id)
Gets long attribute value from the Message by ID.

Parameters:
id - Attribute ID
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type

getString

public java.lang.String getString(int id)
Gets string attribute value from the Message by ID.

Parameters:
id - Attribute ID
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type

getBinary

public byte[] getBinary(int id)
Gets binary (byte array) attribute value from the Message by ID.

Parameters:
id - Attribute ID
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type

getKeyValueCollection

public KeyValueCollection getKeyValueCollection(int id)
Gets KeyValueCollection attribute value from the Message by ID.

Parameters:
id - Attribute ID
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type

getKeyValueCollection

public KeyValueCollection getKeyValueCollection(int id,
                                                java.lang.String encoding)
                                         throws java.io.UnsupportedEncodingException
Gets KeyValueCollection attribute value from the Message by ID.

Parameters:
id - Attribute ID
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage or it has wrong type
Throws:
java.io.UnsupportedEncodingException

getObject

public java.lang.Object getObject(int id)
Gets attribute value from the Message by ID.

Parameters:
id - Attribute ID
Returns:
attribute value, or null if there is no such attribute in the ConnectionMessage

getAttributeIds

public java.util.Iterator getAttributeIds()
Gets attribute ids in this message as Iterator through Integer objects.

Returns:
Iterator of ids

getEntries

public java.util.Iterator getEntries()
Gets attributes and their ids in this message as Iterator through Map.Entry objects. The key in the entry is Integer object and the value is Object.

Returns:
Enumeration of ids

getAttributeCount

public int getAttributeCount()
Gets number of attributes in this Message.

Returns:
number of attributes

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.