Atavism Version 2018.1AGIS API

atavism.msgsys
Class MessageType

java.lang.Object
  extended by atavism.msgsys.MessageType
All Implemented Interfaces:
Marshallable, java.io.Serializable

public class MessageType
extends java.lang.Object
implements java.io.Serializable, Marshallable

Message type object. Message types have a name and a number. The message number is assigned when the MessageType is added to a MessageCatalog.

Applications should declare static MessageType instances using intern(java.lang.String) and reuse that object. For example:

public static MessageType MSG_TYPE_SKY_FALLING = MessageType.intern("me.SKY_FALLING");
It is suggested that the MessageType string name be derived from the program identifier. Atavism reserves all names beginning with "ao.".

See Also:
Serialized Form

Field Summary
protected static java.util.Map<java.lang.String,MessageType> internedMsgTypes
           
protected  java.lang.Integer msgTypeNumber
           
protected  java.lang.String msgTypeString
           
 
Constructor Summary
  MessageType()
          No argument constructor is needed for marshalling.
protected MessageType(java.lang.String msgTypeString)
           
 
Method Summary
 int getMsgTypeNumber()
          Get message type number.
 java.lang.String getMsgTypeString()
          Get message type name.
static MessageType intern(java.lang.String typeName)
          Get singleton MessageType instance for a message type name.
 void marshalObject(AOByteBuffer buf)
          Internal use only.
static MessageType readObjectUtility(java.io.ObjectInputStream in)
          Internal use only.
 void setMsgTypeNumber(int msgTypeNumber)
          Set message type number.
 java.lang.String toString()
           
 java.lang.Object unmarshalObject(AOByteBuffer buf)
          Internal use only.
static void writeObjectUtility(java.io.ObjectOutputStream out, MessageType type)
          Internal use only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

internedMsgTypes

protected static java.util.Map<java.lang.String,MessageType> internedMsgTypes

msgTypeString

protected transient java.lang.String msgTypeString

msgTypeNumber

protected transient java.lang.Integer msgTypeNumber
Constructor Detail

MessageType

public MessageType()
No argument constructor is needed for marshalling.


MessageType

protected MessageType(java.lang.String msgTypeString)
Method Detail

getMsgTypeNumber

public int getMsgTypeNumber()
Get message type number.


setMsgTypeNumber

public void setMsgTypeNumber(int msgTypeNumber)
Set message type number. Applications should add the MessageType to a MessageCatalog to assign a number.


getMsgTypeString

public java.lang.String getMsgTypeString()
Get message type name.


intern

public static MessageType intern(java.lang.String typeName)
Get singleton MessageType instance for a message type name.


toString

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

readObjectUtility

public static MessageType readObjectUtility(java.io.ObjectInputStream in)
                                     throws java.io.IOException,
                                            java.lang.ClassNotFoundException
Internal use only.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeObjectUtility

public static void writeObjectUtility(java.io.ObjectOutputStream out,
                                      MessageType type)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
Internal use only.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

marshalObject

public void marshalObject(AOByteBuffer buf)
Internal use only.

Specified by:
marshalObject in interface Marshallable
Parameters:
buf - The byte buffer

unmarshalObject

public java.lang.Object unmarshalObject(AOByteBuffer buf)
Internal use only.

Specified by:
unmarshalObject in interface Marshallable


Copyright © 2018 Dragonsan Studios Sp. z o.o.