|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.connection.ConnectionMessage
public final class ConnectionMessage
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 |
---|
public ConnectionMessage(int id)
id
- message id (or type)public ConnectionMessage(int id, int attrCount)
id
- message id (or type)Method Detail |
---|
public int getMessageId()
public void add(int id, int val)
id
- Attribute IDval
- Attribute valuepublic void add(int id, java.lang.Integer val)
id
- Attribute IDval
- Attribute valuepublic void add(int id, long val)
id
- Attribute IDval
- Attribute valuepublic void add(int id, java.lang.Long val)
id
- Attribute IDval
- Attribute valuepublic void add(int id, java.lang.String val)
id
- Attribute IDval
- Attribute valuepublic void add(int id, byte[] val)
id
- Attribute IDval
- Attribute valuepublic void add(int id, KeyValueCollection val)
id
- Attribute IDval
- Attribute valuepublic void add(int id, KeyValueCollection val, java.lang.String encoding) throws java.io.UnsupportedEncodingException
id
- Attribute IDval
- Attribute value
java.io.UnsupportedEncodingException
public java.lang.Object deleteAttrib(int id)
id
- Attribute ID
null
if no such attribute in the ConnectionMessage
public java.lang.Integer getInt(int id)
id
- Attribute ID
null
if there is
no such attribute in the ConnectionMessage
or it has wrong typepublic java.lang.Long getLong(int id)
id
- Attribute ID
null
if there is
no such attribute in the ConnectionMessage
or it has wrong typepublic java.lang.String getString(int id)
id
- Attribute ID
null
if there is
no such attribute in the ConnectionMessage
or it has wrong typepublic byte[] getBinary(int id)
id
- Attribute ID
null
if there is
no such attribute in the ConnectionMessage
or it has wrong typepublic KeyValueCollection getKeyValueCollection(int id)
KeyValueCollection
attribute value from the Message by ID.
id
- Attribute ID
null
if there is
no such attribute in the ConnectionMessage
or it has wrong typepublic KeyValueCollection getKeyValueCollection(int id, java.lang.String encoding) throws java.io.UnsupportedEncodingException
KeyValueCollection
attribute value from the Message by ID.
id
- Attribute ID
null
if there is
no such attribute in the ConnectionMessage
or it has wrong type
java.io.UnsupportedEncodingException
public java.lang.Object getObject(int id)
id
- Attribute ID
null
if there is
no such attribute in the ConnectionMessage
public java.util.Iterator getAttributeIds()
Integer
objects.
public java.util.Iterator getEntries()
Map.Entry
objects. The key in the entry is
Integer
object and the value is Object.
public int getAttributeCount()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class java.lang.Object
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |